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 - Binder Error #118

Open
tmbsundar opened this issue Jan 16, 2025 · 8 comments
Open

Azure OpenAI - Binder Error #118

tmbsundar opened this issue Jan 16, 2025 · 8 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@tmbsundar
Copy link

Hi

I am trying to follow the documentation and trying to set up a Azure OpenAI connection.

DuckDB version: v1.1.3 19864453f7
flockmtl: 0.2.2 (As per yaml descriptor)

and ran a simple Hello World example.

For example, I am trying to create a Secret for a gpt-4o model:

CREATE SECRET azure_s (
          TYPE AZURE,
          API_KEY 'xxxxxx',
          RESOURCE_NAME 'xxxx',
          API_VERSION '2023-05-15'
  );

I get the following error:

Binder Error: Unknown parameter 'resource_name' for secret type 'azure' with default provider 'config'

Trying many variations by removing one argument after another gives the same error.

Is there something which I am missing here?

Also, is there a way to pass the end point URL as in the TYPE OPENAI secret?

Thank you.

@dorbanianas
Copy link
Member

Hi @tmbsundar,

Thank you for your feedback! There's just a small update needed—replace AZURE with AZURE_LLM since AZURE is already referenced by the AZURE extension. The corrected query would look like this:

CREATE SECRET azure_s (
    TYPE AZURE_LLM,
    API_KEY 'xxxxxx',
    RESOURCE_NAME 'xxxx',
    API_VERSION '2023-05-15'
);

Apologies for the confusion! I'll work on updating the documentation and related to the endpoint URL, could you please let me know the exact requirements for the AZURE API or share any setup documentation? That would help me implement the changes quickly. Thanks again!

@queryproc queryproc added the documentation Improvements or additions to documentation label Jan 17, 2025
@tmbsundar
Copy link
Author

tmbsundar commented Jan 17, 2025

Hi @dorbanianas - No problem. Thanks for the update and thanks for the work you are doing!

Our set up is something like this:

Azure OpenAI endpoint: https://openai-dev-eastus2-002.openai.azure.com
Model: gpt-4/ gpt-4o
Deployment Name: gpt-4-32k-dev/ gpt-4o-dev

I was able to create the secret as below with success:

CREATE SECRET azure_s (
           TYPE AZURE_LLM,
           API_KEY 'xxxx',
           RESOURCE_NAME 'openai-dev-eastus2-002',
           API_VERSION '2023-05-15'
);

What is the best way to create a model to call the llm and get the output?

I tried the following:

CREATE MODEL(
      'gpt-4-32k-dev',
      'gpt-4',
      'openai',
      {"context_window": 128000, "max_output_tokens": 32000}
  );

and the following call:

SELECT llm_complete({'model_name': 'gpt-4-32k-dev','secret_name':'azure_s'}, {'prompt': 'say hello world'});

But, I am getting the following error (the API key is fine though and is used in other applications etc.,):

Invalid Error: Error in making request to OpenAI API: {"code":"invalid_api_key","message":"Incorrect API key provided: xxxx********************xxxx. You can find your API key at https://platform.openai.com/account/api-keys.","param":null,"type":"invalid_request_error"}

@queryproc
Copy link
Member

queryproc commented Jan 17, 2025

@tmbsundar When you create the model, you want the provider to also be 'azure' instead of 'openai', which is the third parameter. If this does not pass on your end, the latest PR will fix this. I am pushing out a minor release for a fix here that was just identified and merged.

@queryproc queryproc added the bug Something isn't working label Jan 17, 2025
@tmbsundar
Copy link
Author

@queryproc Thank you. When I changed the provider to 'azure' and re-ran the query, I get the following error:
Invalid Error: Azure curl_easy_perform() failed: Couldn't resolve host name

Can you please just let know if the MODEL and SECRET calls above are in line with the endpoint URL I have provided or do they require to be changed or framed differently?

I'll try the latest PR fix early next week and let you know. Should I be using the latest default install for that or a nightly clone/ build something? Thank you.

@queryproc
Copy link
Member

queryproc commented Jan 17, 2025

That error is fixed through this PR which is not merged with the community extension mechanism. I will message you here once it is updated on the community extension side and you can update your install.

@queryproc
Copy link
Member

queryproc commented Jan 19, 2025

@tmbsundar The bug fix release was merged within the community extensions.

In order to update the extension:

UPDATE EXTENSIONS (flockmtl); --- checks if a newer versions are present (via etag)

If that doesn't work it might be worth updating through a force install:

FORCE INSTALL flockmtl FROM community; --- extension is re-downloaded

@tmbsundar
Copy link
Author

@queryproc Thanks.

I have updated the flockmtl CE version. I am getting the same error though:

Invalid Error: Azure curl_easy_perform() failed: Couldn't resolve host name

@queryproc
Copy link
Member

@tmbsundar Let me look into this. I don't get your error when building from source or using our binaries but I do when I install through CE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants