Harrison/cohere params (#1278)

Co-authored-by: Stefano Faraggi <40745694+stepp1@users.noreply.github.com>
This commit is contained in:
Harrison Chase 2023-02-24 07:37:58 -08:00 committed by GitHub
parent a8e88e1874
commit 7e8f832cd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -25,7 +25,7 @@ class CohereEmbeddings(BaseModel, Embeddings):
model: str = "large" model: str = "large"
"""Model name to use.""" """Model name to use."""
truncate: str = "NONE" truncate: Optional[str] = None
"""Truncate embeddings that are too long from start or end ("NONE"|"START"|"END")""" """Truncate embeddings that are too long from start or end ("NONE"|"START"|"END")"""
cohere_api_key: Optional[str] = None cohere_api_key: Optional[str] = None

View File

@ -47,6 +47,10 @@ class Cohere(LLM, BaseModel):
presence_penalty: int = 0 presence_penalty: int = 0
"""Penalizes repeated tokens.""" """Penalizes repeated tokens."""
truncate: Optional[str] = None
"""Specify how the client handles inputs longer than the maximum token
length: Truncate from START, END or NONE"""
cohere_api_key: Optional[str] = None cohere_api_key: Optional[str] = None
stop: Optional[List[str]] = None stop: Optional[List[str]] = None
@ -83,6 +87,7 @@ class Cohere(LLM, BaseModel):
"p": self.p, "p": self.p,
"frequency_penalty": self.frequency_penalty, "frequency_penalty": self.frequency_penalty,
"presence_penalty": self.presence_penalty, "presence_penalty": self.presence_penalty,
"truncate": self.truncate,
} }
@property @property