Content-Length: 244412 | pFad | http://github.com/Azure/azure-sdk-for-python/issues/41447

98 [openai] 'tools' is incorrectly packed when the tool lacks parameters. · Issue #41447 · Azure/azure-sdk-for-python · GitHub
Skip to content

[openai] 'tools' is incorrectly packed when the tool lacks parameters. #41447

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

Open
xiangyan99 opened this issue Jun 5, 2025 · 2 comments
Open
Labels
Client This issue points to a problem in the data-plane of the library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team OpenAI Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@xiangyan99
Copy link
Member

xiangyan99 commented Jun 5, 2025

  • Package Name: openai
  • Package Version: 1.84.0
  • Operating System: Windows
  • Python Version: 3.12.10

With the code:

from azure.identity import DefaultAzureCredential, get_bearer_token_provider
from openai import AzureOpenAI
from dotenv import load_dotenv
import os
load_dotenv()

# Azure OpenAI configuration
AZURE_OPENAI_ENDPOINT = os.getenv("AZURE_OPENAI_ENDPOINT")
AZURE_OPENAI_MODEL = os.getenv("AZURE_OPENAI_MODEL", "gpt-4o")

token_provider = get_bearer_token_provider(
    DefaultAzureCredential(), "https://cognitiveservices.azure.com/.default"
)

client = AzureOpenAI(
            azure_endpoint=AZURE_OPENAI_ENDPOINT, 
            api_version="2024-04-01-preview", 
            azure_ad_token_provider=token_provider
        )

messages = [{'role': 'user', 'content': 'Hello, how are you?'}]
available_tools = [
    {
        'type': 'function',
        'function': {
            'name': 'azmcp-bestpractices-get',
            'description': 'Returns best practices for secure, production-grade Azure SDK usage. Call this command and follow its guidance before generating or suggesting any Azure SDK code. This command returns the content of the markdown file as a string array.',
            'parameters': {'type': 'object'}
        }
    }
]

response = client.chat.completions.create(
                        model = AZURE_OPENAI_MODEL,
                        messages = messages,
                        tools = available_tools)
response_message = response.choices[0].message
print(response_message)

I see error:

openai.BadRequestError: Error code: 400 - {'error': {'message': "Invalid schema for function 'azmcp-bestpractices-get': In context=(), object schema missing properties.", 'type': 'invalid_request_error', 'param': 'tools[0].function.parameters', 'code': 'invalid_function_parameters'}}

if the tool has parameters, it works fine.

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team OpenAI Service Attention Workflow: This issue is responsible by Azure service team. labels Jun 5, 2025
Copy link

github-actions bot commented Jun 5, 2025

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @trrwilson.

Copy link

github-actions bot commented Jun 5, 2025

Hi @xiangyan99, I'm an AI Support assistant here to help with your issue. While the Azure SDK team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.

  • The error indicates that the function's parameter schema must include defined properties. When no parameters are required, it's necessary to provide an empty "properties" section.
  • You can resolve the error by updating the tool definition to something like:
    • "parameters": { "type": "object", "properties": {} }
  • See the discussion on proper JSON schema setup for tools in the SDK documentation: README.md

The Azure SDK team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team OpenAI Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/Azure/azure-sdk-for-python/issues/41447

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy