mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
(docs) azure openai
This commit is contained in:
parent
27c3a9b39a
commit
160e0e092a
1 changed files with 14 additions and 11 deletions
|
|
@ -1,20 +1,20 @@
|
|||
# Azure
|
||||
LiteLLM supports Azure Chat + Embedding calls.
|
||||
|
||||
### API KEYS
|
||||
# Azure OpenAI
|
||||
## API KEYS
|
||||
```python
|
||||
import os
|
||||
|
||||
os.environ["AZURE_API_KEY"] = ""
|
||||
os.environ["AZURE_API_BASE"] = ""
|
||||
os.environ["AZURE_API_VERSION"] = ""
|
||||
```
|
||||
|
||||
## Usage
|
||||
<a target="_blank" href="https://colab.research.google.com/github/BerriAI/litellm/blob/main/cookbook/LiteLLM_Azure_OpenAI.ipynb">
|
||||
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
|
||||
</a>
|
||||
|
||||
### Azure OpenAI Chat Completion Models
|
||||
### Completion - using .env variables
|
||||
|
||||
```python
|
||||
|
||||
from litellm import completion
|
||||
|
||||
## set ENV variables
|
||||
|
|
@ -22,16 +22,19 @@ os.environ["AZURE_API_KEY"] = ""
|
|||
os.environ["AZURE_API_BASE"] = ""
|
||||
os.environ["AZURE_API_VERSION"] = ""
|
||||
|
||||
messages = [{ "content": "Hello, how are you?","role": "user"}]
|
||||
|
||||
# azure call
|
||||
response = completion("azure/<your_deployment_name>", messages)
|
||||
response = completion(
|
||||
model = "azure/<your_deployment_name>",
|
||||
messages = [{ "content": "Hello, how are you?","role": "user"}]
|
||||
)
|
||||
```
|
||||
|
||||
### Set API Key, API Base, API Version in Completion()
|
||||
### Completion - using api_key, api_base, api_version
|
||||
|
||||
```python
|
||||
import litellm
|
||||
|
||||
# azure call
|
||||
response = litellm.completion(
|
||||
model = "azure/<your deployment name>", # model = azure/<your deployment name>
|
||||
api_base = "", # azure api base
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue