community[patch]: Add missing annotations (#24890)

This PR adds annotations in comunity package.

Annotations are only strictly needed in subclasses of BaseModel for
pydantic 2 compatibility.

This PR adds some unnecessary annotations, but they're not bad to have
regardless for documentation pages.
This commit is contained in:
Eugene Yurtsev
2024-07-31 14:13:44 -04:00
committed by GitHub
parent 7720483432
commit d24b82357f
44 changed files with 98 additions and 91 deletions

View File

@@ -39,9 +39,9 @@ class MoonshotCommon(BaseModel):
"""Moonshot API key. Get it here: https://platform.moonshot.cn/console/api-keys"""
model_name: str = Field(default="moonshot-v1-8k", alias="model")
"""Model name. Available models listed here: https://platform.moonshot.cn/pricing"""
max_tokens = 1024
max_tokens: int = 1024
"""Maximum number of tokens to generate."""
temperature = 0.3
temperature: float = 0.3
"""Temperature parameter (higher values make the model more creative)."""
class Config:

View File

@@ -244,7 +244,7 @@ class OCIModelDeploymentTGI(OCIModelDeploymentLLM):
"""Watermarking with `A Watermark for Large Language Models <https://arxiv.org/abs/2301.10226>`_.
Defaults to True."""
return_full_text = False
return_full_text: bool = False
"""Whether to prepend the prompt to the generated text. Defaults to False."""
@property

View File

@@ -26,7 +26,7 @@ class Provider(ABC):
class CohereProvider(Provider):
stop_sequence_key = "stop_sequences"
stop_sequence_key: str = "stop_sequences"
def __init__(self) -> None:
from oci.generative_ai_inference import models
@@ -38,7 +38,7 @@ class CohereProvider(Provider):
class MetaProvider(Provider):
stop_sequence_key = "stop"
stop_sequence_key: str = "stop"
def __init__(self) -> None:
from oci.generative_ai_inference import models

View File

@@ -16,7 +16,7 @@ class SVEndpointHandler:
:param str host_url: Base URL of the DaaS API service
"""
API_BASE_PATH = "/api/predict"
API_BASE_PATH: str = "/api/predict"
def __init__(self, host_url: str):
"""

View File

@@ -41,7 +41,7 @@ class SolarCommon(BaseModel):
model_name: str = Field(default="solar-1-mini-chat", alias="model")
"""Model name. Available models listed here: https://console.upstage.ai/services/solar"""
max_tokens: int = Field(default=1024)
temperature = 0.3
temperature: float = 0.3
class Config:
allow_population_by_field_name = True