text: fix NameError — move 'import re as _re' to module top

The loop-guard change added a module-level _GEMMA_CALL_RE = _re.compile(...) at
the top of the file, but 'import re as _re' sat far below (line 2266), so import
crashed with NameError: name '_re' is not defined and every engine failed to
start. Move the import up with the other stdlib imports (removing the late
duplicate). Verified codai.api.text now imports cleanly.
Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RdMufYvtTbtGDWsiZVoXce
parent 3af53d02
......@@ -21,6 +21,7 @@ Text generation endpoints for the codai API.
import asyncio
import json
import logging
import re as _re
import time
import uuid
from typing import AsyncGenerator, Dict, List, Optional
......@@ -2263,7 +2264,6 @@ async def chat_completions(request: ChatCompletionRequest, http_request: Request
finally:
_release_instance()
import re as _re
_TOOL_SPAN_RE = _re.compile(r'<(tool|tool_call)\b[\s\S]*?</\1\s*>', _re.IGNORECASE)
_TOOL_OPEN_RE = _re.compile(r'<(?:tool|tool_call)\b', _re.IGNORECASE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment