ai-forever / ai-forever/langchain-gigachat

Bug: langchain-gigachat strips critical JSON Schema fields, breaking tool calling

Abierto
#55 1 comentario 5 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
50
Forks
13
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### Description
The `_convert_function_to_dict` function (line 302-303) only preserves `type` and `description` from parameter schemas, stripping essential fields like `items` (for arrays) and `additionalProperties` (for objects). This produces invalid schemas that GigaChat API rejects with 422 errors.

### Impact
- Breaks ALL MCP servers with array/object parameters
- Makes langchain-gigachat incompatible with standard OpenAI tool schemas

### Example
**Input schema:**
{
"file_ids": {
"type": "array",
"items": {"type": "string"}
},
"metadata": {
"type": "object",
"additionalProperties": true
}
}**What langchain-gigachat sends to GigaChat:**
{
"file_ids": {"type": "array"}, // ❌ Missing items
"metadata": {"type": "object"} // ❌ Missing additionalProperties
}**GigaChat response:**
- `422: "Type properties.file_ids.items.type is wrong"`
- `422: "Field 'properties.metadata.properties' is missing"`

### Fix
Preserve all JSON Schema fields, not just `type` and `description`.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.