You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit addresses comments regarding the
OpenAI chat completion implementation in the meta_reference provider.
Tool Augmentation
- Add `augment_raw_messages_for_tools()` to properly inject tool definitions into prompts
- Support model-family-specific tool formats:
* Llama 3.1/3.2 multimodal: JsonCustomToolGenerator with JSON format
* Llama 3.2/3.3/4: PythonListCustomToolGenerator with Python list format
- Handle tool_choice hints (auto/required/specific tool)
- Preserve existing system messages while adding tool context
Streaming & Tool Call Detection
- Implement streaming support via `params.stream` with `_stream_chat_completion()`
- Add tool call detection by decoding assistant messages after generation
- Set proper `finish_reason` based on content ("stop" vs "tool_calls")
- Convert internal ToolCall format to OpenAI-compatible types
- Stream chunks incrementally with proper delta formatting
**Type Corrections**
- Fix response_format handling in generators.py to properly extract schema from
OpenAIJSONSchema TypedDict and use correct ResponseFormatType enum
- Use correct OpenAI types: OpenAIChatCompletionToolCall, OpenAIChunkChoice,
OpenAIChoiceDelta, OpenAIChatCompletionToolCallFunction
Signed-off-by: Charlie Doern <[email protected]>
0 commit comments