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

How to call other APIs #205

Open
laurasss123 opened this issue Feb 7, 2025 · 1 comment
Open

How to call other APIs #205

laurasss123 opened this issue Feb 7, 2025 · 1 comment

Comments

@laurasss123
Copy link

I want to ask because I am not using OpenAI's API, but rather Azure OpenAI's API or other APIs. Is this compatible? How should I configure it?

@laurasss123 laurasss123 changed the title API Call API Feb 7, 2025
@laurasss123 laurasss123 changed the title Call API How to call other APIs Feb 7, 2025
@XeonHis
Copy link
Collaborator

XeonHis commented Feb 7, 2025

Hi,

For Azure OpenAI's API, you can use AzureGPTLLM, the config file looks like below

name: AzureGPTLLM
model_id: gpt-4o # the model id should be same as deployment id in Azure dashboard
api_key: ${env| custom_openai_key, openai_api_key}
endpoint: ${env| custom_openai_endpoint, https://api.openai.com/v1} # should be same as deployment endpoint in Azure dashboard
api_version: ${env| custom_openai_api_version, 2024-02-15-preview} # this is mandatory
temperature: 0
vision: true

Because of the difference between Azure OpenAI's API and OpenAI's API, there may have some issues like incorrect model id or incorrect endpoint. If you encouter these issues, explainations below may help.

OpenaiGPTLLM is set to be compatible with API providers that the request and response are same as OpenAI's request and response. If the request and response format of your custom API provider is compatible with OpenAI, you can use OpenaiGPTLLM directly. Also, if you have mixture API provider of Azure and others, there is a way to convert all those APIs to be compatible with OpenAI, you can refer to new-api, one-api and etc.

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

2 participants