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

[BUG] Providing an Azure Search Index as data source together with tools to call functions results in an error #31115

Open
ALHO-JannisHoerster opened this issue Oct 21, 2024 · 1 comment
Assignees
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. data-plane question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@ALHO-JannisHoerster
Copy link

API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-09-01-preview/inference.json

API Spec version

2024-09-01-preview

Describe the bug

Setting parallel_tool_calls = false without additional data sources is working. However pairing an azure search index with tools throws a validation error. Is also the case with 2024-10-01-preview.

Expected behavior

Access to data from the azure search index and the available functions defined in the tools parameter

Actual behavior

response = client.chat.completions.create( openai.BadRequestError: Error code: 400 - {'error': {'requestid': 'd193933e-ea16-4e56-9d62-e1974b01b92c', 'code': 400, 'message': 'Validation error at #/parallel_tool_calls: Extra inputs are not permitted'}}

Reproduction Steps

from openai import AzureOpenAI # 1.51.1
from azure.identity import DefaultAzureCredential, AzureAuthorityHosts, get_bearer_token_provider


client = AzureOpenAI(
    azure_endpoint="###", # your azure endpoint
    api_key="###", # either bearer token provider or api key
    api_version="2024-09-01-preview", 
    )

response = client.chat.completions.create(
                model="gpt-4o",  # your model
                messages=[
                    {"role": 'user', "content": 'Please use a tool'} # message is irrelevant, could also be "hello"
                ],
                stream=False,
                tools=[{
                    'type': 'function', 
                    'function': {
                        'name': 'tool', 
                        'description': "A sample tool.", 
                        'parameters': {
                            'properties': {
                                'input_1': {
                                    'description': 'a list of integers for the tool', 
                                    'items': {'type': 'integer'}, 
                                    'title': 'Ranked text chunk indices', 'type': 'array'
                                    }
                                }, 
                            'required': ['input_1'], 
                            'title': 'Input for `tool`', 
                            'type': 'object'
                            }
                        }
                }],
                tool_choice='auto',
                parallel_tool_calls=False,
                extra_body={
                    "data_sources": [
                        {
                            "type": "azure_search",
                            "parameters": {
                                "endpoint": "###", # your endpoint
                                "index_name": "###", # your index name
                                "authentication": {
                                    "type": "api_key",
                                    "key": "###" # your api key
                                },
                                "in_scope": False
                            }
                        }
                    ]
                }
            )

print(response.model_dump_json(indent=2))

Environment

No response

@ALHO-JannisHoerster ALHO-JannisHoerster added the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Oct 21, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added question The issue doesn't require a change to the product in order to be resolved. Most issues start as that customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Oct 21, 2024
@v-jiaodi
Copy link
Member

@YunsongB Please help take a look, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue requires a change to an existing behavior in the product in order to be resolved. customer-reported Issues that are reported by GitHub users external to the Azure organization. data-plane question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

3 participants