oai.mistral
Create an OpenAI-compatible client using Mistral.AI’s API.
Example:
llm_config={
-
"config_list"
- [{ -
"api_type"
- “mistral”, -
"model"
- “open-mixtral-8x22b”, -
"api_key"
- os.environ.get(“MISTRAL_API_KEY”) } ]}agent = autogen.AssistantAgent(“my_agent”, llm_config=llm_config)
Install Mistral.AI python library using: pip install —upgrade mistralai
Resources:
-
NOTE
- Requires mistralai package version >= 1.0.1
MistralAIClient
Client for Mistral.AI’s API.
__init__
Requires api_key or environment variable to be set
Arguments:
api_key
str - The API key for using Mistral.AI (or environment variable MISTRAL_API_KEY needs to be set)
message_retrieval
Retrieve the messages from the response.
parse_params
Loads the parameters for Mistral.AI API from the passed in parameters and returns a validated set. Checks types, ranges, and sets defaults
tool_def_to_mistral
Converts AutoGen tool definition to a mistral tool format
calculate_mistral_cost
Calculate the cost of the mistral response.