python-sdk icon indicating copy to clipboard operation
python-sdk copied to clipboard

Custom objects result in large input schema blocks

Open strawgate opened this issue 8 months ago • 1 comments

The refs structure of common json schema means the $defs of input objects get defined once per tool .

Perhaps referenced object schemas could be provided separately from the input schema or extracted out? into a common reference?

class KnowledgeBaseUpdateProto(ExportableModel):
    """Model for requesting an update to a Knowledge Base"""

    name: str = kb_name_field
    description: str = kb_description_field

async def update_by_backend_id(self, backend_id: str, knowledge_base_update: KnowledgeBaseUpdateProto) -> None:
    ...
- knowledge_base_update_by_backend_id: Update the metadata of an existing knowledge base by its backend ID.
    Input Schema:
		{
      "type": "object",
      "properties": {
        "backend_id": {
          "title": "Backend Id",
          "type": "string"
        },
        "knowledge_base_update": {
          "$ref": "#/$defs/KnowledgeBaseUpdateProto"
        }
      },
      "$defs": {
        "KnowledgeBaseUpdateProto": {
          "description": "Model for requesting an update to a Knowledge Base",
          "properties": {
            "name": {
              "description": "The name of the knowledge base, used for identification and retrieval.",
              "title": "Name",
              "type": "string"
            },
            "description": {
              "description": "A brief description of the knowledge base, providing context and purpose.",
              "title": "Description",
              "type": "string"
            }
          },
          "required": [
            "name",
            "description"
          ],
          "title": "KnowledgeBaseUpdateProto",
          "type": "object"
        }
      },
      "required": [
        "backend_id",
        "knowledge_base_update"
      ],
      "title": "update_by_backend_idArguments"
    }

strawgate avatar Apr 20 '25 13:04 strawgate

I'm not sure this is actually possible given our schema generation and we likely won't work on this but PRs demonstrating a reduction in output size here are welcome.

felixweinberger avatar Oct 06 '25 18:10 felixweinberger