-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Description:
When processing an episode (e.g., "Amélioration avancée du script main.py"), the Graphiti MCP server encounters a 400 Bad Request error from OpenAI due to an invalid schema for response_format 'EntityAttributes'. The error message is: "Invalid schema for response_format 'EntityAttributes': In context=('properties', 'parameter_schema', 'anyOf', '0'), 'additionalProperties' is required to be supplied and to be false."
Steps to Reproduce:
- Initialize a project with
graphiti init test-projet. - Add an episode via Cursor (e.g., "améliore main.py encore").
- Check logs:
docker logs mcp-test-projet. - Observe the error around 19:42:54-55 on 2025-08-05.
Logs:
2025-08-05 19:42:55,277 - main - ERROR - [BG Task - test-projet] Unexpected Error processing episode 'Amélioration avancée du script main.py': Error code: 400 - {'error': {'message': "Invalid schema for response_format 'EntityAttributes': In context=('properties', 'parameter_schema', 'anyOf', '0'), 'additionalProperties' is required to be supplied and to be false.", 'type': 'invalid_request_error', 'param': 'response_format', 'code': None}}
Traceback (most recent call last):
File "/app/graphiti_mcp_server.py", line 419, in process_episode
await client.add_episode(
File "/usr/local/lib/python3.11/site-packages/graphiti_core/graphiti.py", line 490, in add_episode
raise e
...
File "/usr/local/lib/python3.11/site-packages/graphiti_core/llm_client/openai_client.py", line 139, in _generate_response
response = await self.client.beta.chat.completions.parse(
Expected Behavior:
The episode should be processed successfully, with entities extracted and persisted in Neo4j, without schema validation errors.
Actual Behavior:
Processing fails with a 400 error, and the episode remains queued. Subsequent 429 Too Many Requests errors occur due to retries.
Environment:
- Docker container: mcp-test-projet (image: mcp-graphiti-mcp-test-projet)
- Neo4j: 5.26.0
- Python: 3.11
- Graphiti version: latest (no releases, master branch)
- OpenAI API: Active with key
Suggested Fix:
The EntityAttributes model (dynamically created in node_operations.py, line 357 with pydantic.create_model) should include class Config: additionalProperties = False to comply with OpenAI's JSON schema requirements. A static definition or schema validation in openai_client.py (line 139) could also resolve this.
Additional Notes:
Attempts to override in graphiti_mcp_server.py were considered, but the issue persists due to the dynamic nature of the schema. The problem is reproducible with any episode addition triggering entity extraction.