Watsonx.ai AI Models
IBM Watsonx.ai models provide a comprehensive suite of AI capabilities including chat models, embedding models, and moderation. This documentation covers the integration of Watsonx.ai services with Spring AI applications.
Overview
Watsonx.ai offers several powerful AI models:
-
Chat Models: Conversational AI models for building intelligent chatbots and assistants
-
Embedding Models: Text embedding models for semantic search and similarity analysis
-
Moderation Models: Content moderation capabilities for safe and responsible AI
Documentation Navigation
Explore the complete documentation:
-
Getting Started - Quick start guide and initial setup
-
Core Concepts - Understand the architecture and key concepts
-
API Reference - Complete API documentation
-
Models
-
Chat Models - Conversational AI capabilities
-
Embedding Models - Text embedding generation
-
Moderation Models - Content moderation features
-
-
Configuration - Configure your application
-
Sample Applications - Ready-to-use sample projects
-
AI Judges & Evaluation - Quality assessment and testing
-
Examples - Comprehensive code examples
-
Contributing - How to contribute to the project
Prerequisites
To use the Watsonx.ai models, you need to:
-
Create an account at IBM Cloud
-
Set up a Watsonx.ai service instance
-
Generate API keys from the IBM Cloud console
Quick Start
To get started with Watsonx.ai models in your application, add the following dependency:
<dependency>
<groupId>org.springaicommunity</groupId>
<artifactId>spring-ai-starter-model-watsonx-ai</artifactId>
<version>1.0.0</version>
</dependency>
implementation 'org.springaicommunity:spring-ai-starter-model-watsonx-ai:1.0.0'
Configure your Watsonx.ai credentials in application.yml:
spring:
ai:
watsonx:
ai:
api-key: ${WATSONX_AI_API_KEY}
url: ${WATSONX_AI_URL}
project-id: ${WATSONX_AI_PROJECT_ID}
Or in application.properties:
spring.ai.watsonx.ai.api-key=${WATSONX_AI_API_KEY}
spring.ai.watsonx.ai.url=${WATSONX_AI_URL}
spring.ai.watsonx.ai.project-id=${WATSONX_AI_PROJECT_ID}
Set your credentials as environment variables:
export WATSONX_AI_API_KEY=<INSERT API KEY HERE>
export WATSONX_AI_URL=<INSERT WATSONX AI URL HERE>
export WATSONX_AI_PROJECT_ID=<INSERT PROJECT ID HERE>
| For more configuration options, see the Configuration Guide. |
Source Code
The source code for this project is available on GitHub at spring-ai-community/spring-ai-watsonx-ai.
Available Services
| Service | Description |
|---|---|
Build conversational AI applications with Watsonx.ai’s various chat models |
|
Generate text embeddings for semantic search and text similarity analysis |
|
Content moderation capabilities for safe and responsible AI applications |
Architecture
The Spring AI Watsonx.ai integration consists of three main modules:
-
watsonx-ai-core: Core implementation with API clients and model classes
-
spring-ai-autoconfigure-model-watsonx-ai: Spring Boot auto-configuration
-
spring-ai-starter-model-watsonx-ai: Spring Boot starter for easy integration
Supported Models
Chat Models
-
IBM Granite models
-
Meta Llama models
-
Mistral AI models
-
And other foundation models available in Watsonx.ai
Embedding Models
-
IBM’s embedding models
-
Sentence transformers
-
Custom embedding models deployed in Watsonx.ai
Moderation Models
-
IBM’s content moderation models
-
Toxicity detection
-
Hate speech detection
-
PII (Personally Identifiable Information) detection
-
Custom moderation models
Getting Help
If you encounter issues or have questions:
-
Check the GitHub Issues
-
Review the Spring AI documentation
-
Consult the IBM Watsonx.ai documentation