Skip to content

Commit

Permalink
Merge pull request #431 from philippart-s/mistral-doc-πŸ“
Browse files Browse the repository at this point in the history
feat: πŸ“ add configuration doc for Mistral AI
  • Loading branch information
geoand authored Apr 1, 2024
2 parents 7e9bca7 + 618c421 commit 390955e
Show file tree
Hide file tree
Showing 2 changed files with 339 additions and 0 deletions.
302 changes: 302 additions & 0 deletions docs/modules/ROOT/pages/includes/quarkus-langchain4j-mistralai.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,302 @@

:summaryTableId: quarkus-langchain4j-mistralai
[.configuration-legend]
icon:lock[title=Fixed at build time] Configuration property fixed at build time - All other configuration properties are overridable at runtime
[.configuration-reference.searchable, cols="80,.^10,.^10"]
|===

h|[[quarkus-langchain4j-mistralai_configuration]]link:#quarkus-langchain4j-mistralai_configuration[Configuration property]

h|Type
h|Default

a|icon:lock[title=Fixed at build time] [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-enabled]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-enabled[quarkus.langchain4j.mistralai.chat-model.enabled]`

[.description]
--
Base URL of Mistral API

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_BASE_URL+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_BASE_URL+++`
endif::add-copy-button-to-env-var[]
--|string
|`https://api.mistral.ai/v1/`


a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-api-key]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-api-key[quarkus.langchain4j.mistralai.api-key]`


[.description]
--
Mistral API key

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_API_KEY+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_API_KEY+++`
endif::add-copy-button-to-env-var[]
--|string
|`dummy`

a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-timeout]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-timeout[quarkus.langchain4j.mistralai.timeout]`


[.description]
--
Timeout for Mistral calls

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_TIMEOUT+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_TIMEOUT+++`
endif::add-copy-button-to-env-var[]
--|link:https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html[Duration]
|`10S`


a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-log-requests]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-log-requests[quarkus.langchain4j.mistralai.log-requests]`


[.description]
--
Whether the Mistral client should log requests

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_LOG_REQUESTS+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_LOG_REQUESTS+++`
endif::add-copy-button-to-env-var[]
--|boolean
|`false`


a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-log-responses]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-log-responses[quarkus.langchain4j.mistralai.log-responses]`


[.description]
--
Whether the Mistral client should log responses

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_LOG_RESPONSES+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_LOG_RESPONSES+++`
endif::add-copy-button-to-env-var[]
--|boolean
|`false`


a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-enable-integration]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-enable-integration[quarkus.langchain4j.mistralai.enable-integration]`


[.description]
--
Whether or not to enable the integration. Defaults to `true`, which means requests are made to the Mistral AI provider. Set to `false` to disable all requests.

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_ENABLE_INTEGRATION+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_ENABLE_INTEGRATION+++`
endif::add-copy-button-to-env-var[]
--|boolean
|`true`


a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-model-name]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-model-name[quarkus.langchain4j.mistralai.chat-model.model-name]`


[.description]
--
Model name to use

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_MODEL_NAME+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_MODEL_NAME+++`
endif::add-copy-button-to-env-var[]
--|string
|`mistral-tiny`


a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-temperature]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-temperature[quarkus.langchain4j.mistralai.chat-model.temperature]`


[.description]
--
What sampling temperature to use, between 0.0 and 1.0. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
It is generally recommended to set this or the `top-k` property but not both.

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_TEMPERATURE+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_TEMPERATURE+++`
endif::add-copy-button-to-env-var[]
--|double
|`0.7`


a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-top-p]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-top-p[quarkus.langchain4j.mistralai.chat-model.top-p]`


[.description]
--
Double (0.0-1.0). 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.
It is generally recommended to set this or the `temperature` property but not both.


ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_TOP_P+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_TOP_P+++`
endif::add-copy-button-to-env-var[]
--|double
|`1.0`


a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-max-tokens]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-max-tokens[quarkus.langchain4j.mistralai.chat-model.max-tokens]`


[.description]
--
The maximum number of tokens to generate in the completion.
The token count of your prompt plus `max_tokens` cannot exceed the model's context length

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_MAX_TOKENS+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_MAX_TOKENS+++`
endif::add-copy-button-to-env-var[]
--|int
|


