Closed robertobalestri closed 1 month ago
Hey @robertobalestri,
The file where the API call to OpenAI is made is located at backend/services/oai_client.py.
Please try following the instructions here: Advanced Usage with Azure OpenAI.
Additionally, you can refer to this related Discord discussion: Discord Link.
For your information, we plan to support the efforts of the Agency-Swarm project to integrate more models and providers in the future. This includes integrating with libraries like the Open Assistant API (see issue #85).
I'm getting crazy in implementing your software, i think i do not have the skills to do it xD I'd ask you something: can you please, in your hosted demo at https://platform.ainhand.com/, add a way to use Azure credentials instead of openai? It shouldn't be difficult: the code just need to call something like this in oai_client:
def get_openai_client( user_variable_manager: UserVariableManager | None = None, api_key: str | None = None ) -> openai.OpenAI: if not api_key: if not user_variable_manager: raise ValueError("Either user_variable_manager or api_key must be provided") api_key = user_variable_manager.get_by_key("AZURE_OPENAI_API_KEY") return instructor.patch(openai.AzureOpenAI( api_key=api_key, api_version=user_variable_manager.get_by_key("OPENAI_API_VERSION"), azure_endpoint= user_variable_manager.get_by_key("AZURE_OPENAI_ENDPOINT"), timeout=5, max_retries=5, ))
and then where you select small and large model names also there should be configurable with user_variable_manager.get_by_key("AZURE_OPENAI_DEPLOYMENT_NAME_SMALL") and user_variable_manager.get_by_key("AZURE_OPENAI_DEPLOYMENT_NAME_LARGE")
@robertobalestri Thank you for the suggestion. I'll have a look today and test the setup.
Hey, do you think it's possible to use Azure API? I can't find the file where the call request to GPT is done. I'd like to try to modify that to call azure instead of Openai. Thanks a lot