Skip to content

404 Error from Azure API from version 7.3.0 #531

Closed
@ymtdzzz

Description

@ymtdzzz

Describe the bug
From the version 7.3.0, Faraday::ResourceNotFound: the server responded with status 404 occurs when calling #embeddings method to send a request to Azure.

To Reproduce
Steps to reproduce the behavior:

  1. Configure to use Azure OpenAI
OpenAI.configure do |config|
  config.access_token = ENV.fetch("AZURE_OPENAI_API_ACCESS_TOKEN", "")
  config.uri_base = ENV.fetch("AZURE_OPENAI_API_URI_BASE", "")
  config.api_type = :azure
  config.api_version = ENV.fetch("AZURE_OPENAI_API_VERSION", "")
  config.request_timeout = 60
end
  1. Call #embeddings
> client = OpenAI::Client.new
> client.embeddings(parameters: {model: "text-embedding-3-small", input: "test-input"})
  1. See error
Faraday::ResourceNotFound: the server responded with status 404
from /Users/your-name/.asdf/installs/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/faraday-1.10.4/lib/faraday/response/raise_error.rb:22:in `on_complete'

I have confirmed that it works on the version 7.2.0

Expected behavior
No errors occurred

Screenshots
N/A

Desktop :

  • OS: macOS (Sonoma 14.6.1)
  • Browser: N/A
  • Version: N/A

Possible solution
Maybe the following change might be the cause:

#527

def json_post(path:, parameters:, query_parameters: {})
conn.post(uri(path: path)) do |req|
configure_json_post_request(req, parameters)
req.params = query_parameters
end&.body
end

def uri(path:)
if azure?
base = File.join(@uri_base, path)
"#{base}?api-version=#{@api_version}"

If we use Azure, req.params already has the api_key param. So should we merge query_params instead of overwriting ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions