Skip to content

openai.BadRequestError: Error code: 400 - Unrecognized request argument supplied: dataSources. #1354

@DavidHWWang

Description

@DavidHWWang

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

When I use chat.completions.create(), and give extra_body, encounter this error.

I've checked endpoint uri, key, ai search endpoint and key. Nothing wrong.

After I remove extra_body, it worked.

To Reproduce

client = AzureOpenAI(
azure_endpoint="",
api_key="",
azure_deployment="",
api_version="",
)

completion = client.chat.completions.create(
model=deployment,
messages=[
{
"role": "user",
"content": "What are my available health plans?",
},
],
extra_body={
"dataSources": [
{
"type": "AzureCognitiveSearch",
"parameters": {
"endpoint": os.environ["AZURE_AI_SEARCH_ENDPOINT"],
"key": os.environ["AZURE_AI_SEARCH_API_KEY"],
"indexName": os.environ["AZURE_AI_SEARCH_INDEX"]
}
}
]
}
)

Code snippets

No response

OS

windows

Python version

Python 3.11.5

Library version

openai v1.23.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions