feat: support for providers

This commit is contained in:
Andy Li
2025-07-22 16:09:50 -07:00
committed by GitHub
parent 6252e78e67
commit 9ca1664ed8
53 changed files with 2277 additions and 2190 deletions

View File

@@ -18,7 +18,7 @@ def get_ollama_completion(endpoint, auth_type, auth_key, model, prompt, context_
if model is None:
raise LocalLLMError(
f"Error: model name not specified. Set model in your config to the model you want to run (e.g. 'dolphin2.2-mistral')"
"Error: model name not specified. Set model in your config to the model you want to run (e.g. 'dolphin2.2-mistral')"
)
# Settings for the generation, includes the prompt + stop tokens, max length, etc
@@ -51,7 +51,7 @@ def get_ollama_completion(endpoint, auth_type, auth_key, model, prompt, context_
# Set grammar
if grammar is not None:
# request["grammar_string"] = load_grammar_file(grammar)
raise NotImplementedError(f"Ollama does not support grammars")
raise NotImplementedError("Ollama does not support grammars")
if not endpoint.startswith(("http://", "https://")):
raise ValueError(f"Provided OPENAI_API_BASE value ({endpoint}) must begin with http:// or https://")