-
Notifications
You must be signed in to change notification settings - Fork 25
Graphi 53/improve func spec for tool calls #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Graphi 53/improve func spec for tool calls #87
Conversation
GuanyiLi-Craig
commented
Dec 7, 2025
- Update function spec
- add code string to topic condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request enhances the function specification system for LLM tool calls and improves topic condition serialization. The main changes include a comprehensive rewrite of the type-to-schema conversion logic to support more complex Python types, the addition of human-readable code strings alongside base64-encoded conditions in topic manifests, and updates to the ParameterSchema model to use Pydantic's flexible extra fields configuration.
- Significantly improved type-to-schema conversion supporting Union types, sequences, mappings, dataclasses, enums, and annotated types
- Added code string representation to topic conditions for better debugging and readability
- Updated
FunctionSpecto include optional output schema information
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Version bump to 0.0.32 and addition of new platform-specific greenlet and psycopg2-binary wheels |
| grafi/common/decorators/llm_function.py | Major refactor introducing comprehensive type-to-JSON schema conversion with support for complex types, dataclasses, enums, and proper handling of Optional/Union types |
| grafi/common/models/function_spec.py | Updated ParameterSchema to use flexible extra fields and added output_schema to FunctionSpec |
| grafi/topics/topic_base.py | Enhanced to_dict() to include human-readable source code alongside base64-encoded condition; updated from_dict() to handle both formats for backward compatibility |
| grafi/topics/topic_impl/*.py | Updated all topic implementations to handle both old (string) and new (dict with base64 + code) condition formats during deserialization |
| tests_integration/function_call_assistant/simple_function_call_assistant.py | Refactored to define agent_output_condition at module level and pass it during OutputTopic construction for better code organization |
| tests_integration/function_call_assistant/simple_function_call_assistant_complex_function_example.py | New integration test demonstrating complex function with list and Optional parameters |
| tests_integration/function_call_assistant/complex_function_call_assistant_deserialize_assistant_example.py | New test for assistant deserialization from manifest |
| tests_integration/function_call_assistant/complex_function_manifest.json | New manifest file showing serialized assistant with function specs and topic conditions in new format |
| tests/tools/llm_function_calls/test_function_call_tool.py | Added tests for complex function types, invocation, and deserialization with Pydantic models |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.