Find answers from the community

Updated last year

Is there agent for AzureOpenai like we have for Openai ( from llama_index.agent import Ope

At a glance
@kapa.ai Is there agent for AzureOpenai like we have for Openai ( from llama_index.agent import OpenAIAgent ) ?
k
L
A
12 comments
Please stand by @Arunchandra as I search the knowledge base. I normally take about 20 seconds or so. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. The information extracts provided do not mention an agent specifically for AzureOpenAI in the LlamaIndex. The examples and documentation provided only refer to an OpenAIAgent from llama_index.agent.

For more information, you may want to refer to the LlamaIndex documentation ().
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Openai and azure are the same api, both should work with openai agent
chat_engine = OpenAIAgent.from_tools(
tools=agent_tools,
llm=AzureChatOpenAI(deployment_name='gpt-35-turbo',model='gpt-3.5-turbo',

temperature=0,max_tokens=256,

openai_api_key=openai.api_key,openai_api_base=openai.api_base,

openai_api_type=openai.api_type,openai_api_version='2023-05-15',

),
# chat_history=custom_chat_history,
verbose=True,
system_prompt=SYSTEM_MESSAGE.format(curr_date=datetime.utcnow().strftime("%Y-%m-%d")),
callback_manager=service_context.callback_manager,
max_function_calls=3,
)


This is my code snippet
I'm getting this error: ValueError: llm must be a OpenAI instance
from langchain.chat_models import AzureChatOpenAI
i modified
from llama_index.llms import AzureOpenAI


llm=AzureOpenAI(engine='gpt-35-turbo',model='gpt-3.5-turbo',

temperature=0,max_tokens=256,

openai_api_key=openai.api_key,openai_api_base=openai.api_base,

openai_api_type=openai.api_type,openai_api_version='2023-05-15',

)
left with below error:
ValueError: Invalid OpenAI API key.
API key should be of the format: "sk-" followed by 48 alphanumeric characters.
what llama-index version do you have?
I'm using llama-index 0.7.12
Maybe need to bump that version up then 🤔 I know I fixed that at some point.

You can try something like 0.7.23, 0.8.0+ changed a few default settings and prompt templates
tried it but throws this error:

81 if typed_api_type in (util.ApiType.AZURE, util.ApiType.AZURE_AD):
82 if deployment_id is None and engine is None:
---> 83 raise error.InvalidRequestError(
84 "Must provide an 'engine' or 'deployment_id' parameter to create a %s"
85 % cls,
86 "engine",
87 )
88 else:
89 if model is None and engine is None:

InvalidRequestError: Must provide an 'engine' or 'deployment_id' parameter to create a
Oh you are using langchain llm 🤔

Have you tried using this guide for azure?
https://gpt-index.readthedocs.io/en/stable/examples/customization/llms/AzureOpenAI.html
Add a reply
Sign up and join the conversation on Discord