a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-log-requests]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-log-requests[quarkus.langchain4j.mistralai.chat-model.log-requests]`


[.description]
--
Whether chat model requests should be logged

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_LOG_REQUESTS+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_LOG_REQUESTS+++`
endif::add-copy-button-to-env-var[]
--|boolean
|`false`


a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-log-responses]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-log-responses[quarkus.langchain4j.mistralai.chat-model.log-responses]`


[.description]
--
Whether chat model responses should be logged

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_LOG_RESPONSES+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_LOG_RESPONSES+++`
endif::add-copy-button-to-env-var[]
--|boolean
|`false`

a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-safe-prompt]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-safe-prompt[quarkus.langchain4j.mistralai.chat-model.safe-prompt]`


[.description]
--
Whether to inject a safety prompt before all conversations

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_SAFE_PROMPT+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_SAFE_PROMPT+++`
endif::add-copy-button-to-env-var[]
--|boolean
|

a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-random-seed]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-chat-model-random-seed[quarkus.langchain4j.mistralai.chat-model.random-seed]`


[.description]
--
The seed to use for random sampling. If set, different calls will generate deterministic results.

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_RANDOM_SEED+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_CHAT_MODEL_RANDOM_SEED+++`
endif::add-copy-button-to-env-var[]
--|boolean
|


a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-embedding-model-model-name]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-embedding-model-model-name[quarkus.langchain4j.mistralai.embedding-model.model-name]`


[.description]
--
Model name to use

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_EMBEDDING_MODEL_MODEL_NAME+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_EMBEDDING_MODEL_MODEL_NAME+++`
endif::add-copy-button-to-env-var[]
--|string
|`mistral-embed`


a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-embedding-model-log-requests]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-embedding-model-log-requests[quarkus.langchain4j.mistralai.embedding-model.log-requests]`


[.description]
--
Whether embedding model requests should be logged

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_EMBEDDING_MODEL_LOG_REQUESTS+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_EMBEDDING_MODEL_LOG_REQUESTS+++`
endif::add-copy-button-to-env-var[]
--|boolean
|`false`


a| [[quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-embedding-model-log-responses]]`link:#quarkus-langchain4j-mistralai_quarkus-langchain4j-mistralai-embedding-model-log-responses[quarkus.langchain4j.mistralai.embedding-model.log-responses]`


[.description]
--
Whether embedding model responses should be logged

ifdef::add-copy-button-to-env-var[]
Environment variable: env_var_with_copy_button:+++QUARKUS_LANGCHAIN4J_MISTRALAI_EMBEDDING_MODEL_LOG_RESPONSES+++[]
endif::add-copy-button-to-env-var[]
ifndef::add-copy-button-to-env-var[]
Environment variable: `+++QUARKUS_LANGCHAIN4J_MISTRALAI_EMBEDDING_MODEL_LOG_RESPONSES+++`
endif::add-copy-button-to-env-var[]
--|boolean
|`false`

|===
37 changes: 37 additions & 0 deletions docs/modules/ROOT/pages/mistral.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
= Mistral

include::./includes/attributes.adoc[]

https://mistral.ai/[Mistral] is a French company that provide open source LLM models.

== Using Mistral Models

To employ Mistral LLMs, integrate the following dependency into your project:

[source,xml,subs=attributes+]
----
<dependency>
<groupId>io.quarkiverse.langchain4j</groupId>
<artifactId>quarkus-langchain4j-mistral-ai</artifactId>
<version>{project-version}</version>
</dependency>
----

If no other LLM extension is installed, xref:ai-services.adoc[AI Services] will automatically utilize the configured Mistral model.

=== Configuration

Configuring Mistral models mandates an API key, obtainable by creating an account on the https://docs.mistral.ai/platform/overview/[Mistral platform].

The API key can be set in the `application.properties` file:

[source,properties,subs=attributes+]
----
quarkus.langchain4j.mistralai.api-key=...
----

TIP: Alternatively, leverage the `QUARKUS_LANGCHAIN4J_MISTRALAI_API_KEY` environment variable.

Several configuration properties are available:

include::includes/quarkus-langchain4j-mistralai.adoc[leveloffset=+1,opts=optional]

0 comments on commit 390955e

Please sign in to comment.