Skip to content

Invalid request content: Invalid function schema #45

@MarcoAntonioli

Description

@MarcoAntonioli

Title: Invalid request content: Invalid function schema
Affected package/module: langchain-oci/chat_models/oci_generative_ai.py::convert_to_oci_tool
Setup: Grok-3 model with is_stream=True, Langchain React Agent, tools called by Agent
Error:
oci.exceptions.ServiceError'>({'target_service': 'generative_ai_inference', 'status': 400, 'code': '400', 'opc-request-id': '352F40FD80134D21B9551564FD8A87E7/94FABDD8C1F3D3C4191148C9F6484E8A/C669AEA6076109213B0FDC6D047D8F04', 'message': '{"code":"Client specified an invalid argument","error":"Invalid request content: Invalid function schema."}', 'operation_name': 'chat', 'timestamp': '2025-10-15T20:05:19.668307+00:00', 'client_version': 'Oracle-PythonSDK/2.161.0', 'request_endpoint': 'POST https://inference.generativeai.us-ashburn-1.oci.oraclecloud.com/20231130/actions/chat', 'logging_tips': 'To get more info on the failing request, refer to https://docs.oracle.com/en-us/iaas/tools/python/latest/logging.html for ways to log the request/response details.', 'troubleshooting_tips': "See https://docs.oracle.com/iaas/Content/API/References/apierrors.htm#apierrors_400__400_400 for more information about resolving this error. Also see https://docs.oracle.com/iaas/api/#/en/generative-ai-inference/20231130/ChatResult/Chat for details on this operation's requirements. If you are unable to resolve this generative_ai_inference issue, please contact Oracle support and provide them this full error message."}

Root Cause:
'any' not being a valid json schema

Fix:
In line 817 use "type": p_def.get("type", "string"), instead of "type": p_def.get("type", "any"),
Verified locally and with @jbrown9513

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions