Skip to content

Conversation

@GuanyiLi-Craig
Copy link
Contributor

  1. Update function spec
  2. add code string to topic condition

Copilot AI review requested due to automatic review settings December 7, 2025 22:07
Copy link
Contributor

Copilot AI left a 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 FunctionSpec to 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.

@GuanyiLi-Craig GuanyiLi-Craig merged commit fbba20b into main Dec 21, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants