File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -182,13 +182,25 @@ ensure the documentation is in the same format above with description, `Paramete
182
182
` Returns: ` , and ` Example\n------- ` . You can find an example use case [ here] ( examples/custom_tools/ ) .
183
183
184
184
### Azure Setup
185
- If you want to use Azure OpenAI models, you can set the environment variable:
185
+ If you want to use Azure OpenAI models, you need to have two OpenAI model deployments:
186
+
187
+ 1 . OpenAI GPT-4o model
188
+ 2 . OpenAI text embedding model
189
+
190
+
191
+ Then you can set the following environment variables:
186
192
187
193
``` bash
188
194
export AZURE_OPENAI_API_KEY=" your-api-key"
189
195
export AZURE_OPENAI_ENDPOINT=" your-endpoint"
196
+ # The deployment name of your OpenAI chat model
197
+ export AZURE_OPENAI_CHAT_MODEL_DEPLOYMENT_NAME=" your_gpt4o_model_deployment_name"
198
+ # The deployment name of your OpenAI text embedding model
199
+ export AZURE_OPENAI_EMBEDDING_MODEL_DEPLOYMENT_NAME=" your_embedding_model_deployment_name"
190
200
```
191
201
202
+ > NOTE: make sure your Azure model deployment have enough quota (token per minute) to support it.
203
+
192
204
You can then run Vision Agent using the Azure OpenAI models:
193
205
194
206
``` python
Original file line number Diff line number Diff line change @@ -233,7 +233,7 @@ def generate_image_qa_tool(self, question: str) -> Callable:
233
233
class AzureOpenAILMM (OpenAILMM ):
234
234
def __init__ (
235
235
self ,
236
- model_name : str = "gpt-4o" ,
236
+ model_name : Optional [ str ] = None ,
237
237
api_key : Optional [str ] = None ,
238
238
api_version : str = "2024-02-01" ,
239
239
azure_endpoint : Optional [str ] = None ,
@@ -245,14 +245,20 @@ def __init__(
245
245
api_key = os .getenv ("AZURE_OPENAI_API_KEY" )
246
246
if not azure_endpoint :
247
247
azure_endpoint = os .getenv ("AZURE_OPENAI_ENDPOINT" )
248
+ if not model_name :
249
+ model_name = os .getenv ("AZURE_OPENAI_CHAT_MODEL_DEPLOYMENT_NAME" )
248
250
249
251
if not api_key :
250
252
raise ValueError ("OpenAI API key is required." )
251
253
if not azure_endpoint :
252
254
raise ValueError ("Azure OpenAI endpoint is required." )
255
+ if not model_name :
256
+ raise ValueError ("Azure OpenAI chat model deployment name is required." )
253
257
254
258
self .client = AzureOpenAI (
255
- api_key = api_key , api_version = api_version , azure_endpoint = azure_endpoint
259
+ api_key = api_key ,
260
+ api_version = api_version ,
261
+ azure_endpoint = azure_endpoint ,
256
262
)
257
263
self .model_name = model_name
258
264
Original file line number Diff line number Diff line change @@ -87,17 +87,23 @@ def __init__(
87
87
api_key : Optional [str ] = None ,
88
88
api_version : str = "2024-02-01" ,
89
89
azure_endpoint : Optional [str ] = None ,
90
- model : str = "text-embedding-3-small" ,
90
+ model : Optional [ str ] = None ,
91
91
) -> None :
92
92
if not api_key :
93
93
api_key = os .getenv ("AZURE_OPENAI_API_KEY" )
94
94
if not azure_endpoint :
95
95
azure_endpoint = os .getenv ("AZURE_OPENAI_ENDPOINT" )
96
+ if not model :
97
+ model = os .getenv ("AZURE_OPENAI_EMBEDDING_MODEL_DEPLOYMENT_NAME" )
96
98
97
99
if not api_key :
98
100
raise ValueError ("Azure OpenAI API key is required." )
99
101
if not azure_endpoint :
100
102
raise ValueError ("Azure OpenAI endpoint is required." )
103
+ if not model :
104
+ raise ValueError (
105
+ "Azure OpenAI embedding model deployment name is required."
106
+ )
101
107
102
108
self .df = df
103
109
self .client = AzureOpenAI (
You can’t perform that action at this time.
0 commit comments