diff --git a/spacy_llm/models/langchain/model.py b/spacy_llm/models/langchain/model.py index c940da6a..3a0606c2 100644 --- a/spacy_llm/models/langchain/model.py +++ b/spacy_llm/models/langchain/model.py @@ -172,12 +172,10 @@ def register_models() -> None: @registry.llm_queries("spacy.CallLangChain.v1") -def query_langchain() -> ( - Callable[ - ["langchain_community.llms.BaseLLM", Iterable[Iterable[Any]]], - Iterable[Iterable[Any]], - ] -): +def query_langchain() -> Callable[ + ["langchain_community.llms.BaseLLM", Iterable[Iterable[Any]]], + Iterable[Iterable[Any]], +]: """Returns query Callable for LangChain. RETURNS (Callable[["langchain_community.llms.BaseLLM", Iterable[Iterable[Any]]], Iterable[Iterable[Any]]]): Callable executing simple prompts on the specified LangChain model. diff --git a/spacy_llm/models/rest/__init__.py b/spacy_llm/models/rest/__init__.py index 96263967..cf430bec 100644 --- a/spacy_llm/models/rest/__init__.py +++ b/spacy_llm/models/rest/__init__.py @@ -1,10 +1,11 @@ -from . import anthropic, azure, base, cohere, noop, openai +from . import anthropic, azure, base, cohere, noop, openai, ollama __all__ = [ "anthropic", "azure", "base", "cohere", + "ollama", "openai", "noop", ] diff --git a/spacy_llm/models/rest/ollama/__init__.py b/spacy_llm/models/rest/ollama/__init__.py new file mode 100644 index 00000000..18aa3fc4 --- /dev/null +++ b/spacy_llm/models/rest/ollama/__init__.py @@ -0,0 +1,170 @@ +from .model import Endpoints, Ollama +from .registry import ( + ollama_llama3, + ollama_phi3, + ollama_wizardlm2, + ollama_mistral, + ollama_gemma, + ollama_mixtral, + ollama_llama2, + ollama_codegemma, + ollama_command_r, + ollama_command_r_plus, + ollama_llava, + ollama_dbrx, + ollama_codellama, + ollama_qwen, + ollama_dolphin_mixtral, + ollama_llama2_uncensored, + ollama_mistral_openorca, + ollama_deepseek_coder, + ollama_phi, + ollama_dolphin_mistral, + ollama_nomic_embed_text, + ollama_nous_hermes2, + ollama_orca_mini, + ollama_llama2_chinese, + ollama_zephyr, + ollama_wizard_vicuna_uncensored, + ollama_openhermes, + ollama_vicuna, + ollama_tinyllama, + ollama_tinydolphin, + ollama_openchat, + ollama_starcoder2, + ollama_wizardcoder, + ollama_stable_code, + ollama_starcoder, + ollama_neural_chat, + ollama_yi, + ollama_phind_codellama, + ollama_starling_lm, + ollama_wizard_math, + ollama_falcon, + ollama_dolphin_phi, + ollama_orca2, + ollama_dolphincoder, + ollama_mxbai_embed_large, + ollama_nous_hermes, + ollama_solar, + ollama_bakllava, + ollama_sqlcoder, + ollama_medllama2, + ollama_nous_hermes2_mixtral, + ollama_wizardlm_uncensored, + ollama_dolphin_llama3, + ollama_codeup, + ollama_stablelm2, + ollama_everythinglm, + ollama_all_minilm, + ollama_samantha_mistral, + ollama_yarn_mistral, + ollama_stable_beluga, + ollama_meditron, + ollama_yarn_llama2, + ollama_deepseek_llm, + ollama_llama_pro, + ollama_magicoder, + ollama_stablelm_zephyr, + ollama_codebooga, + ollama_codeqwen, + ollama_mistrallite, + ollama_wizard_vicuna, + ollama_nexusraven, + ollama_xwinlm, + ollama_goliath, + ollama_open_orca_platypus2, + ollama_wizardlm, + ollama_notux, + ollama_megadolphin, + ollama_duckdb_nsql, + ollama_alfred, + ollama_notus, + ollama_snowflake_arctic_embed, +) + +__all__ = [ + "Ollama", + "Endpoints", + "ollama_llama3", + "ollama_phi3", + "ollama_wizardlm2", + "ollama_mistral", + "ollama_gemma", + "ollama_mixtral", + "ollama_llama2", + "ollama_codegemma", + "ollama_command_r", + "ollama_command_r_plus", + "ollama_llava", + "ollama_dbrx", + "ollama_codellama", + "ollama_qwen", + "ollama_dolphin_mixtral", + "ollama_llama2_uncensored", + "ollama_mistral_openorca", + "ollama_deepseek_coder", + "ollama_phi", + "ollama_dolphin_mistral", + "ollama_nomic_embed_text", + "ollama_nous_hermes2", + "ollama_orca_mini", + "ollama_llama2_chinese", + "ollama_zephyr", + "ollama_wizard_vicuna_uncensored", + "ollama_openhermes", + "ollama_vicuna", + "ollama_tinyllama", + "ollama_tinydolphin", + "ollama_openchat", + "ollama_starcoder2", + "ollama_wizardcoder", + "ollama_stable_code", + "ollama_starcoder", + "ollama_neural_chat", + "ollama_yi", + "ollama_phind_codellama", + "ollama_starling_lm", + "ollama_wizard_math", + "ollama_falcon", + "ollama_dolphin_phi", + "ollama_orca2", + "ollama_dolphincoder", + "ollama_mxbai_embed_large", + "ollama_nous_hermes", + "ollama_solar", + "ollama_bakllava", + "ollama_sqlcoder", + "ollama_medllama2", + "ollama_nous_hermes2_mixtral", + "ollama_wizardlm_uncensored", + "ollama_dolphin_llama3", + "ollama_codeup", + "ollama_stablelm2", + "ollama_everythinglm", + "ollama_all_minilm", + "ollama_samantha_mistral", + "ollama_yarn_mistral", + "ollama_stable_beluga", + "ollama_meditron", + "ollama_yarn_llama2", + "ollama_deepseek_llm", + "ollama_llama_pro", + "ollama_magicoder", + "ollama_stablelm_zephyr", + "ollama_codebooga", + "ollama_codeqwen", + "ollama_mistrallite", + "ollama_wizard_vicuna", + "ollama_nexusraven", + "ollama_xwinlm", + "ollama_goliath", + "ollama_open_orca_platypus2", + "ollama_wizardlm", + "ollama_notux", + "ollama_megadolphin", + "ollama_duckdb_nsql", + "ollama_alfred", + "ollama_notus", + "ollama_snowflake_arctic_embed", +] diff --git a/spacy_llm/models/rest/ollama/model.py b/spacy_llm/models/rest/ollama/model.py new file mode 100644 index 00000000..06e19813 --- /dev/null +++ b/spacy_llm/models/rest/ollama/model.py @@ -0,0 +1,170 @@ +from enum import Enum +from typing import Any, Dict, Iterable, List, Sized + +import requests # type: ignore[import] +from requests import HTTPError + +from ..base import REST + + +class Endpoints(str, Enum): + GENERATE = "http://localhost:11434/api/generate" + EMBEDDINGS = "http://localhost:11434/api/embeddings" + TAGS = "http://localhost:11434/api/tags" + + +class Ollama(REST): + @property + def credentials(self) -> Dict[str, str]: + # No credentials needed for local Ollama server + return {} + + def _verify_auth(self) -> None: + # Healthcheck: Verify connectivity to Ollama server + try: + r = requests.get(Endpoints.TAGS.value, timeout=5) + r.raise_for_status() + except (requests.exceptions.RequestException, HTTPError) as ex: + raise ValueError( + "Failed to connect to the Ollama server. Please ensure that the server is up and running." + ) from ex + + def __call__(self, prompts: Iterable[Iterable[str]]) -> Iterable[Iterable[str]]: + headers = { + "Content-Type": "application/json", + } + all_api_responses: List[List[str]] = [] + + for prompts_for_doc in prompts: + api_responses: List[str] = [] + prompts_for_doc = list(prompts_for_doc) + + def _request(json_data: Dict[str, Any]) -> Dict[str, Any]: + r = self.retry( + call_method=requests.post, + url=self._endpoint, + headers=headers, + json={ + **json_data, + **self._config, + "model": self._name, + "stream": False, + }, + timeout=self._max_request_time, + ) + try: + r.raise_for_status() + except HTTPError as ex: + res_content = r.text + # Include specific error message in exception. + raise ValueError( + f"Request to Ollama API failed: {res_content}" + ) from ex + + response = r.json() + + if "error" in response: + if self._strict: + raise ValueError(f"API call failed: {response['error']}.") + else: + assert isinstance(prompts_for_doc, Sized) + return {"error": [response["error"]] * len(prompts_for_doc)} + + return response + + for prompt in prompts_for_doc: + responses = _request({"prompt": prompt}) + if "error" in responses: + return responses["error"] + + api_responses.append(responses["response"]) + + all_api_responses.append(api_responses) + + return all_api_responses + + @staticmethod + def _get_context_lengths() -> Dict[str, int]: + return { + "llama3": 4096, + "phi3": 4096, + "wizardlm2": 4096, + "mistral": 4096, + "gemma": 4096, + "mixtral": 47000, + "llama2": 4096, + "codegemma": 4096, + "command-r": 35000, + "command-r-plus": 35000, + "llava": 4096, + "dbrx": 4096, + "codellama": 4096, + "qwen": 4096, + "dolphin-mixtral": 47000, + "llama2-uncensored": 4096, + "mistral-openorca": 4096, + "deepseek-coder": 4096, + "phi": 4096, + "dolphin-mistral": 47000, + "nomic-embed-text": 4096, + "nous-hermes2": 4096, + "orca-mini": 4096, + "llama2-chinese": 4096, + "zephyr": 4096, + "wizard-vicuna-uncensored": 4096, + "openhermes": 4096, + "vicuna": 4096, + "tinyllama": 4096, + "tinydolphin": 4096, + "openchat": 4096, + "starcoder2": 4096, + "wizardcoder": 4096, + "stable-code": 4096, + "starcoder": 4096, + "neural-chat": 4096, + "yi": 4096, + "phind-codellama": 4096, + "starling-lm": 4096, + "wizard-math": 4096, + "falcon": 4096, + "dolphin-phi": 4096, + "orca2": 4096, + "dolphincoder": 4096, + "mxbai-embed-large": 4096, + "nous-hermes": 4096, + "solar": 4096, + "bakllava": 4096, + "sqlcoder": 4096, + "medllama2": 4096, + "nous-hermes2-mixtral": 47000, + "wizardlm-uncensored": 4096, + "dolphin-llama3": 4096, + "codeup": 4096, + "stablelm2": 4096, + "everythinglm": 16384, + "all-minilm": 4096, + "samantha-mistral": 4096, + "yarn-mistral": 128000, + "stable-beluga": 4096, + "meditron": 4096, + "yarn-llama2": 128000, + "deepseek-llm": 4096, + "llama-pro": 4096, + "magicoder": 4096, + "stablelm-zephyr": 4096, + "codebooga": 4096, + "codeqwen": 4096, + "mistrallite": 8192, + "wizard-vicuna": 4096, + "nexusraven": 4096, + "xwinlm": 4096, + "goliath": 4096, + "open-orca-platypus2": 4096, + "wizardlm": 4096, + "notux": 4096, + "megadolphin": 4096, + "duckdb-nsql": 4096, + "alfred": 4096, + "notus": 4096, + "snowflake-arctic-embed": 4096, + } diff --git a/spacy_llm/models/rest/ollama/registry.py b/spacy_llm/models/rest/ollama/registry.py new file mode 100644 index 00000000..2c52da66 --- /dev/null +++ b/spacy_llm/models/rest/ollama/registry.py @@ -0,0 +1,1869 @@ +from typing import Any, Dict + +from confection import SimpleFrozenDict + +from ....registry import registry +from .model import Endpoints, Ollama + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_llama3( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "llama3", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'llama3' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_phi3( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "phi3", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'phi3' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_wizardlm2( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "wizardlm2", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'wizardlm2' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_mistral( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "mistral", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'mistral' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_gemma( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "gemma", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'gemma' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_mixtral( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "mixtral", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 47000, +) -> Ollama: + """Returns Ollama instance for 'mixtral' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_llama2( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "llama2", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'llama2' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_codegemma( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "codegemma", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'codegemma' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_command_r( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "command-r", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 35000, +) -> Ollama: + """Returns Ollama instance for 'command-r' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_command_r_plus( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "command-r-plus", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 35000, +) -> Ollama: + """Returns Ollama instance for 'command-r-plus' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_llava( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "llava", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'llava' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_dbrx( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "dbrx", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'dbrx' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_codellama( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "codellama", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'codellama' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_qwen( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "qwen", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'qwen' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_dolphin_mixtral( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "dolphin-mixtral", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 47000, +) -> Ollama: + """Returns Ollama instance for 'dolphin-mixtral' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_llama2_uncensored( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "llama2-uncensored", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'llama2-uncensored' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_mistral_openorca( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "mistral-openorca", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'mistral-openorca' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_deepseek_coder( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "deepseek-coder", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'deepseek-coder' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_phi( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "phi", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'phi' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_dolphin_mistral( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "dolphin-mistral", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 47000, +) -> Ollama: + """Returns Ollama instance for 'dolphin-mistral' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_nomic_embed_text( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "nomic-embed-text", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'nomic-embed-text' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_nous_hermes2( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "nous-hermes2", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'nous-hermes2' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_orca_mini( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "orca-mini", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'orca-mini' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_llama2_chinese( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "llama2-chinese", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'llama2-chinese' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_zephyr( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "zephyr", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'zephyr' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_wizard_vicuna_uncensored( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "wizard-vicuna-uncensored", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'wizard-vicuna-uncensored' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_openhermes( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "openhermes", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'openhermes' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_vicuna( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "vicuna", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'vicuna' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_tinyllama( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "tinyllama", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'tinyllama' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_tinydolphin( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "tinydolphin", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'tinydolphin' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_openchat( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "openchat", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'openchat' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_starcoder2( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "starcoder2", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'starcoder2' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_wizardcoder( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "wizardcoder", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'wizardcoder' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_stable_code( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "stable-code", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'stable-code' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_starcoder( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "starcoder", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'starcoder' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_neural_chat( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "neural-chat", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'neural-chat' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_yi( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "yi", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'yi' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_phind_codellama( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "phind-codellama", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'phind-codellama' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_starling_lm( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "starling-lm", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'starling-lm' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_wizard_math( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "wizard-math", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'wizard-math' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_falcon( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "falcon", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'falcon' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_dolphin_phi( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "dolphin-phi", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'dolphin-phi' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_orca2( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "orca2", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'orca2' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_dolphincoder( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "dolphincoder", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'dolphincoder' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_mxbai_embed_large( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "mxbai-embed-large", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'mxbai-embed-large' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_nous_hermes( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "nous-hermes", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'nous-hermes' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_solar( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "solar", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'solar' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_bakllava( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "bakllava", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'bakllava' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_sqlcoder( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "sqlcoder", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'sqlcoder' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_medllama2( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "medllama2", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'medllama2' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_nous_hermes2_mixtral( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "nous-hermes2-mixtral", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 47000, +) -> Ollama: + """Returns Ollama instance for 'nous-hermes2-mixtral' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_wizardlm_uncensored( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "wizardlm-uncensored", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'wizardlm-uncensored' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_dolphin_llama3( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "dolphin-llama3", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'dolphin-llama3' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_codeup( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "codeup", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'codeup' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_stablelm2( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "stablelm2", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'stablelm2' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_everythinglm( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "everythinglm", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 16384, +) -> Ollama: + """Returns Ollama instance for 'everythinglm' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_all_minilm( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "all-minilm", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'all-minilm' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_samantha_mistral( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "samantha-mistral", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'samantha-mistral' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_yarn_mistral( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "yarn-mistral", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 128000, +) -> Ollama: + """Returns Ollama instance for 'yarn-mistral' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_stable_beluga( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "stable-beluga", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'stable-beluga' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_meditron( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "meditron", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'meditron' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_yarn_llama2( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "yarn-llama2", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 128000, +) -> Ollama: + """Returns Ollama instance for 'yarn-llama2' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_deepseek_llm( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "deepseek-llm", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'deepseek-llm' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_llama_pro( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "llama-pro", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'llama-pro' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_magicoder( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "magicoder", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'magicoder' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_stablelm_zephyr( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "stablelm-zephyr", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'stablelm-zephyr' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_codebooga( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "codebooga", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'codebooga' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_codeqwen( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "codeqwen", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'codeqwen' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_mistrallite( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "mistrallite", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 8192, +) -> Ollama: + """Returns Ollama instance for 'mistrallite' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_wizard_vicuna( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "wizard-vicuna", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'wizard-vicuna' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_nexusraven( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "nexusraven", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'nexusraven' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_xwinlm( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "xwinlm", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'xwinlm' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_goliath( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "goliath", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'goliath' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_open_orca_platypus2( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "open-orca-platypus2", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'open-orca-platypus2' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_wizardlm( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "wizardlm", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'wizardlm' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_notux( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "notux", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'notux' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_megadolphin( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "megadolphin", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'megadolphin' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_duckdb_nsql( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "duckdb-nsql", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'duckdb-nsql' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_alfred( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "alfred", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'alfred' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_notus( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "notus", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'notus' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) + + +@registry.llm_models("spacy.Ollama.v1") +def ollama_snowflake_arctic_embed( + config: Dict[Any, Any] = SimpleFrozenDict(), + name: str = "snowflake-arctic-embed", + strict: bool = Ollama.DEFAULT_STRICT, + max_tries: int = Ollama.DEFAULT_MAX_TRIES, + interval: float = Ollama.DEFAULT_INTERVAL, + max_request_time: float = Ollama.DEFAULT_MAX_REQUEST_TIME, + context_length: int = 4096, +) -> Ollama: + """Returns Ollama instance for 'snowflake-arctic-embed' model.""" + return Ollama( + name=name, + endpoint=Endpoints.GENERATE.value, + config=config, + strict=strict, + max_tries=max_tries, + interval=interval, + max_request_time=max_request_time, + context_length=context_length, + ) diff --git a/spacy_llm/models/rest/openai/registry.py b/spacy_llm/models/rest/openai/registry.py index 767c9d39..472a1c70 100644 --- a/spacy_llm/models/rest/openai/registry.py +++ b/spacy_llm/models/rest/openai/registry.py @@ -186,9 +186,12 @@ def openai_gpt_3_5_v3( """ return OpenAI( name=name, - endpoint=endpoint or Endpoints.CHAT.value - # gpt-3.5-turbo-instruct runs on the non-chat endpoint, so we use that one by default to allow batching. - if name != "gpt-3.5-turbo-instruct" else Endpoints.NON_CHAT.value, + endpoint=( + endpoint or Endpoints.CHAT.value + # gpt-3.5-turbo-instruct runs on the non-chat endpoint, so we use that one by default to allow batching. + if name != "gpt-3.5-turbo-instruct" + else Endpoints.NON_CHAT.value + ), config=config, strict=strict, max_tries=max_tries, @@ -226,9 +229,12 @@ def openai_gpt_3_5_v2( """ return OpenAI( name=name, - endpoint=endpoint or Endpoints.CHAT.value - # gpt-3.5-turbo-instruct runs on the non-chat endpoint, so we use that one by default to allow batching. - if name != "gpt-3.5-turbo-instruct" else Endpoints.NON_CHAT.value, + endpoint=( + endpoint or Endpoints.CHAT.value + # gpt-3.5-turbo-instruct runs on the non-chat endpoint, so we use that one by default to allow batching. + if name != "gpt-3.5-turbo-instruct" + else Endpoints.NON_CHAT.value + ), config=config, strict=strict, max_tries=max_tries, @@ -266,9 +272,12 @@ def openai_gpt_3_5( """ return OpenAI( name=name, - endpoint=endpoint or Endpoints.CHAT.value - # gpt-3.5-turbo-instruct runs on the non-chat endpoint, so we use that one by default to allow batching. - if name != "gpt-3.5-turbo-instruct" else Endpoints.NON_CHAT.value, + endpoint=( + endpoint or Endpoints.CHAT.value + # gpt-3.5-turbo-instruct runs on the non-chat endpoint, so we use that one by default to allow batching. + if name != "gpt-3.5-turbo-instruct" + else Endpoints.NON_CHAT.value + ), config=config, strict=strict, max_tries=max_tries, diff --git a/spacy_llm/models/rest/palm/model.py b/spacy_llm/models/rest/palm/model.py index b1a2657d..3bed215f 100644 --- a/spacy_llm/models/rest/palm/model.py +++ b/spacy_llm/models/rest/palm/model.py @@ -95,9 +95,11 @@ def _request(json_data: Dict[str, Any]) -> Dict[str, Any]: responses = [ _request( { - "prompt": {"text": prompt} - if not uses_chat - else {"messages": [{"content": prompt}]} + "prompt": ( + {"text": prompt} + if not uses_chat + else {"messages": [{"content": prompt}]} + ) } ) for prompt in prompts_for_doc diff --git a/spacy_llm/models/rest/palm/registry.py b/spacy_llm/models/rest/palm/registry.py index 506e6d4b..7a6985f5 100644 --- a/spacy_llm/models/rest/palm/registry.py +++ b/spacy_llm/models/rest/palm/registry.py @@ -76,9 +76,9 @@ def palm_bison_v2( """ return PaLM( name=name, - endpoint=Endpoints.TEXT.value - if name in {"text-bison-001"} - else Endpoints.MSG.value, + endpoint=( + Endpoints.TEXT.value if name in {"text-bison-001"} else Endpoints.MSG.value + ), config=config, strict=strict, max_tries=max_tries,