Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/collection/test_classes_generative.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def test_generative_parameters_images_parsing(
(
GenerativeConfig.cohere(
base_url="http://localhost:8080",
frequency_penalty=0.4,
k=5,
max_tokens=100,
model="text-to-image",
Expand All @@ -141,6 +142,7 @@ def test_generative_parameters_images_parsing(
return_metadata=True,
cohere=generative_pb2.GenerativeCohere(
base_url="http://localhost:8080",
frequency_penalty=0.4,
k=5,
max_tokens=100,
model="text-to-image",
Expand Down
5 changes: 5 additions & 0 deletions weaviate/collections/classes/generative.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class _GenerativeCohere(_GenerativeConfigRuntime):
default=GenerativeSearches.COHERE, frozen=True, exclude=True
)
base_url: Optional[AnyHttpUrl]
frequency_penalty: Optional[float]
k: Optional[int]
max_tokens: Optional[int]
model: Optional[str]
Expand All @@ -156,6 +157,7 @@ def _to_grpc(self, opts: _GenerativeConfigRuntimeOptions) -> generative_pb2.Gene
return_metadata=opts.return_metadata,
cohere=generative_pb2.GenerativeCohere(
base_url=_parse_anyhttpurl(self.base_url),
frequency_penalty=self.frequency_penalty,
k=self.k,
max_tokens=self.max_tokens,
model=self.model,
Expand Down Expand Up @@ -711,6 +713,7 @@ def aws_sagemaker(
def cohere(
*,
base_url: Optional[str] = None,
frequency_penalty: Optional[float] = None,
k: Optional[int] = None,
max_tokens: Optional[int] = None,
model: Optional[str] = None,
Expand All @@ -726,6 +729,7 @@ def cohere(

Args:
base_url: The base URL where the API request should go. Defaults to `None`, which uses the server-defined default
frequency_penalty: The frequency penalty to use. Defaults to `None`, which uses the server-defined default
k: The top K property to use. Defaults to `None`, which uses the server-defined default
max_tokens: The maximum number of tokens to generate. Defaults to `None`, which uses the server-defined default
model: The model to use. Defaults to `None`, which uses the server-defined default
Expand All @@ -738,6 +742,7 @@ def cohere(
base_url=TypeAdapter(AnyHttpUrl).validate_python(base_url)
if base_url is not None
else None,
frequency_penalty=frequency_penalty,
k=k,
max_tokens=max_tokens,
model=model,
Expand Down