-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does dify now support azure openai gpt 4o? #4609
Comments
Yes, Dify version 0.6.8, self-hosted with Docker, supports the Azure OpenAI GPT-4o model. To add the Azure OpenAI GPT-4o model, follow these steps:
This will integrate the Azure OpenAI GPT-4o model into your Dify setup. The model supports various features such as agent thought, vision, multi-tool call, and stream tool call, and allows for customizable parameters like temperature, top_p, presence_penalty, frequency_penalty, and max_tokens. Additionally, you can validate the credentials and invoke the model using the following Python code snippet: import os
from core.model_runtime.model_providers.azure_openai.llm.llm import AzureOpenAILargeLanguageModel
model = AzureOpenAILargeLanguageModel()
# Validate credentials
model.validate_credentials(
model='gpt-4o',
credentials={
'openai_api_base': os.environ.get('AZURE_OPENAI_API_BASE'),
'openai_api_key': os.environ.get('AZURE_OPENAI_API_KEY'),
'base_model_name': 'gpt-4o'
}
)
# Invoke the model
result = model.invoke(
model='gpt-4o',
credentials={
'openai_api_base': os.environ.get('AZURE_OPENAI_API_BASE'),
'openai_api_key': os.environ.get('AZURE_OPENAI_API_KEY'),
'base_model_name': 'gpt-4o'
},
prompt_messages=[
UserPromptMessage(
content='Hello World!'
)
],
model_parameters={
'temperature': 0.0,
'max_tokens': 100
},
stream=False,
user="abc-123"
)
assert isinstance(result, LLMResult)
assert len(result.message.content) > 0 This code snippet demonstrates how to validate the credentials and invoke the Azure OpenAI GPT-4o model within Dify. For more detailed information, you can refer to the Dify documentation and the relevant Dify repository files.
|
d5a33a0 |
Self Checks
Dify version
0.6.8
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
I can not add azure openai gpt 4o model.
✔️ Expected Behavior
No response
❌ Actual Behavior
No response
The text was updated successfully, but these errors were encountered: