This commit is contained in:
ishaan-jaff 2023-09-14 09:08:31 -07:00
parent b3403cfe10
commit 541e7f4340

View file

@ -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
)
```