ai-forever / ai-forever/langchain-gigachat

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

Aperta
#55 1 commento 5 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
50
Fork
13
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### 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`.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.