MLflow AI Gateway for LLMs
The MLflow AI Gateway for LLMs is a powerful tool designed to streamline the usage and management of various large language model (LLM) providers, such as OpenAI and Anthropic, within an organization. It offers a high-level interface that simplifies the interaction with these services by providing a unified endpoint to handle specific LLM related requests.
Installation and Setup
Install mlflow
with MLflow GenAI dependencies:
pip install 'mlflow[genai]'
Set the OpenAI API key as an environment variable:
export OPENAI_API_KEY=...
Create a configuration file:
endpoints:
- name: completions
endpoint_type: llm/v1/completions
model:
provider: openai
name: text-davinci-003
config:
openai_api_key: $OPENAI_API_KEY
- name: embeddings
endpoint_type: llm/v1/embeddings
model:
provider: openai
name: text-embedding-ada-002
config:
openai_api_key: $OPENAI_API_KEY
Start the gateway server:
mlflow gateway start --config-path /path/to/config.yaml