alessandro9110 commited on
Commit
5a6cb20
·
1 Parent(s): 938ef83

add azure openAI

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool, OpenAIServerModel
2
  import os
3
  import datetime
4
  import requests
@@ -40,17 +40,18 @@ final_answer = FinalAnswerTool()
40
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
41
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
42
 
43
- model = HfApiModel(
44
- max_tokens=2096,
45
- temperature=0.5,
46
- model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
47
- custom_role_conversions=None,
48
- )
49
 
50
- model = OpenAIServerModel(
51
- model_id="deepseek-ai/DeepSeek-R1",
52
- api_base="https://api.together.xyz/v1/", # Leave this blank to query OpenAI servers.
53
- api_key=os.environ["TOGETHER_API_KEY"], # Switch to the API key for the server you're targeting.
 
54
  )
55
 
56
 
 
1
+ from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool, OpenAIServerModel, AzureOpenAIServerModel
2
  import os
3
  import datetime
4
  import requests
 
40
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
41
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
42
 
43
+ #model = HfApiModel(
44
+ #max_tokens=2096,
45
+ #temperature=0.5,
46
+ #model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
47
+ #custom_role_conversions=None,
48
+ #)
49
 
50
+ model = AzureOpenAIServerModel(
51
+ model_id = os.environ.get("AZURE_OPENAI_MODEL"),
52
+ azure_endpoint=os.environ.get("AZURE_OPENAI_ENDPOINT"),
53
+ api_key=os.environ.get("AZURE_OPENAI_API_KEY"),
54
+ api_version=os.environ.get("OPENAI_API_VERSION")
55
  )
56
 
57