langflow-ai / langflow

Langflow is a low-code app builder for RAG and multi-agent AI applications. It’s Python-based and agnostic to any model, API, or database.
http://www.langflow.org
MIT License
35.56k stars 4.23k forks source link

Azure OpenAI API Version Failing for latest API Versions of 2024 #3860

Open edwinjosechittilappilly opened 2 months ago

edwinjosechittilappilly commented 2 months ago

Bug Description

We are experiencing failures when attempting to use the latest Azure OpenAI API versions released in 2024. Interestingly, the API functions correctly when utilizing any of the preview API versions from 2023.

Reproduction

Create a basic flow with AzureOpenAI component:

  1. Select API Version: Choose any of the 2024 API versions for Azure OpenAI.
  2. Build the component: Perform a standard API request using the selected 2024 version.
  3. Observe Failure: 404 Resource not found.

Expected behavior

The component should have been built successfully.

Reference guide on selecting the API versions:https://stackoverflow.com/questions/76475419/how-can-i-select-the-proper-openai-api-version

Who can help?

No response

Operating System

MacOS

Langflow Version

1.0.18

Python Version

None

Screenshot

No response

Flow File

No response

saurabhmj11 commented 2 months ago

It looks like you're encountering a compatibility issue with the latest Azure OpenAI API versions released in 2024, where API calls result in a 404 Resource not found error. This seems to happen specifically when using the 2024 versions, while earlier versions from 2023 work as expected.

Potential Causes and Troubleshooting Steps: API Version Discrepancy: Azure OpenAI might have made changes to the API endpoints, resource paths, or version naming conventions in the 2024 release. Double-check the following:

Ensure the API version is properly configured in your request. Compare the differences in API documentation between 2023 preview versions and 2024 releases. There might be new resource paths or different structures in the request format. Region-Specific or Availability Issues: Sometimes, new API versions may not be rolled out uniformly across all regions. If the API version is not available in the region you're querying, it could return a 404 error. Try switching to different regions where the 2024 API might be fully operational.

Component Configuration: In Langflow, ensure the AzureOpenAI component is properly configured with the required API version and the correct environment (e.g., endpoint URLs, API keys, etc.). You can also validate these details by calling the API directly through cURL or Postman.

API Key/Access Permissions: There could be changes to the required scopes, permissions, or API key configurations for the 2024 versions. Verify that your API key has the necessary permissions for the 2024 API.

Suggested Steps for Resolution: Check API Documentation: Review the official Azure OpenAI 2024 API documentation to identify any major changes. You can also use the reference guide on selecting API versions here.

Fallback to 2023 Versions: If the 2024 version is not critical, you might want to continue using the 2023 preview versions until the 2024 version becomes stable or fully supported.

Raise a Support Ticket: If the issue persists, consider reaching out to Azure OpenAI support, providing detailed logs, including the API version, region, and error messages.

Langflow Update: Ensure you’re using the latest Langflow version (1.0.18 seems up to date). However, check if any recent updates or patches for API compatibility have been released.

Additional Debugging: You might want to test with lower-level tools like Postman or Python’s requests library to send direct API requests. This will help you isolate whether the issue is specific to Langflow or the Azure OpenAI API itself.

Would you like help writing a direct API test script or checking any specific configurations?

rwb-truelime commented 1 month ago

@saurabhmj11 @edwinjosechittilappilly Running into the exact same problem. Have a look at the Langflow component settings:

image

I don't think this is a user error, I get the same 404. The user gets presented a dropdown list of dates when selecting the api-version but this API version does not exist in Azure OpenAI. There should only be valid and tested dates in the list.

Please have a look at this list of available API versions in Langflow.

It does not match the available API versions in Azure according to the official Microsoft documentation.

rwb-truelime commented 6 days ago

I think this can be closed because of this? https://github.com/langflow-ai/langflow/pull/4232