diff --git a/models/spring-ai-mistral-ai/src/main/java/org/springframework/ai/mistralai/api/MistralAiApi.java b/models/spring-ai-mistral-ai/src/main/java/org/springframework/ai/mistralai/api/MistralAiApi.java index bfa326cc8..e6fdb543c 100644 --- a/models/spring-ai-mistral-ai/src/main/java/org/springframework/ai/mistralai/api/MistralAiApi.java +++ b/models/spring-ai-mistral-ai/src/main/java/org/springframework/ai/mistralai/api/MistralAiApi.java @@ -586,7 +586,11 @@ public class MistralAiApi { /** * The content was omitted due to a flag from our content filters. */ - @JsonProperty("model_length") MODEL_LENGTH + @JsonProperty("model_length") MODEL_LENGTH, + /** + * The model called a tool. + */ + @JsonProperty("tool_call") TOOL_CALL // @formatter:on } diff --git a/models/spring-ai-openai/src/main/java/org/springframework/ai/openai/api/OpenAiApi.java b/models/spring-ai-openai/src/main/java/org/springframework/ai/openai/api/OpenAiApi.java index 1f954f158..5cab9c081 100644 --- a/models/spring-ai-openai/src/main/java/org/springframework/ai/openai/api/OpenAiApi.java +++ b/models/spring-ai-openai/src/main/java/org/springframework/ai/openai/api/OpenAiApi.java @@ -470,7 +470,11 @@ public class OpenAiApi { /** * (deprecated) The model called a function. */ - @JsonProperty("function_call") FUNCTION_CALL + @JsonProperty("function_call") FUNCTION_CALL, + /** + * Only for compatibility with Mistral AI API. + */ + @JsonProperty("tool_call") TOOL_CAL } /** diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/nav.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/nav.adoc index 0ca8fe7ae..c23e54b34 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/nav.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/nav.adoc @@ -12,6 +12,7 @@ **** xref:api/embeddings/bedrock-cohere-embedding.adoc[Cohere] **** xref:api/embeddings/bedrock-titan-embedding.adoc[Titan] *** xref:api/embeddings/onnx.adoc[Transformers (ONNX)] +*** xref:api/embeddings/mistralai-embeddings.adoc[Mistral AI] ** xref:api/chatclient.adoc[] *** xref:api/clients/openai-chat.adoc[OpenAI] **** xref:api/clients/functions/openai-chat-functions.adoc[Function Calling] @@ -28,6 +29,7 @@ **** xref:api/clients/vertexai-palm2-chat.adoc[VertexAI PaLM2 ] **** xref:api/clients/vertexai-gemini-chat.adoc[VertexAI Gemini] ***** xref:api/clients/functions/vertexai-gemini-chat-functions.adoc[Function Calling] +*** xref:api/clients/mistralai-chat.adoc[Mistral AI] ** xref:api/imageclient.adoc[] *** xref:api/clients/image/openai-image.adoc[OpenAI] *** xref:api/clients/image/stabilityai-image.adoc[Stability] diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chatclient.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chatclient.adoc index f1617937b..128f8aea7 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chatclient.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chatclient.adoc @@ -186,6 +186,7 @@ image::spring-ai-chat-completions-clients.jpg[align="center", width="800px"] ** xref:api/clients/bedrock/bedrock-llama2.adoc[Llama2 Chat Completion] ** xref:api/clients/bedrock/bedrock-titan.adoc[Titan Chat Completion] ** xref:api/clients/bedrock/bedrock-anthropic.adoc[Anthropic Chat Completion] +* xref:api/clients/mistralai-chat.adoc[Mistral AI Chat Completion] (streaming & function-calling support) == Chat Model API diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/clients/mistralai-chat.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/clients/mistralai-chat.adoc new file mode 100644 index 000000000..b5c219fb1 --- /dev/null +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/clients/mistralai-chat.adoc @@ -0,0 +1,227 @@ += Mistral AI Chat + +Spring AI supports the various AI language models from Mistral AI. You can interact with Mistral AI language models and create a multilingual conversational assistant based on Mistral models. + +== Prerequisites + +You will need to create an API with MistralAI to access Mistral AI language models. +Create an account at https://auth.mistral.ai/ui/registration[MistralAI registration page] and generate the token on the https://console.mistral.ai/api-keys/[API Keys page]. +The Spring AI project defines a configuration property named `spring.ai.mistralai.api-key` that you should set to the value of the `API Key` obtained from console.mistral.ai. +Exporting an environment variable is one way to set that configuration property: + +[source,shell] +---- +export SPRING_AI_MISTRALAI_API_KEY= +---- + +=== Add Repositories and BOM + +Spring AI artifacts are published in Spring Milestone and Snapshot repositories. +Refer to the xref:getting-started.adoc#repositories[Repositories] section to add these repositories to your build system. + +To help with dependency management, Spring AI provides a BOM (bill of materials) to ensure that a consistent version of Spring AI is used throughout the entire project. Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build system. + + + +== Auto-configuration + +Spring AI provides Spring Boot auto-configuration for the MistralAI Chat Client. +To enable it add the following dependency to your project's Maven `pom.xml` file: + +[source, xml] +---- + + org.springframework.ai + spring-ai-mistral-ai-spring-boot-starter + +---- + +or to your Gradle `build.gradle` build file. + +[source,groovy] +---- +dependencies { + implementation 'org.springframework.ai:spring-ai-mistral-ai-spring-boot-starter' +} +---- + +TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build file. + +=== Chat Properties + +The prefix `spring.ai.mistralai` is used as the property prefix that lets you connect to OpenAI. + +[cols="3,5,1"] +|==== +| Property | Description | Default + +| spring.ai.mistralai.base-url | The URL to connect to | https://api.mistral.ai +| spring.ai.mistralai.api-key | The API Key | - +|==== + +The prefix `spring.ai.mistralai.chat` is the property prefix that lets you configure the chat client implementation for MistralAI. + +[cols="3,5,1"] +|==== +| Property | Description | Default + +| spring.ai.mistralai.chat.enabled | Enable MistralAI chat client. | true +| spring.ai.mistralai.chat.base-url | Optional overrides the spring.ai.mistralai.base-url to provide chat specific url | - +| spring.ai.mistralai.chat.api-key | Optional overrides the spring.ai.mistralai.api-key to provide chat specific api-key | - +| spring.ai.mistralai.chat.options.model | This is the MistralAI Chat model to use | `mistral-tiny` (the `gpt-3.5-turbo`, `gpt-4`, and `gpt-4-32k` point to the latest model versions) +| spring.ai.mistralai.chat.options.temperature | The sampling temperature to use that controls the apparent creativity of generated completions. Higher values will make output more random while lower values will make results more focused and deterministic. It is not recommended to modify temperature and top_p for the same completions request as the interaction of these two settings is difficult to predict. | 0.8 +| spring.ai.mistralai.chat.options.maxTokens | The maximum number of tokens to generate in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length. | - +| spring.ai.mistralai.chat.options.safePrompt | Indicates whether to inject a security prompt before all conversations. | false +| spring.ai.mistralai.chat.options.randomSeed | This feature is in Beta. If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. | - +| spring.ai.mistralai.chat.options.stop | Up to 4 sequences where the API will stop generating further tokens. | - +| spring.ai.mistralai.chat.options.topP | An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both. | - +|==== + +NOTE: You can override the common `spring.ai.mistralai.base-url` and `spring.ai.mistralai.api-key` for the `ChatClient` and `EmbeddingClient` implementations. +The `spring.ai.mistralai.chat.base-url` and `spring.ai.mistralai.chat.api-key` properties if set take precedence over the common properties. +This is useful if you want to use different MistralAI accounts for different models and different model endpoints. + +TIP: All properties prefixed with `spring.ai.mistralai.chat.options` can be overridden at runtime by adding a request specific <> to the `Prompt` call. + +=== Chat Options [[chat-options]] + +The https://github.com/spring-projects/spring-ai/blob/main/models/spring-ai-mistralai/src/main/java/org/springframework/ai/mistralai/MistralAiChatOptions.java[MistralAiChatOptions.java] provides model configurations, such as the model to use, the temperature, the frequency penalty, etc. + +On start-up, the default options can be configured with the `MistralAiChatClient(api, options)` constructor or the `spring.ai.mistralai.chat.options.*` properties. + +At run-time you can override the default options by adding new, request specific, options to the `Prompt` call. +For example to override the default model and temperature for a specific request: + +[source,java] +---- +ChatResponse response = chatClient.call( + new Prompt( + "Generate the names of 5 famous pirates.", + MistralAiChatOptions.builder() + .withModel("mistral-medium") + .withTemperature(0.5f) + .build() + )); +---- + +TIP: In addition to the model specific https://github.com/spring-projects/spring-ai/blob/main/models/spring-ai-mistralai/src/main/java/org/springframework/ai/mistralai/MistralAiChatOptions.java[MistralAiChatOptions] you can use a portable https://github.com/spring-projects/spring-ai/blob/main/spring-ai-core/src/main/java/org/springframework/ai/chat/ChatOptions.java[ChatOptions] instance, created with the https://github.com/spring-projects/spring-ai/blob/main/spring-ai-core/src/main/java/org/springframework/ai/chat/ChatOptionsBuilder.java[ChatOptionsBuilder#builder()]. + +=== Sample Controller (Auto-configuration) + +https://start.spring.io/[Create] a new Spring Boot project and add the `spring-ai-mistralai-spring-boot-starter` to your pom (or gradle) dependencies. + +Add a `application.properties` file, under the `src/main/resources` directory, to enable and configure the OpenAi Chat client: + +[source,application.properties] +---- +spring.ai.mistralai.api-key=YOUR_API_KEY +spring.ai.mistralai.chat.options.model=mistral-medium +spring.ai.mistralai.chat.options.temperature=0.7 +---- + +TIP: replace the `api-key` with your OpenAI credentials. + +This will create a `MistralAiChatClient` implementation that you can inject into your class. +Here is an example of a simple `@Controller` class that uses the chat client for text generations. + +[source,java] +---- +@RestController +public class ChatController { + + private final MistralAiChatClient chatClient; + + @Autowired + public ChatController(MistralAiChatClient chatClient) { + this.chatClient = chatClient; + } + + @GetMapping("/ai/generate") + public Map generate(@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) { + return Map.of("generation", chatClient.call(message)); + } + + @GetMapping("/ai/generateStream") + public Flux generateStream(@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) { + var prompt = new Prompt(new UserMessage(message)); + return chatClient.stream(prompt); + } +} +---- + +== Manual Configuration + +The https://github.com/spring-projects/spring-ai/blob/main/models/spring-ai-mistralai/src/main/java/org/springframework/ai/mistralai/MistralAiChatClient.java[MistralAiChatClient] implements the `ChatClient` and `StreamingChatClient` and uses the <> to connect to the MistralAI service. + +Add the `spring-ai-mistralai` dependency to your project's Maven `pom.xml` file: + +[source, xml] +---- + + org.springframework.ai + spring-ai-mistralai + +---- + +or to your Gradle `build.gradle` build file. + +[source,groovy] +---- +dependencies { + implementation 'org.springframework.ai:spring-ai-mistralai' +} +---- + +TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build file. + +Next, create a `MistralAiChatClient` and use it for text generations: + +[source,java] +---- +var mistralAiApi = new MistralAiApi(System.getenv("MISTRAL_AI_API_KEY")); + +var chatClient = new MistralAiChatClient(mistralAiApi, MistralAiChatOptions.builder() + .withModel("mistral-small") + .withTemperature(0.4f) + .withMaxToken(200) + .build()); + +ChatResponse response = chatClient.call( + new Prompt("Generate the names of 5 famous pirates.")); + +// Or with streaming responses +Flux response = chatClient.stream( + new Prompt("Generate the names of 5 famous pirates.")); +---- + +The `MistralAiChatOptions` provides the configuration information for the chat requests. +The `MistralAiChatOptions.Builder` is fluent options builder. + +=== Low-level MistralAiApi Client [[low-level-api]] + +The https://github.com/spring-projects/spring-ai/blob/main/models/spring-ai-mistralai/src/main/java/org/springframework/ai/mistralai/api/MistralAiApi.java[MistralAiApi] provides is lightweight Java client for link:https://docs.mistral.ai/api/[Mistral AI API]. + +Here is a simple snippet how to use the api programmatically: + +[source,java] +---- +MistralAiApi mistralAiApi = + new MistralAiApi(System.getenv("MISTRAL_AI_API_KEY")); + +ChatCompletionMessage chatCompletionMessage = + new ChatCompletionMessage("Hello world", Role.USER); + +// Sync request +ResponseEntity response = mistralAiApi.chatCompletionEntity( + new ChatCompletionRequest(List.of(chatCompletionMessage), "mistral-small", 0.8f, false)); + +// Streaming request +Flux streamResponse = mistralAiApi.chatCompletionStream( + new ChatCompletionRequest(List.of(chatCompletionMessage), "mistral-small", 0.8f, true)); +---- + +Follow the https://github.com/spring-projects/spring-ai/blob/main/models/spring-ai-mistral-ai/src/main/java/org/springframework/ai/mistralai/api/MistralAiApi.java[MistralAiApi.java]'s JavaDoc for further information. + +==== MistralAiApi Samples +The link:https://github.com/spring-projects/spring-ai/blob/main/models/spring-ai-mistral-ai/src/test/java/org/springframework/ai/mistralai/api/MistralAiApiIT.java[MistralAiApiIT.java] test provides some general examples how to use the lightweight library. + diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings.adoc index 387c4d556..5bd3ce6c7 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings.adoc @@ -157,4 +157,5 @@ Internally the various `EmbeddingClient` implementations use different low-level * xref:api/embeddings/postgresml-embeddings.adoc[Spring AI PostgresML Embeddings] * xref:api/embeddings/bedrock-cohere-embedding.adoc[Spring AI Bedrock Cohere Embeddings] * xref:api/embeddings/bedrock-titan-embedding.adoc[Spring AI Bedrock Titan Embeddings] -* xref:api/embeddings/vertexai-embeddings.adoc[Spring AI VertexAI Embeddings] +* xref:api/embeddings/vertexai-embeddings.adoc[Spring AI VertexAI PaLM2 Embeddings] +* xref:api/embeddings/mistralai-embeddings.adoc[Spring AI Mistral AI Embeddings] diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/mistralai-embeddings.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/mistralai-embeddings.adoc new file mode 100644 index 000000000..3c0379eec --- /dev/null +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/embeddings/mistralai-embeddings.adoc @@ -0,0 +1,179 @@ += Mistral AI Embeddings + +Spring AI supports the Mistral AI's text embeddings models. +Embeddings are vectorial representations of text that capture the semantic meaning of paragraphs through their position in a high dimensional vector space. Mistral AI Embeddings API offers cutting-edge, state-of-the-art embeddings for text, which can be used for many NLP tasks. + +== Prerequisites + +You will need to create an API with MistralAI to access MistralAI embeddings models. + +Create an account at https://auth.mistral.ai/ui/registration[MistralAI registration page] and generate the token on the https://console.mistral.ai/api-keys/[API Keys page]. +The Spring AI project defines a configuration property named `spring.ai.mistralai.api-key` that you should set to the value of the `API Key` obtained from console.mistral.ai. +Exporting an environment variable is one way to set that configuration property: + +[source,shell] +---- +export SPRING_AI_MISTRALAI_API_KEY= +---- + +=== Add Repositories and BOM + +Spring AI artifacts are published in Spring Milestone and Snapshot repositories. Refer to the xref:getting-started.adoc#repositories[Repositories] section to add these repositories to your build system. + +To help with dependency management, Spring AI provides a BOM (bill of materials) to ensure that a consistent version of Spring AI is used throughout the entire project. Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build system. + + +== Auto-configuration + +Spring AI provides Spring Boot auto-configuration for the MistralAI Embedding Client. +To enable it add the following dependency to your project's Maven `pom.xml` file: + +[source, xml] +---- + + org.springframework.ai + spring-ai-mistral-ai-spring-boot-starter + +---- + +or to your Gradle `build.gradle` build file. + +[source,groovy] +---- +dependencies { + implementation 'org.springframework.ai:spring-ai-mistral-ai-spring-boot-starter' +} +---- + +TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build file. + +=== Embedding Properties + +The prefix `spring.ai.mistralai` is used as the property prefix that lets you connect to MistralAI. + +[cols="3,5,1"] +|==== +| Property | Description | Default + +| spring.ai.mistralai.base-url | The URL to connect to | https://api.mistral.ai +| spring.ai.mistralai.api-key | The API Key | - +|==== + +The prefix `spring.ai.mistralai.embedding` is property prefix that configures the `EmbeddingClient` implementation for MistralAI. + +[cols="3,5,1"] +|==== +| Property | Description | Default + +| spring.ai.mistralai.embedding.enabled | Enable OpenAI embedding client. | true +| spring.ai.mistralai.embedding.base-url | Optional overrides the spring.ai.mistralai.base-url to provide embedding specific url | - +| spring.ai.mistralai.embedding.api-key | Optional overrides the spring.ai.mistralai.api-key to provide embedding specific api-key | - +| spring.ai.mistralai.embedding.metadata-mode | Document content extraction mode. | EMBED +| spring.ai.mistralai.embedding.options.model | The model to use | mistral-embed +| spring.ai.mistralai.embedding.options.encodingFormat | The format to return the embeddings in. Can be either float or base64. | - +|==== + +NOTE: You can override the common `spring.ai.mistralai.base-url` and `spring.ai.mistralai.api-key` for the `ChatClient` and `EmbeddingClient` implementations. +The `spring.ai.mistralai.embedding.base-url` and `spring.ai.mistralai.embedding.api-key` properties if set take precedence over the common properties. +Similarly, the `spring.ai.mistralai.embedding.base-url` and `spring.ai.mistralai.embedding.api-key` properties if set take precedence over the common properties. +This is useful if you want to use different MistralAI accounts for different models and different model endpoints. + +TIP: All properties prefixed with `spring.ai.mistralai.embedding.options` can be overridden at runtime by adding a request specific <> to the `EmbeddingRequest` call. + +=== Embedding Options [[embedding-options]] + +The https://github.com/spring-projects/spring-ai/blob/main/models/spring-ai-mistral-ai/src/main/java/org/springframework/ai/mistralai/MistralAiEmbeddingOptions.java[MistralAiEmbeddingOptions.java] provides the MistralAI configurations, such as the model to use and etc. + +The default options can be configured using the `spring.ai.mistralai.embedding.options` properties as well. + +At start-time use the `MistralAiEmbeddingClient` constructor to set the default options used for all embedding requests. +At run-time you can override the default options, using a `MistralAiEmbeddingOptions` instance as part of your `EmbeddingRequest`. + +For example to override the default model name for a specific request: + +[source,java] +---- +EmbeddingResponse embeddingResponse = embeddingClient.call( + new EmbeddingRequest(List.of("Hello World", "World is big and salvation is near"), + MistralAiEmbeddingOptions.builder() + .withModel("Different-Embedding-Model-Deployment-Name") + .build())); +---- + +=== Sample Controller (Auto-configuration) + +This will create a `EmbeddingClient` implementation that you can inject into your class. +Here is an example of a simple `@Controller` class that uses the `EmbeddingClient` implementation. + +[source,application.properties] +---- +spring.ai.mistralai.api-key=YOUR_API_KEY +spring.ai.mistralai.embedding.options.model=mistral-embed +---- + +[source,java] +---- +@RestController +public class EmbeddingController { + + private final EmbeddingClient embeddingClient; + + @Autowired + public EmbeddingController(EmbeddingClient embeddingClient) { + this.embeddingClient = embeddingClient; + } + + @GetMapping("/ai/embedding") + public Map embed(@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) { + var embeddingResponse = this.embeddingClient.embedForResponse(List.of(message)); + return Map.of("embedding", embeddingResponse); + } +} +---- + +== Manual Configuration + +If you are not using Spring Boot, you can manually configure the OpenAI Embedding Client. +For this add the `spring-ai-mistralai` dependency to your project's Maven `pom.xml` file: +[source, xml] +---- + + org.springframework.ai + spring-ai-mistralai + +---- + +or to your Gradle `build.gradle` build file. + +[source,groovy] +---- +dependencies { + implementation 'org.springframework.ai:spring-ai-mistralai' +} +---- + +TIP: Refer to the xref:getting-started.adoc#dependency-management[Dependency Management] section to add the Spring AI BOM to your build file. + +NOTE: The `spring-ai-mistralai` dependency provides access also to the `MistralAiChatClient`. +For more information about the `MistralAiChatClient` refer to the link:../clients/mistralai-chat.html[MistralAI Chat Client] section. + +Next, create an `MistralAiEmbeddingClient` instance and use it to compute the similarity between two input texts: + +[source,java] +---- +var mistralAiApi = new MistralAiApi(System.getenv("MISTRAL_AI_API_KEY")); + +var embeddingClient = new MistralAiEmbeddingClient(mistralAiApi, + MistralAiEmbeddingOptions.builder() + .withModel("mistral-embed") + .withEncodingFormat("float") + .build()); + +EmbeddingResponse embeddingResponse = embeddingClient + .embedForResponse(List.of("Hello World", "World is big and salvation is near")); +---- + +The `MistralAiEmbeddingOptions` provides the configuration information for the embedding requests. +The options class offers a `builder()` for easy options creation. + + diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/functions.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/functions.adoc index 82f117f57..7048c01e2 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/functions.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/functions.adoc @@ -3,8 +3,9 @@ The integration of function support in AI models, such as ChatGPT, permits the model to request the execution of client-side functions, thereby accessing necessary information or performing tasks dynamically as required. -Spring AI currently supports Function invocation in the AI Models +Spring AI currently supports Function invocation for the following AI Models * OpenAI: Refer to the xref:api/clients/functions/openai-chat-functions.adoc[Open AI function invocation docs]. * VertexAI Gemini: Refer to the xref:api/clients/functions/vertexai-gemini-chat-functions.adoc[Vertex AI Gemini function invocation docs]. -* Azure OpenAI: Refer to the xref:api/clients/functions/azure-open-ai-chat-functions.adoc[Azure OpenAI function invocation docs]. \ No newline at end of file +* Azure OpenAI: Refer to the xref:api/clients/functions/azure-open-ai-chat-functions.adoc[Azure OpenAI function invocation docs]. +// * Mistral AI: Refer to the xref:api/clients/functions/mistralai-chat-functions.adoc[Mistral AI function invocation docs]. \ No newline at end of file diff --git a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/mistralai/MistralAiChatProperties.java b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/mistralai/MistralAiChatProperties.java index 47e3dc027..1a53bf52e 100644 --- a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/mistralai/MistralAiChatProperties.java +++ b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/mistralai/MistralAiChatProperties.java @@ -29,7 +29,7 @@ import org.springframework.boot.context.properties.NestedConfigurationProperty; @ConfigurationProperties(MistralAiChatProperties.CONFIG_PREFIX) public class MistralAiChatProperties extends MistralAiParentProperties { - public static final String CONFIG_PREFIX = "spring.ai.mistral.chat"; + public static final String CONFIG_PREFIX = "spring.ai.mistralai.chat"; public static final String DEFAULT_CHAT_MODEL = MistralAiApi.ChatModel.TINY.getValue(); diff --git a/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/mistralai/tool/PaymentStatusBeanIT.java b/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/mistralai/tool/PaymentStatusBeanIT.java index ffc5f4c0c..33fdaad50 100644 --- a/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/mistralai/tool/PaymentStatusBeanIT.java +++ b/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/mistralai/tool/PaymentStatusBeanIT.java @@ -56,7 +56,7 @@ class PaymentStatusBeanIT { void functionCallTest() { contextRunner - .withPropertyValues("spring.ai.mistral.chat.options.model=" + MistralAiApi.ChatModel.LARGE.getValue()) + .withPropertyValues("spring.ai.mistralai.chat.options.model=" + MistralAiApi.ChatModel.LARGE.getValue()) .run(context -> { MistralAiChatClient chatClient = context.getBean(MistralAiChatClient.class); diff --git a/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/mistralai/tool/PaymentStatusPromptIT.java b/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/mistralai/tool/PaymentStatusPromptIT.java index 77b89270e..1992d28af 100644 --- a/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/mistralai/tool/PaymentStatusPromptIT.java +++ b/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/mistralai/tool/PaymentStatusPromptIT.java @@ -67,7 +67,7 @@ public class PaymentStatusPromptIT { @Test void functionCallTest() { contextRunner - .withPropertyValues("spring.ai.mistral.chat.options.model=" + MistralAiApi.ChatModel.SMALL.getValue()) + .withPropertyValues("spring.ai.mistralai.chat.options.model=" + MistralAiApi.ChatModel.SMALL.getValue()) .run(context -> { MistralAiChatClient chatClient = context.getBean(MistralAiChatClient.class); diff --git a/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/mistralai/tool/WeatherServicePromptIT.java b/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/mistralai/tool/WeatherServicePromptIT.java index cea101cf2..97bc1a28a 100644 --- a/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/mistralai/tool/WeatherServicePromptIT.java +++ b/spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/mistralai/tool/WeatherServicePromptIT.java @@ -60,7 +60,7 @@ public class WeatherServicePromptIT { @Test void promptFunctionCall() { contextRunner - .withPropertyValues("spring.ai.mistral.chat.options.model=" + MistralAiApi.ChatModel.LARGE.getValue()) + .withPropertyValues("spring.ai.mistralai.chat.options.model=" + MistralAiApi.ChatModel.LARGE.getValue()) .run(context -> { MistralAiChatClient chatClient = context.getBean(MistralAiChatClient.class);