Skip to content
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

Azure OpenAI - Functions argument error #91

Closed
avery4man opened this issue Oct 22, 2023 · 9 comments
Closed

Azure OpenAI - Functions argument error #91

avery4man opened this issue Oct 22, 2023 · 9 comments

Comments

@avery4man
Copy link

The variables for Azure OpenAI have been set.
I am now getting the below error:

💭 Bootup sequence complete. Persona activated. Testing messaging functionality.
Hit enter to begin (will request first MemGPT message)
[A[K
Traceback (most recent call last):
File "C:\Users\user\Documents\Projects\MemGPT\main.py", line 339, in
app.run(run)
File "C:\Users\user\AppData\Local\miniconda3\envs\memgpt\lib\site-packages\absl\app.py", line 308, in run
_run_main(main, args)
File "C:\Users\user\AppData\Local\miniconda3\envs\memgpt\lib\site-packages\absl\app.py", line 254, in _run_main
sys.exit(main(argv))
File "C:\Users\user\Documents\Projects\MemGPT\main.py", line 337, in run
loop.run_until_complete(main())
File "C:\Users\user\AppData\Local\miniconda3\envs\memgpt\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "C:\Users\user\Documents\Projects\MemGPT\main.py", line 315, in main
new_messages, heartbeat_request, function_failed, token_warning = await memgpt_agent.step(user_message, first_message=False, skip_verify=FLAGS.no_verify)
File "C:\Users\user\Documents\Projects\MemGPT\memgpt\agent.py", line 545, in step
raise e
File "C:\Users\user\Documents\Projects\MemGPT\memgpt\agent.py", line 483, in step
response = await get_ai_reply_async(model=self.model, message_sequence=input_message_sequence, functions=self.functions)
File "C:\Users\user\Documents\Projects\MemGPT\memgpt\agent.py", line 115, in get_ai_reply_async
raise e
File "C:\Users\user\Documents\Projects\MemGPT\memgpt\agent.py", line 96, in get_ai_reply_async
response = await acreate(
File "C:\Users\user\Documents\Projects\MemGPT\memgpt\openai_tools.py", line 98, in wrapper
raise e
File "C:\Users\user\Documents\Projects\MemGPT\memgpt\openai_tools.py", line 76, in wrapper
return await func(*args, **kwargs)
File "C:\Users\user\Documents\Projects\MemGPT\memgpt\openai_tools.py", line 108, in acompletions_with_backoff
return await openai.ChatCompletion.acreate(**kwargs)
File "C:\Users\user\AppData\Local\miniconda3\envs\memgpt\lib\site-packages\openai\api_resources\chat_completion.py", line 45, in acreate
return await super().acreate(*args, **kwargs)
File "C:\Users\user\AppData\Local\miniconda3\envs\memgpt\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 217, in acreate
response, _, api_key = await requestor.arequest(
File "C:\Users\user\AppData\Local\miniconda3\envs\memgpt\lib\site-packages\openai\api_requestor.py", line 314, in arequest
resp, got_stream = await self._interpret_async_response(result, stream)
File "C:\Users\user\AppData\Local\miniconda3\envs\memgpt\lib\site-packages\openai\api_requestor.py", line 650, in _interpret_async_response
self._interpret_response_line(
File "C:\Users\user\AppData\Local\miniconda3\envs\memgpt\lib\site-packages\openai\api_requestor.py", line 687, in _interpret_response_line
raise self.handle_error_response(
openai.error.InvalidRequestError: Unrecognized request argument supplied: functions

@Rockgecko
Copy link

I got the same error with AZURE_OPENAI_VERSION set to "2023-05-15".
Then found this note in the Azure docs:

Function calling is available in the 2023-07-01-preview API version and works with version 0613 of gpt-35-turbo, gpt-35-turbo-16k, gpt-4, and gpt-4-32k.
(https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/function-calling#using-function-in-the-chat-completions-api)

I tried setting the env variable to "2023-07-01-preview" and now things seem to be working.

@avery4man
Copy link
Author

That did the trick!!!! Thanks for the quick response!

@cpacker
Copy link
Owner

cpacker commented Oct 26, 2023

Should be fixed by #140

@Raffix-14
Copy link

Raffix-14 commented Nov 13, 2023

Hi, i get the same error about the argument functions even by setting the api version to "2023-07-01-preview". Do you know if this is still an issue? I just setted the api version with the AZURE_OPENAI_VERSION enviroment variable. Should I do something on the Azure AI portal to enable function calling or is enough to call the right api version via the endpoint ?

@JeremyTChase
Copy link

Same issue for me

@avery4man
Copy link
Author

@Raffix-14 You have a typo in your API version. The year should be 2023 not 2017. It should look like this "2023-07-01-preview"

@Raffix-14
Copy link

Raffix-14 commented Nov 15, 2023 via email

@Raffix-14
Copy link

I confirm, in the code the version is the right one and i also edited the typo in the original comment. Moreover i see that also other people have the same issue (@JeremyTChase ) so probably there is something more. Only thing I can think of at this point is something in the deployment settings azure side

@JeremyTChase
Copy link

Some more context to my issue;
memgpt configure
? Select LLM inference provider: azure
? Select default model (recommended: gpt-4): gpt-3.5-turbo-16k
? Select embedding provider: local
? Select default preset: memgpt_chat
? Select default persona: sam
? Select default human: cs_phd
? Select storage backend for archival data: local
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\ProgramData\anaconda3\Scripts\memgpt.exe_main
.py", line 7, in
File "C:\ProgramData\anaconda3\Lib\site-packages\typer\main.py", line 328, in call
raise e
File "C:\ProgramData\anaconda3\Lib\site-packages\typer\main.py", line 311, in call
return get_command(self)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\site-packages\click\core.py", line 1128, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\site-packages\typer\core.py", line 778, in main
return _main(
^^^^^^
File "C:\ProgramData\anaconda3\Lib\site-packages\typer\core.py", line 216, in _main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\site-packages\click\core.py", line 1659, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\site-packages\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\site-packages\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\site-packages\typer\main.py", line 683, in wrapper
return callback(**use_params) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\anaconda3\Lib\site-packages\memgpt\cli\cli_config.py", line 249, in configure
raise ValueError(
ValueError: Missing environment variables for Azure (see https://memgpt.readthedocs.io/en/latest/endpoints/#azure). Please set then run memgpt configure again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants