- 19 Mar, 2026 4 commits
-
-
Your Name authored
-
Your Name authored
-
Your Name authored
- Create codai/api/state.py for shared global state functions - images.py now imports get_load_mode from state instead of app - app.py re-exports functions from state for backward compatibility
-
Your Name authored
- Move parse_args to codai.cli - Move main() to codai.main - Simplify coderai to be a thin wrapper importing from codai package - Create codai.api module with organized endpoints: - codai/api/app.py: FastAPI app, /v1/models, /v1/files, get_load_mode - codai/api/text.py: /v1/chat/completions, legacy /v1/completions - codai/api/images.py: /v1/images/generations - codai/api/transcriptions.py: /v1/audio/transcriptions - codai/api/tts.py: /v1/audio/speech - coderai is now backward compatible entry point only
-
- 18 Mar, 2026 36 commits
-
-
Your Name authored
- Fixed AttributeError where Tool.get() was called on Pydantic model - Added isinstance() checks to handle both dict and Pydantic Tool formats - This fixes the error when using --force-reasoning with tools
-
Your Name authored
- Added repeat_penalty, presence_penalty, frequency_penalty params to generate() and generate_stream() - Changed from **kwargs to explicit parameters to match base class abstract methods This fixes the TypeError when calling VulkanBackend.generate_stream() with extra params.
-
Your Name authored
- Added missing parameters to generate() and generate_stream() methods - Updated _generate_normal() and _generate_stream_normal() to use these params - Also updated base.py abstract method signatures to match This fixes the TypeError when using repeat_penalty with NVIDIA backend.
-
Your Name authored
New patterns added to repair_broken_tool_calls(): 1. Pattern 4: <tool><function>NAME</function><parameters>XML</parameters></tool> - Converts XML parameters to JSON format - Fills missing required params (e.g., path for list_files) 2. Pattern 0a: <tool><NAME><params></NAME></tool> (with closing tool name tag) - Handles format with closing tag for tool name 3. Expanded guard to detect known tool names used as wrapper tags - Now detects <fetch_instructions>, <list_files>, etc. 4. Fixed closure bug in Pattern -2 (wrong wrapper tags) - Used default argument to capture loop variable correctly 5. Post-processing: Fill missing required parameters - list_files gets path='.' if missing - search_files gets path='.' if missing All 6 test cases pass: - <tool><function>list_files</function><parameters>...</parameters></tool> -> OK - <fetch_instructions><task>read_file</task>...</fetch_instructions> -> OK - <tool_call><list_files></list_files></tool_call> -> OK - <tool><list_files><path>.</path></list_files></tool> -> OK - Valid JSON passthrough -> OK - Missing required params auto-filled -> OK
-
Your Name authored
Added 3 new repair patterns to handle additional hallucinated formats: 1. Pattern -1: Fix <tool_call> wrapper format - Converts <tool_call><list_files></list_files> to proper <tool> wrapper - Handles nested <tool_call><tool>...</tool></tool_call> format 2. Pattern -2: Handle wrong wrapper tags - Fixes when model uses tool name as wrapper: <fetch_instructions>...</fetch_instructions> - Converts to proper JSON format: {"name": "tool_name", "arguments": {...}} - Supports all known tools (read_file, list_files, etc.) 3. Pattern -3: Handle incomplete tool calls with missing parameters - Detects <tool><list_files></list_files> (no parameters) - Provides sensible defaults: list_files gets path='.' and recursive=False - Prevents extraction failures due to missing required parameters These patterns fix the hallucination issues observed in debug.log where the model produces broken XML formats despite --ggg (grammar-guided generation) being enabled. -
Your Name authored
- Added repair_broken_tool_calls() function that handles common hallucinated formats: - <tool><tool_name><param>value</param></tool> (missing closing tag) - <tool><tool_name><param>value</param></tool_name></tool> - Simple format: <tool><list_files><path>.</path><recursive>true</recursive></tool> - Integrated repair into: - QwenParser.parse() - primary parser for Qwen models - ToolCallParser.extract_tool_calls() - fallback parser - ModelParserAdapter.extract_tool_calls() - adapter wrapper The repair converts broken XML format to valid JSON: <tool><list_files><path>.</path><recursive>true</recursive></tool> becomes: <tool>{"name": "list_files", "arguments": {"path": ".", "recursive": true}}</tool> This fixes tool call extraction when the model hallucinates broken XML tags. -
Your Name authored
- Fixed streaming mode pipeline issues: - Fixed n-gram counting to handle partial matches correctly - Added per-chunk filtering to prevent duplicate n-grams across chunks - Optimized regex patterns (~35 patterns pre-compiled): - Pre-compiled all regex patterns for better performance - Added false positive protection with length-based filtering - Optimized tool call parsing in parser.py - Added grammar-guided generation (--ggg / --grammar-guided-gen): - New GBNF grammar file (tool_call_grammar.gbnf) for tool call parsing - Grammar loading utilities in models/grammar.py - Vulkan backend: Added GBNF grammar support via llama_generate_grammar - CUDA backend: Added outlines support for structured output - Added prompt distillation (--tools-closer-prompt): - New CLI option --tools-closer-prompt for prompt distillation - Enables generating distilled tool descriptions for better accuracy
-
Your Name authored
- Add repetition filtering for model output (n-gram detection) - Improve reasoning extraction to exclude tool call content - Add JSON validation for extracted tool calls - Ensure fixes work in both streaming and non-streaming modes
-
Your Name authored
- Add pattern for <tool>{JSON}</tool> format - Handles: <tool>{"name": "web_search", "arguments": {...}}</tool> -
Your Name authored
- Add patterns to handle <arguments><command>...</command></arguments> format - Add patterns to handle <tool_call><tool><name>...<arguments>...nested XML...</arguments></tool></tool_call> - Fix tool call argument extraction for nested XML formats
-
Your Name authored
- Added _parse_multiline_tool_calls() method to handle multi-line tool_call format - Added ToolCallParser fallback to all specific model parsers: - QwenParser, DeepSeekParser, LlamaParser, MistralParser - ClaudeParser, CommandRParser, GemmaParser, GrokParser - PhiParser, ApexBig50Parser - Updated extract_tool_calls() to use both XML and multi-line parsing - Tested and verified tool call extraction works for user's example format
-
Your Name authored
- When second pass result is empty, try extracting tool calls from reasoning text - Add debug message when falling back to reasoning text - This helps when the model generates reasoning but no content in second pass
-
Your Name authored
-
Your Name authored
- Display temperature, top_p, max_tokens, stop, presence_penalty, frequency_penalty, repeat_penalty - Display tool_choice, response_format, user, enable_thinking - Improved messages display with tool_calls and reasoning indicators - Display tools list with function names and descriptions
-
Your Name authored
- Add debug dumps to raw_stream_generate() for LLM response and reasoning text - Add ToolCallParser (ModelParserAdapter) support in streaming path - Extract tool calls from second pass result and yield as tool_calls chunk - Add debug output for extracted tool calls in streaming mode
-
Your Name authored
-
Your Name authored
-
Your Name authored
-
Your Name authored
-
Your Name authored
-
Your Name authored
-
Your Name authored
- Add repeat_penalty=1.15, presence_penalty=1.5, frequency_penalty=0.5 for qwen3 when force_reasoning is enabled - Add system prompt addon: 'Do not repeat tool calls. If a tool fails with an [ERROR], do not retry the exact same parameters' - Add debug output for stop sequences in REASONING MODE DEBUG
-
Your Name authored
-
Your Name authored
- Add pattern for <tool>financial_data_fetcher>{JSON}</tool> - Add pattern for <tool_call><tool>financial_data_fetcher>{JSON}</tool></tool_call> - Added to both coder CLI and ToolCallParser -
Your Name authored
Add Format 3 to parse_tool_calls_from_content: - Parse <tool_call><tool><name>...</name><arguments>JSON</arguments></tool></tool_call> - Also handles incomplete closing tags
-
Your Name authored
- Add --dump argument to CLI - Add dump output for tools schema in both streaming and non-streaming - Add dump output for raw response content - Add dump output for parsed tool calls - Works for both streaming and non-streaming requests
-
Your Name authored
- Add pattern for nested tool_call with multiple tool blocks - Add pattern for tool name as tag (e.g., <list_files>) - Add deduplication to avoid duplicate tool calls - ToolCallParser used as fallback for all model parsers via ModelParserAdapter
-
Your Name authored
- Add pattern for <tool_call><tool><toolname><key>value</key></toolname></tool></tool_call> - Add pattern for standalone nested tool format <tool><toolname><key>value</key></toolname></tool> - Update strip_tool_calls_from_content to remove these formats from content - Tool name is now parsed as the XML tag itself with nested child tags as arguments
-
Your Name authored
- Add local import of json inside raw_stream_generate() nested function - This fixes NameError that occurred when streaming responses
-
Your Name authored
- Removed incorrect 'await' on generate_stream which returns an async generator
-
Your Name authored
- Added pattern for <tool_call><tool><name>...</name><parameters><key>value</key></parameters></tool></tool_call> - Added pattern for standalone <tool><name>...</name><parameters><key>value</key></parameters></tool> - Extracts key-value pairs from nested XML tags inside <parameters>
-
Your Name authored
- Simplified ApexBig50Parser to only keep unique patterns (markdown JSON, react) - Complex XML parsing is now handled by ToolCallParser as the fallback - This eliminates code duplication between the two parsers
-
Your Name authored
- Added pattern for <tool_call><tool><function>...</function><parameters>...</parameters></tool></tool_call> - Added pattern for standalone <tool><function>...</function><parameters>...</parameters></tool> - Added same patterns to ApexBig50Parser
-
Your Name authored
-
Your Name authored
- Added support for <tool_call><tool><name>...</name><arguments>...</arguments></tool></tool_call> format - Added support for multiple tool calls in <tool_call> wrapper - Added same patterns to ApexBig50Parser for direct handling - Added exception handling for formatter.format_full() to prevent TypeError - Added fallback response when formatted_response is None - ToolCallParser now serves as fallback for all specific model parsers
-
Your Name authored
- Added new pattern to parse <tool><action>...</action><parameters>...</parameters></tool> - Handles both JSON and XML-style key-value pairs in parameters - Example: <tool> <action>search</action> <parameters> <query>Apple AAPL Q4 financials Net Income Revenue</query> </parameters> </tool>
-