forked from phoenix/litellm-mirror
docs
This commit is contained in:
parent
b3403cfe10
commit
541e7f4340
1 changed files with 32 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
# Call Azure OpenAI, OpenAI Using LiteLLM
|
||||
|
||||
### Usage
|
||||
## Basic Completion()
|
||||
```python
|
||||
import os
|
||||
from litellm import completion
|
||||
|
@ -28,3 +28,34 @@ response = completion(
|
|||
)
|
||||
|
||||
```
|
||||
|
||||
## Completion() with Streaming
|
||||
```python
|
||||
import os
|
||||
from litellm import completion
|
||||
|
||||
# openai configs
|
||||
os.environ["OPENAI_API_KEY"] = ""
|
||||
|
||||
# azure openai configs
|
||||
os.environ["AZURE_API_KEY"] = ""
|
||||
os.environ["AZURE_API_BASE"] = "https://openai-gpt-4-test-v-1.openai.azure.com/"
|
||||
os.environ["AZURE_API_VERSION"] = "2023-05-15"
|
||||
|
||||
|
||||
|
||||
# openai call
|
||||
response = completion(
|
||||
model = "gpt-3.5-turbo",
|
||||
messages= = [{ "content": "Hello, how are you?","role": "user"}],
|
||||
stream=True
|
||||
)
|
||||
|
||||
# azure call
|
||||
response = completion(
|
||||
model = "azure/<your-azure-deployment>",
|
||||
messages = [{ "content": "Hello, how are you?","role": "user"}],
|
||||
stream=True
|
||||
)
|
||||
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue