feat(07-02): singleton OpenAIProvider + GenericOpenAIProvider + MAX_AI_CHARS removal
- openai_provider.py: singleton self._client=AsyncOpenAI(...) in __init__ (D-07),
_truncate() 60/40 smart truncation (D-13), removed MAX_AI_CHARS constant,
changed __init__ signature to include context_chars, removed _client() method
- generic_openai_provider.py: new class, subclasses OpenAIProvider, conditional
response_format={"type":"json_object"} on supports_json_mode flag (D-01/D-02),
imports parse_classification + parse_suggestions from ai.utils (D-02 contract)
- ollama_provider.py: added context_chars kwarg with default 8000, passes through
- lmstudio_provider.py: added context_chars kwarg with default 8000, passes through
- classifier.py: removed MAX_AI_CHARS constant and text[:MAX_AI_CHARS] slices;
truncation now handled inside each provider via _truncate()
- requirements.txt: bumped anthropic floor to >=0.95.0 (D-03 output_config support)
This commit is contained in:
@@ -2,9 +2,15 @@ from ai.openai_provider import OpenAIProvider
|
||||
|
||||
|
||||
class OllamaProvider(OpenAIProvider):
|
||||
def __init__(self, base_url: str = "http://host.docker.internal:11434", model: str = "llama3.2"):
|
||||
def __init__(
|
||||
self,
|
||||
base_url: str = "http://host.docker.internal:11434",
|
||||
model: str = "llama3.2",
|
||||
context_chars: int = 8000,
|
||||
):
|
||||
super().__init__(
|
||||
api_key="ollama",
|
||||
model=model,
|
||||
base_url=base_url.rstrip("/") + "/v1",
|
||||
context_chars=context_chars,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user