|
7 | 7 | from .model import Anthropic, Endpoints |
8 | 8 |
|
9 | 9 |
|
| 10 | +@registry.llm_models("spacy.Claude-2.v1") |
| 11 | +def anthropic_claude_2( |
| 12 | + config: Dict[Any, Any] = SimpleFrozenDict(), |
| 13 | + name: Literal["claude-2", "claude-2-100k"] = "claude-2", # noqa: F722 |
| 14 | + strict: bool = Anthropic.DEFAULT_STRICT, |
| 15 | + max_tries: int = Anthropic.DEFAULT_MAX_TRIES, |
| 16 | + interval: float = Anthropic.DEFAULT_INTERVAL, |
| 17 | + max_request_time: float = Anthropic.DEFAULT_MAX_REQUEST_TIME, |
| 18 | +) -> Callable[[Iterable[str]], Iterable[str]]: |
| 19 | + """Returns Anthropic instance for 'claude-2' model using REST to prompt API. |
| 20 | + config (Dict[Any, Any]): LLM config arguments passed on to the initialization of the model instance. |
| 21 | + name (Literal["claude-2", "claude-2-100k"]): Model to use. |
| 22 | + strict (bool): If True, ValueError is raised if the LLM API returns a malformed response (i. e. any kind of JSON |
| 23 | + or other response object that does not conform to the expectation of how a well-formed response object from |
| 24 | + this API should look like). If False, the API error responses are returned by __call__(), but no error will |
| 25 | + be raised. |
| 26 | + max_tries (int): Max. number of tries for API request. |
| 27 | + interval (float): Time interval (in seconds) for API retries in seconds. We implement a base 2 exponential backoff |
| 28 | + at each retry. |
| 29 | + max_request_time (float): Max. time (in seconds) to wait for request to terminate before raising an exception. |
| 30 | + RETURNS (Callable[[Iterable[str]], Iterable[str]]]): Anthropic instance for 'claude-1' model using REST to |
| 31 | + prompt API. |
| 32 | + """ |
| 33 | + return Anthropic( |
| 34 | + name=name, |
| 35 | + endpoint=Endpoints.COMPLETIONS, |
| 36 | + config=config, |
| 37 | + strict=strict, |
| 38 | + max_tries=max_tries, |
| 39 | + interval=interval, |
| 40 | + max_request_time=max_request_time, |
| 41 | + ) |
| 42 | + |
| 43 | + |
10 | 44 | @registry.llm_models("spacy.Claude-1.v1") |
11 | 45 | def anthropic_claude_1( |
12 | 46 | config: Dict[Any, Any] = SimpleFrozenDict(), |
|
0 commit comments