diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 766a49e55..7bec13a05 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -18,7 +18,7 @@ env: WEAVIATE_124: 1.24.26 WEAVIATE_125: 1.25.24 WEAVIATE_126: 1.26.8 - WEAVIATE_127: stable-v1.27-372397e + WEAVIATE_127: 1.27.1-8030027 jobs: lint-and-format: diff --git a/integration/test_collection_openai.py b/integration/test_collection_openai.py index f53ae5567..78c598567 100644 --- a/integration/test_collection_openai.py +++ b/integration/test_collection_openai.py @@ -12,6 +12,7 @@ Property, ) from weaviate.collections.classes.data import DataObject +from weaviate.collections.classes.generative import GenerativeProvider from weaviate.collections.classes.grpc import GroupBy, Rerank from weaviate.exceptions import WeaviateQueryError, WeaviateUnsupportedFeatureError from weaviate.util import _ServerVersion @@ -340,8 +341,6 @@ def test_near_object_generate_with_everything(openai_collection: OpenAICollectio assert res.generated == "apples cats" assert res.objects[0].generated is not None assert res.objects[1].generated is not None - assert res.objects[0].generated.lower() == "yes" - assert res.objects[1].generated.lower() == "no" def test_near_object_generate_and_group_by_with_everything( @@ -355,7 +354,7 @@ def test_near_object_generate_and_group_by_with_everything( [ DataObject( properties={ - "text": "apples are big. you cna eat apples", + "text": "apples are big. you can eat apples", "content": "Teddy is the biggest and bigger than everything else", } ), @@ -380,8 +379,6 @@ def test_near_object_generate_and_group_by_with_everything( groups = list(res.groups.values()) assert groups[0].generated is not None assert groups[1].generated is not None - assert groups[0].generated.lower() == "no" - assert groups[1].generated.lower() == "yes" def test_near_text_generate_with_everything(openai_collection: OpenAICollection) -> None: @@ -644,3 +641,38 @@ def test_queries_with_rerank_and_generative(collection_factory: CollectionFactor ][ 0 ].metadata.rerank_score + + +def test_near_text_generate_with_dynamic_rag(openai_collection: OpenAICollection) -> None: + collection = openai_collection( + vectorizer_config=Configure.Vectorizer.text2vec_openai(vectorize_collection_name=False), + ) + + collection.data.insert_many( + [ + DataObject( + properties={ + "text": "melons are big", + "content": "Teddy is the biggest and bigger than everything else. Teddy is not a fruit", + } + ), + DataObject( + properties={ + "text": "cats are small. You cannot eat cats. Cats are not fruit", + "content": "bananas are the smallest and smaller than everything else", + } + ), + ] + ) + + res = collection.generate.near_text( + query="small fruit", + single_prompt="Is there something to eat in {text} of the given object? Only answer yes if there is something to eat and no if not. Dont use punctuation", + grouped_task="Write out the fruit in alphabetical order. Only write the names separated by a space", + generative_provider=GenerativeProvider.openai( + temperature=0.1, + ), + ) + assert res.generated == "bananas melons" + assert res.objects[0].generated is not None + assert res.objects[1].generated is not None diff --git a/weaviate/classes/query.py b/weaviate/classes/query.py index e48ef20cb..6b015d03d 100644 --- a/weaviate/classes/query.py +++ b/weaviate/classes/query.py @@ -1,5 +1,6 @@ from weaviate.collections.classes.aggregate import Metrics from weaviate.collections.classes.filters import Filter +from weaviate.collections.classes.generative import GenerativeProvider from weaviate.collections.classes.grpc import ( HybridFusion, GroupBy, @@ -18,6 +19,7 @@ __all__ = [ "Filter", "GeoCoordinate", + "GenerativeProvider", "GroupBy", "HybridFusion", "HybridVector", diff --git a/weaviate/collections/classes/generative.py b/weaviate/collections/classes/generative.py new file mode 100644 index 000000000..4d0d185c0 --- /dev/null +++ b/weaviate/collections/classes/generative.py @@ -0,0 +1,724 @@ +from typing import List, Optional, Union + +from pydantic import AnyHttpUrl, BaseModel, Field + +from weaviate.collections.classes.config import ( + GenerativeSearches, + _EnumLikeStr, + AWSService, + CohereModel, +) +from weaviate.proto.v1.base_pb2 import TextArray +from weaviate.proto.v1.generative_pb2 import ( + GenerativeAnthropic, + GenerativeAnyscale, + GenerativeAWS, + GenerativeCohere, + GenerativeDatabricks, + GenerativeFriendliAI, + GenerativeGoogle, + GenerativeMistral, + GenerativeOllama, + GenerativeOpenAI, + GenerativeProvider as GenerativeProviderGRPC, +) + + +class _GenerativeProviderDynamic(BaseModel): + generative: Union[GenerativeSearches, _EnumLikeStr] + + def to_grpc(self) -> GenerativeProviderGRPC: + raise NotImplementedError("This method must be implemented in the child class") + + def _parse_anyhttpurl(self, url: Optional[AnyHttpUrl]) -> Optional[str]: + return str(url) if url is not None else None + + def _parse_liststr(self, values: Optional[List[str]]) -> Optional[TextArray]: + return TextArray(values=values) if values is not None else None + + +class _GenerativeAnthropic(_GenerativeProviderDynamic): + generative: Union[GenerativeSearches, _EnumLikeStr] = Field( + default=GenerativeSearches.ANTHROPIC, frozen=True, exclude=True + ) + base_url: Optional[AnyHttpUrl] + max_tokens: Optional[int] + model: Optional[str] + temperature: Optional[float] + top_k: Optional[int] + top_p: Optional[float] + stop_sequences: Optional[List[str]] + + def to_grpc(self) -> GenerativeProviderGRPC: + return GenerativeProviderGRPC( + anthropic=GenerativeAnthropic( + base_url=self._parse_anyhttpurl(self.base_url), + max_tokens=self.max_tokens, + model=self.model, + temperature=self.temperature, + top_k=self.top_k, + top_p=self.top_p, + stop_sequences=self._parse_liststr(self.stop_sequences), + ) + ) + + +class _GenerativeAnyscale(_GenerativeProviderDynamic): + generative: Union[GenerativeSearches, _EnumLikeStr] = Field( + default=GenerativeSearches.ANYSCALE, frozen=True, exclude=True + ) + base_url: Optional[AnyHttpUrl] + model: Optional[str] + temperature: Optional[float] + + def to_grpc(self) -> GenerativeProviderGRPC: + return GenerativeProviderGRPC( + anyscale=GenerativeAnyscale( + base_url=self._parse_anyhttpurl(self.base_url), + model=self.model, + temperature=self.temperature, + ) + ) + + +class _GenerativeAWS(_GenerativeProviderDynamic): + generative: Union[GenerativeSearches, _EnumLikeStr] = Field( + default=GenerativeSearches.AWS, frozen=True, exclude=True + ) + model: Optional[str] + region: Optional[str] + endpoint: Optional[AnyHttpUrl] + service: Optional[str] + target_model: Optional[str] + target_variant: Optional[str] + temperature: Optional[float] + + def to_grpc(self) -> GenerativeProviderGRPC: + return GenerativeProviderGRPC( + aws=GenerativeAWS( + model=self.model, + region=self.region, + endpoint=self._parse_anyhttpurl(self.endpoint), + service=self.service, + target_model=self.target_model, + target_variant=self.target_variant, + temperature=self.temperature, + ) + ) + + +class _GenerativeCohere(_GenerativeProviderDynamic): + generative: Union[GenerativeSearches, _EnumLikeStr] = Field( + default=GenerativeSearches.COHERE, frozen=True, exclude=True + ) + base_url: Optional[AnyHttpUrl] + k: Optional[int] + max_tokens: Optional[int] + model: Optional[str] + p: Optional[float] + presence_penalty: Optional[float] + stop_sequences: Optional[List[str]] + temperature: Optional[float] + + def to_grpc(self) -> GenerativeProviderGRPC: + return GenerativeProviderGRPC( + cohere=GenerativeCohere( + base_url=self._parse_anyhttpurl(self.base_url), + k=self.k, + max_tokens=self.max_tokens, + model=self.model, + p=self.p, + presence_penalty=self.presence_penalty, + stop_sequences=self._parse_liststr(self.stop_sequences), + temperature=self.temperature, + ) + ) + + +class _GenerativeDatabricks(_GenerativeProviderDynamic): + generative: Union[GenerativeSearches, _EnumLikeStr] = Field( + default=GenerativeSearches.DATABRICKS, frozen=True, exclude=True + ) + endpoint: str + frequency_penalty: Optional[float] + log_probs: Optional[bool] + max_tokens: Optional[int] + model: Optional[str] + n: Optional[int] + presence_penalty: Optional[float] + stop: Optional[List[str]] + temperature: Optional[float] + top_log_probs: Optional[int] + top_p: Optional[float] + + def to_grpc(self) -> GenerativeProviderGRPC: + return GenerativeProviderGRPC( + databricks=GenerativeDatabricks( + endpoint=self.endpoint, + frequency_penalty=self.frequency_penalty, + log_probs=self.log_probs or False, + max_tokens=self.max_tokens, + model=self.model, + n=self.n, + presence_penalty=self.presence_penalty, + stop=self._parse_liststr(self.stop), + temperature=self.temperature, + top_log_probs=self.top_log_probs, + top_p=self.top_p, + ) + ) + + +class _GenerativeFriendliai(_GenerativeProviderDynamic): + generative: Union[GenerativeSearches, _EnumLikeStr] = Field( + default=GenerativeSearches.FRIENDLIAI, frozen=True, exclude=True + ) + base_url: Optional[str] + max_tokens: Optional[int] + model: Optional[str] + n: Optional[int] + temperature: Optional[float] + top_p: Optional[float] + + def to_grpc(self) -> GenerativeProviderGRPC: + return GenerativeProviderGRPC( + friendliai=GenerativeFriendliAI( + base_url=self.base_url, + max_tokens=self.max_tokens, + model=self.model, + n=self.n, + temperature=self.temperature, + top_p=self.top_p, + ) + ) + + +class _GenerativeMistral(_GenerativeProviderDynamic): + generative: Union[GenerativeSearches, _EnumLikeStr] = Field( + default=GenerativeSearches.MISTRAL, frozen=True, exclude=True + ) + base_url: Optional[AnyHttpUrl] + max_tokens: Optional[int] + model: Optional[str] + temperature: Optional[float] + top_p: Optional[float] + + def to_grpc(self) -> GenerativeProviderGRPC: + return GenerativeProviderGRPC( + mistral=GenerativeMistral( + base_url=self._parse_anyhttpurl(self.base_url), + max_tokens=self.max_tokens, + model=self.model, + temperature=self.temperature, + top_p=self.top_p, + ) + ) + + +class _GenerativeOllama(_GenerativeProviderDynamic): + generative: Union[GenerativeSearches, _EnumLikeStr] = Field( + default=GenerativeSearches.OLLAMA, frozen=True, exclude=True + ) + api_endpoint: Optional[AnyHttpUrl] + model: Optional[str] + temperature: Optional[float] + + def to_grpc(self) -> GenerativeProviderGRPC: + return GenerativeProviderGRPC( + ollama=GenerativeOllama( + api_endpoint=self._parse_anyhttpurl(self.api_endpoint), + model=self.model, + temperature=self.temperature, + ) + ) + + +class _GenerativeOpenAI(_GenerativeProviderDynamic): + generative: Union[GenerativeSearches, _EnumLikeStr] = Field( + default=GenerativeSearches.OPENAI, frozen=True, exclude=True + ) + api_version: Optional[str] + base_url: Optional[AnyHttpUrl] + deployment_id: Optional[str] + frequency_penalty: Optional[float] + is_azure: bool + max_tokens: Optional[int] + model: Optional[str] + presence_penalty: Optional[float] + resource_name: Optional[str] + stop: Optional[List[str]] + temperature: Optional[float] + top_p: Optional[float] + + def to_grpc(self) -> GenerativeProviderGRPC: + return GenerativeProviderGRPC( + openai=GenerativeOpenAI( + api_version=self.api_version, + base_url=self._parse_anyhttpurl(self.base_url), + deployment_id=self.deployment_id, + frequency_penalty=self.frequency_penalty, + max_tokens=self.max_tokens, + model=self.model, + presence_penalty=self.presence_penalty, + resource_name=self.resource_name, + stop=self._parse_liststr(self.stop), + temperature=self.temperature, + top_p=self.top_p, + is_azure=self.is_azure, + ) + ) + + +class _GenerativeGoogle(_GenerativeProviderDynamic): + generative: Union[GenerativeSearches, _EnumLikeStr] = Field( + default=GenerativeSearches.PALM, frozen=True, exclude=True + ) + api_endpoint: Optional[AnyHttpUrl] + endpoint_id: Optional[str] + frequency_penalty: Optional[float] + max_tokens: Optional[int] + model: Optional[str] + presence_penalty: Optional[float] + project_id: Optional[str] + region: Optional[str] + stop_sequences: Optional[List[str]] + temperature: Optional[float] + top_k: Optional[int] + top_p: Optional[float] + + def _parse_api_endpoint(self, url: Optional[AnyHttpUrl]) -> Optional[str]: + return ( + u.replace("https://", "").replace("http://", "") + if (u := self._parse_anyhttpurl(url)) is not None + else None + ) + + def to_grpc(self) -> GenerativeProviderGRPC: + return GenerativeProviderGRPC( + google=GenerativeGoogle( + api_endpoint=self._parse_api_endpoint(self.api_endpoint), + endpoint_id=self.endpoint_id, + frequency_penalty=self.frequency_penalty, + max_tokens=self.max_tokens, + model=self.model, + presence_penalty=self.presence_penalty, + project_id=self.project_id, + region=self.region, + stop_sequences=self._parse_liststr(self.stop_sequences), + temperature=self.temperature, + top_k=self.top_k, + top_p=self.top_p, + ) + ) + + +class GenerativeProvider: + """Use this factory class to create the correct object for the `generative_provider` argument in the search methods of the `.generate` namespace. + + Each staticmethod provides options specific to the named generative search module in the function's name. Under-the-hood data validation steps + will ensure that any mis-specifications will be caught before the request is sent to Weaviate. + """ + + @staticmethod + def anthropic( + *, + base_url: Optional[AnyHttpUrl] = None, + model: Optional[str] = None, + max_tokens: Optional[int] = None, + stop_sequences: Optional[List[str]] = None, + temperature: Optional[float] = None, + top_k: Optional[int] = None, + top_p: Optional[float] = None, + ) -> _GenerativeProviderDynamic: + """ + Create a `_GenerativeAnthropic` object for use when performing dynamic AI generation using the `generative-anthropic` module. + + Arguments: + `model` + The model 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 + `stop_sequences` + The stop sequences to use. Defaults to `None`, which uses the server-defined default + `temperature` + The temperature to use. Defaults to `None`, which uses the server-defined default + `top_k` + The top K to use. Defaults to `None`, which uses the server-defined default + `top_p` + The top P to use. Defaults to `None`, which uses the server-defined default + """ + return _GenerativeAnthropic( + base_url=base_url, + model=model, + max_tokens=max_tokens, + stop_sequences=stop_sequences, + temperature=temperature, + top_k=top_k, + top_p=top_p, + ) + + @staticmethod + def anyscale( + *, + base_url: Optional[AnyHttpUrl] = None, + model: Optional[str] = None, + temperature: Optional[float] = None, + ) -> _GenerativeProviderDynamic: + """Create a `_GenerativeAnyscale` object for use when performing dynamic AI generation using the `generative-anyscale` module. + + Arguments: + `base_url` + The base URL to send the API request to. Defaults to `None`, which uses the server-defined default + `model` + The model to use. Defaults to `None`, which uses the server-defined default + `temperature` + The temperature to use. Defaults to `None`, which uses the server-defined default + """ + return _GenerativeAnyscale(base_url=base_url, model=model, temperature=temperature) + + @staticmethod + def aws( + *, + endpoint: Optional[AnyHttpUrl] = None, + model: Optional[str] = None, + region: Optional[str] = None, + service: Optional[Union[AWSService, str]] = None, + target_model: Optional[str] = None, + target_variant: Optional[str] = None, + temperature: Optional[float] = None, + ) -> _GenerativeProviderDynamic: + """Create a `_GenerativeAWS` object for use when performing dynamic AI generation using the `generative-aws` module. + + See the [documentation](https://weaviate.io/developers/weaviate/modules/reader-generator-modules/generative-aws) + for detailed usage. + + Arguments: + `model` + The model to use. Defaults to `None`, which uses the server-defined default + `region` + The AWS region to run the model from. Defaults to `None`, which uses the server-defined default + `endpoint` + The endpoint to use when requesting the generation. Defaults to `None`, which uses the server-defined default + `service` + The AWS service to use. Defaults to `None`, which uses the server-defined default + TODO: add docs for these new params + """ + return _GenerativeAWS( + model=model, + region=region, + service=service, + endpoint=endpoint, + target_model=target_model, + target_variant=target_variant, + temperature=temperature, + ) + + @staticmethod + def cohere( + *, + base_url: Optional[AnyHttpUrl] = None, + k: Optional[int] = None, + max_tokens: Optional[int] = None, + model: Optional[Union[CohereModel, str]] = None, + p: Optional[float] = None, + presence_penalty: Optional[float] = None, + stop_sequences: Optional[List[str]] = None, + temperature: Optional[float] = None, + ) -> _GenerativeProviderDynamic: + """Create a `_GenerativeCohere` object for use when performing AI generation using the `generative-cohere` module. + + See the [documentation](https://weaviate.io/developers/weaviate/modules/reader-generator-modules/generative-cohere) + for detailed usage. + + Arguments: + `base_url` + The base URL where the API request should go. 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 + `p` + The top P property to use. Defaults to `None`, which uses the server-defined default + `presence_penalty` + The presence penalty to use. Defaults to `None`, which uses the server-defined default + `stop_sequences` + The stop sequences to use. Defaults to `None`, which uses the server-defined default + `temperature` + The temperature to use. Defaults to `None`, which uses the server-defined default + """ + return _GenerativeCohere( + base_url=base_url, + k=k, + max_tokens=max_tokens, + model=model, + p=p, + presence_penalty=presence_penalty, + stop_sequences=stop_sequences, + temperature=temperature, + ) + + @staticmethod + def databricks( + *, + endpoint: str, + frequency_penalty: Optional[float] = None, + log_probs: Optional[bool] = None, + max_tokens: Optional[int] = None, + model: Optional[str] = None, + n: Optional[int] = None, + presence_penalty: Optional[float] = None, + stop: Optional[List[str]] = None, + temperature: Optional[float] = None, + top_log_probs: Optional[int] = None, + top_p: Optional[float] = None, + ) -> _GenerativeProviderDynamic: + """Create a `_GenerativeDatabricks` object for use when performing AI generation using the `generative-databricks` module. + + Arguments: + `endpoint` + The 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 + `log_probs` + Whether to log probabilities. 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 + `n` + The number of sequences to generate. Defaults to `None`, which uses the server-defined default + `stop` + The stop sequences to use. Defaults to `None`, which uses the server-defined default + `temperature` + The temperature to use. Defaults to `None`, which uses the server-defined default + `top_log_probs` + The top log probabilities to use. Defaults to `None`, which uses the server-defined default + `top_p` + The top P value to use. Defaults to `None`, which uses the server-defined default + """ + return _GenerativeDatabricks( + endpoint=endpoint, + frequency_penalty=frequency_penalty, + log_probs=log_probs, + max_tokens=max_tokens, + model=model, + n=n, + presence_penalty=presence_penalty, + stop=stop, + temperature=temperature, + top_log_probs=top_log_probs, + top_p=top_p, + ) + + @staticmethod + def friendliai( + *, + base_url: Optional[str] = None, + max_tokens: Optional[int] = None, + model: Optional[str] = None, + n: Optional[int] = None, + temperature: Optional[float] = None, + top_p: Optional[float] = None, + ) -> _GenerativeProviderDynamic: + """ + Create a `_GenerativeFriendliai` object for use when performing AI generation using the `generative-friendliai` module. + + Arguments: + `base_url` + The base URL where the API request should go. 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 + `n` + The number of sequences to generate. Defaults to `None`, which uses the server-defined default + `temperature` + The temperature to use. Defaults to `None`, which uses the server-defined default + `top_p` + The top P value to use. Defaults to `None`, which uses the server-defined default + """ + return _GenerativeFriendliai( + base_url=base_url, + max_tokens=max_tokens, + model=model, + n=n, + temperature=temperature, + top_p=top_p, + ) + + @staticmethod + def google( + *, + api_endpoint: Optional[AnyHttpUrl] = None, + endpoint_id: Optional[str] = None, + frequency_penalty: Optional[float] = None, + max_tokens: Optional[int] = None, + model: Optional[str] = None, + presence_penalty: Optional[float] = None, + project_id: Optional[str] = None, + region: Optional[str] = None, + stop_sequences: Optional[List[str]] = None, + temperature: Optional[float] = None, + top_k: Optional[int] = None, + top_p: Optional[float] = None, + ) -> _GenerativeProviderDynamic: + """Create a `_GenerativeGoogle` object for use when performing AI generation using the `generative-google` module. + + See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/generative) + for detailed usage. + + Arguments: + `api_endpoint` + The API endpoint to use. Defaults to `None`, which uses the server-defined default + `endpoint_id` + The endpoint ID to use. 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 + `max_tokens` + The maximum number of tokens to generate. Defaults to `None`, which uses the server-defined default + `model` + The model ID to use. Defaults to `None`, which uses the server-defined default + `presence_penalty` + The presence penalty to use. Defaults to `None`, which uses the server-defined default + `project_id` + The project ID to use. Defaults to `None`, which uses the server-defined default + `region` + The region to use. Defaults to `None`, which uses the server-defined default + `stop_sequences` + The stop sequences to use. Defaults to `None`, which uses the server-defined default + `temperature` + The temperature to use. Defaults to `None`, which uses the server-defined default + `top_k` + The top K to use. Defaults to `None`, which uses the server-defined default + `top_p` + The top P to use. Defaults to `None`, which uses the server-defined default + """ + return _GenerativeGoogle( + api_endpoint=api_endpoint, + endpoint_id=endpoint_id, + frequency_penalty=frequency_penalty, + max_tokens=max_tokens, + model=model, + presence_penalty=presence_penalty, + project_id=project_id, + region=region, + stop_sequences=stop_sequences, + temperature=temperature, + top_k=top_k, + top_p=top_p, + ) + + @staticmethod + def mistral( + *, + base_url: Optional[AnyHttpUrl] = None, + max_tokens: Optional[int] = None, + model: Optional[str] = None, + temperature: Optional[float] = None, + top_p: Optional[float] = None, + ) -> _GenerativeProviderDynamic: + """Create a `_GenerativeMistral` object for use when performing AI generation using the `generative-mistral` module. + + Arguments: + `base_url` + The base URL where the API request should go. 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 + `temperature` + The temperature to use. Defaults to `None`, which uses the server-defined default + `top_p` + The top P value to use. Defaults to `None`, which uses the server-defined default + """ + return _GenerativeMistral( + base_url=base_url, + max_tokens=max_tokens, + model=model, + temperature=temperature, + top_p=top_p, + ) + + @staticmethod + def ollama( + *, + api_endpoint: Optional[AnyHttpUrl] = None, + model: Optional[str] = None, + temperature: Optional[float] = None, + ) -> _GenerativeProviderDynamic: + """ + Create a `_GenerativeOllama` object for use when performing AI generation using the `generative-ollama` module. + + Arguments: + `api_endpoint` + The API endpoint to use. Defaults to `None`, which uses the server-defined default + Docker users may need to specify an alias, such as `http://host.docker.internal:11434` so that the container can access the host machine. + `model` + The model to use. Defaults to `None`, which uses the server-defined default + `temperature` + The temperature to use. Defaults to `None`, which uses the server-defined default + """ + return _GenerativeOllama(api_endpoint=api_endpoint, model=model, temperature=temperature) + + @staticmethod + def openai( + *, + api_version: Optional[str] = None, + base_url: Optional[AnyHttpUrl] = None, + deployment_id: Optional[str] = None, + frequency_penalty: Optional[float] = None, + max_tokens: Optional[int] = None, + model: Optional[str] = None, + presence_penalty: Optional[float] = None, + resource_name: Optional[str] = None, + stop: Optional[List[str]] = None, + temperature: Optional[float] = None, + top_p: Optional[float] = None, + is_azure: Optional[bool] = False, + ) -> _GenerativeProviderDynamic: + """Create a `_GenerativeOpenAI` object for use when performing AI generation using the `generative-openai` module. + + See the [documentation](https://weaviate.io/developers/weaviate/modules/reader-generator-modules/generative-openai) + for detailed usage. + + Arguments: + `api_version` + The API version to use. Defaults to `None`, which uses the server-defined default + `base_url` + The base URL where the API request should go. Defaults to `None`, which uses the server-defined default + `deployment_id` + The deployment ID to use. 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 + `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 + `presence_penalty` + The presence penalty to use. Defaults to `None`, which uses the server-defined default + `resource_name` + The name of the OpenAI resource to use. Defaults to `None`, which uses the server-defined default + `stop` + The stop sequences to use. Defaults to `None`, which uses the server-defined default + `temperature` + The temperature to use. Defaults to `None`, which uses the server-defined default + `top_p` + The top P to use. Defaults to `None`, which uses the server-defined default + + """ + return _GenerativeOpenAI( + api_version=api_version, + base_url=base_url, + deployment_id=deployment_id, + frequency_penalty=frequency_penalty, + max_tokens=max_tokens, + model=model, + presence_penalty=presence_penalty, + resource_name=resource_name, + stop=stop, + temperature=temperature, + top_p=top_p, + is_azure=is_azure or False, + ) diff --git a/weaviate/collections/classes/internal.py b/weaviate/collections/classes/internal.py index d1e343a7f..d474db963 100644 --- a/weaviate/collections/classes/internal.py +++ b/weaviate/collections/classes/internal.py @@ -23,6 +23,7 @@ else: from typing import Annotated, get_type_hints, get_origin, get_args +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import ( QueryNested, _QueryReference, @@ -47,10 +48,10 @@ _WeaviateInput, ) from weaviate.exceptions import WeaviateInvalidInputError -from weaviate.util import _to_beacons +from weaviate.util import _to_beacons, _ServerVersion from weaviate.types import INCLUDE_VECTOR, UUID, UUIDS -from weaviate.proto.v1 import search_get_pb2, generative_pb2 +from weaviate.proto.v1 import base_pb2, search_get_pb2, generative_pb2 @dataclass @@ -197,23 +198,63 @@ class _Generative: single: Optional[str] grouped: Optional[str] grouped_properties: Optional[List[str]] + generative_provider: Optional[_GenerativeProviderDynamic] def __init__( self, single: Optional[str], grouped: Optional[str], grouped_properties: Optional[List[str]], + generative_provider: Optional[_GenerativeProviderDynamic] = None, ) -> None: self.single = single self.grouped = grouped self.grouped_properties = grouped_properties - - def to_grpc(self) -> generative_pb2.GenerativeSearch: - return generative_pb2.GenerativeSearch( - single_response_prompt=self.single, - grouped_response_task=self.grouped, - grouped_properties=self.grouped_properties, - ) + self.generative_provider = generative_provider + + def to_grpc(self, server_version: _ServerVersion) -> generative_pb2.GenerativeSearch: + if server_version.is_lower_than(1, 27, 1): # TODO: change to 1.28.0 when it drops + if self.generative_provider is not None: + raise WeaviateInvalidInputError( + "Dynamic RAG is not supported in this Weaviate version. Please upgrade your server to >=1.28.0" + ) + return generative_pb2.GenerativeSearch( + single_response_prompt=self.single, + grouped_response_task=self.grouped, + grouped_properties=self.grouped_properties, + ) + else: + return generative_pb2.GenerativeSearch( + single=( + generative_pb2.GenerativeSearch.Single( + prompt=self.single, + queries=( + [self.generative_provider.to_grpc()] + if self.generative_provider is not None + else None + ), + ) + if self.single is not None + else None + ), + grouped=( + generative_pb2.GenerativeSearch.Grouped( + task=self.grouped, + properties=( + base_pb2.TextArray(values=self.grouped_properties) + if self.grouped_properties is not None + else None + ), + queries=( + [self.generative_provider.to_grpc()] + if self.generative_provider is not None + else None + ), + ) + if self.grouped is not None + else None + ), + ) class _GroupBy: diff --git a/weaviate/collections/grpc/query.py b/weaviate/collections/grpc/query.py index 39cf2e520..016684958 100644 --- a/weaviate/collections/grpc/query.py +++ b/weaviate/collections/grpc/query.py @@ -95,13 +95,13 @@ def __init__( tenant: Optional[str], consistency_level: Optional[ConsistencyLevel], validate_arguments: bool, - uses_125_api: bool, ): super().__init__(connection, consistency_level) self._name: str = name self._tenant = tenant self._validate_arguments = validate_arguments - self.__uses_125_api = uses_125_api + self.__uses_125_api = self._connection._weaviate_version.is_at_least(1, 25, 0) + self.__uses_127_api = self._connection._weaviate_version.is_at_least(1, 27, 0) def __parse_near_options( self, @@ -765,6 +765,7 @@ def __create_request( return search_get_pb2.SearchRequest( uses_123_api=True, uses_125_api=self.__uses_125_api, + uses_127_api=self.__uses_127_api, collection=self._name, limit=limit, offset=offset, @@ -777,7 +778,11 @@ def __create_request( consistency_level=self._consistency_level, tenant=self._tenant, filters=_FilterToGRPC.convert(filters), - generative=generative.to_grpc() if generative is not None else None, + generative=( + generative.to_grpc(self._connection._weaviate_version) + if generative is not None + else None + ), group_by=group_by.to_grpc() if group_by is not None else None, rerank=( search_get_pb2.Rerank(property=rerank.prop, query=rerank.query) diff --git a/weaviate/collections/queries/base.py b/weaviate/collections/queries/base.py index 51380c184..2634855d9 100644 --- a/weaviate/collections/queries/base.py +++ b/weaviate/collections/queries/base.py @@ -52,7 +52,7 @@ from weaviate.collections.queries.byteops import _ByteOps from weaviate.connect import ConnectionV4 from weaviate.exceptions import WeaviateInvalidInputError -from weaviate.proto.v1 import search_get_pb2, properties_pb2 +from weaviate.proto.v1 import generative_pb2, search_get_pb2, properties_pb2 from weaviate.types import INCLUDE_VECTOR from weaviate.util import ( file_encoder_b64, @@ -88,13 +88,13 @@ def __init__( self._validate_arguments = validate_arguments self.__uses_125_api = self._connection._weaviate_version.is_at_least(1, 25, 0) + self.__uses_127_api = self._connection._weaviate_version.is_at_least(1, 27, 0) self._query = _QueryGRPC( self._connection, self._name, self.__tenant, self.__consistency_level, validate_arguments=self._validate_arguments, - uses_125_api=self.__uses_125_api, ) def __retrieve_timestamp( @@ -165,12 +165,17 @@ def __extract_vector_for_object( vecs[vec.name] = _ByteOps.decode_float32s(vec.vector_bytes) return vecs - def __extract_generated_for_object( + def __extract_generated_from_metadata( self, - add_props: "search_get_pb2.MetadataResult", + add_props: search_get_pb2.MetadataResult, ) -> Optional[str]: return add_props.generative if add_props.generative_present else None + def __extract_generated_from_generative( + self, generative: generative_pb2.GenerativeResult + ) -> Optional[str]: + return generative.values[0].result if len(generative.values) > 0 else None + def __deserialize_list_value_prop_125( self, value: properties_pb2.ListValue ) -> Optional[List[Any]]: @@ -306,6 +311,7 @@ def __result_to_generative_object( self, props: search_get_pb2.PropertiesResult, meta: search_get_pb2.MetadataResult, + gen: generative_pb2.GenerativeResult, options: _QueryOptions, ) -> GenerativeObject[Any, Any]: return GenerativeObject( @@ -325,7 +331,11 @@ def __result_to_generative_object( ), uuid=self.__extract_id_for_object(meta), vector=self.__extract_vector_for_object(meta) if options.include_vector else {}, - generated=self.__extract_generated_for_object(meta), + generated=( + self.__extract_generated_from_generative(gen) + if self.__uses_127_api + else self.__extract_generated_from_metadata(meta) + ), ) def __result_to_group( @@ -435,7 +445,9 @@ def _result_to_generative_query_return( ]: return GenerativeReturn( objects=[ - self.__result_to_generative_object(obj.properties, obj.metadata, options) + self.__result_to_generative_object( + obj.properties, obj.metadata, obj.generative, options + ) for obj in res.results ], generated=( diff --git a/weaviate/collections/queries/bm25/generate.py b/weaviate/collections/queries/bm25/generate.py index cb4b350e6..057cdf697 100644 --- a/weaviate/collections/queries/bm25/generate.py +++ b/weaviate/collections/queries/bm25/generate.py @@ -4,6 +4,7 @@ from weaviate.collections.classes.filters import ( _Filters, ) +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import GroupBy, Rerank, METADATA from weaviate.collections.classes.internal import ( GenerativeSearchReturnType, @@ -28,6 +29,7 @@ async def bm25( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -53,6 +55,8 @@ async def bm25( The prompt to use for RaG on the entire result set. `grouped_properties` The properties to use in the RaG on the entire result set. + `dynamic_rag` + The provider-specific options used to customize the generation step of the RAG query. Use the `DynamicRAG` factory to create a suitably object for your use-case. `query_properties` The properties to search in. If not specified, all properties are searched. `limit` @@ -111,6 +115,7 @@ async def bm25( single=single_prompt, grouped=grouped_task, grouped_properties=grouped_properties, + generative_provider=generative_provider, ), ) return self._result_to_generative_return( diff --git a/weaviate/collections/queries/bm25/generate.pyi b/weaviate/collections/queries/bm25/generate.pyi index e364e3842..85480bfac 100644 --- a/weaviate/collections/queries/bm25/generate.pyi +++ b/weaviate/collections/queries/bm25/generate.pyi @@ -3,6 +3,7 @@ from typing import Generic, List, Literal, Optional, Type, Union, overload from weaviate.collections.classes.filters import ( _Filters, ) +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import GroupBy, Rerank, METADATA, PROPERTIES, REFERENCES from weaviate.collections.classes.internal import ( GenerativeReturn, @@ -25,6 +26,7 @@ class _BM25GenerateAsync(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -45,6 +47,7 @@ class _BM25GenerateAsync(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -65,6 +68,7 @@ class _BM25GenerateAsync(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -85,6 +89,7 @@ class _BM25GenerateAsync(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -105,6 +110,7 @@ class _BM25GenerateAsync(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -125,6 +131,7 @@ class _BM25GenerateAsync(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -148,6 +155,7 @@ class _BM25GenerateAsync(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -168,6 +176,7 @@ class _BM25GenerateAsync(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -188,6 +197,7 @@ class _BM25GenerateAsync(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -208,6 +218,7 @@ class _BM25GenerateAsync(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -228,6 +239,7 @@ class _BM25GenerateAsync(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -248,6 +260,7 @@ class _BM25GenerateAsync(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -268,6 +281,7 @@ class _BM25GenerateAsync(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -290,6 +304,7 @@ class _BM25Generate(Generic[Properties, References], _Base[Properties, Reference single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -310,6 +325,7 @@ class _BM25Generate(Generic[Properties, References], _Base[Properties, Reference single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -330,6 +346,7 @@ class _BM25Generate(Generic[Properties, References], _Base[Properties, Reference single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -350,6 +367,7 @@ class _BM25Generate(Generic[Properties, References], _Base[Properties, Reference single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -370,6 +388,7 @@ class _BM25Generate(Generic[Properties, References], _Base[Properties, Reference single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -390,6 +409,7 @@ class _BM25Generate(Generic[Properties, References], _Base[Properties, Reference single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -413,6 +433,7 @@ class _BM25Generate(Generic[Properties, References], _Base[Properties, Reference single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -434,6 +455,7 @@ class _BM25Generate(Generic[Properties, References], _Base[Properties, Reference single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -455,6 +477,7 @@ class _BM25Generate(Generic[Properties, References], _Base[Properties, Reference single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -476,6 +499,7 @@ class _BM25Generate(Generic[Properties, References], _Base[Properties, Reference single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -497,6 +521,7 @@ class _BM25Generate(Generic[Properties, References], _Base[Properties, Reference single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -518,6 +543,7 @@ class _BM25Generate(Generic[Properties, References], _Base[Properties, Reference single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, @@ -539,6 +565,7 @@ class _BM25Generate(Generic[Properties, References], _Base[Properties, Reference single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, query_properties: Optional[List[str]] = None, limit: Optional[int] = None, offset: Optional[int] = None, diff --git a/weaviate/collections/queries/fetch_objects/generate.py b/weaviate/collections/queries/fetch_objects/generate.py index 2d80d21e7..0f5f0bac1 100644 --- a/weaviate/collections/queries/fetch_objects/generate.py +++ b/weaviate/collections/queries/fetch_objects/generate.py @@ -2,6 +2,7 @@ from weaviate import syncify from weaviate.collections.classes.filters import _Filters +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import METADATA, Sorting from weaviate.collections.classes.internal import ( GenerativeReturnType, @@ -22,6 +23,7 @@ async def fetch_objects( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -41,6 +43,8 @@ async def fetch_objects( The prompt to use for RaG on the entire result set. `grouped_properties` The properties to use in the RaG on the entire result set. + `dynamic_rag` + The provider-specific options used to customize the generation step of the RAG query. Use the `DynamicRAG` factory to create a suitably object for your use-case. `limit` The maximum number of results to return. If not specified, the default limit specified by Weaviate is returned. `offset` @@ -85,6 +89,7 @@ async def fetch_objects( single=single_prompt, grouped=grouped_task, grouped_properties=grouped_properties, + generative_provider=generative_provider, ), ) return self._result_to_generative_query_return( diff --git a/weaviate/collections/queries/fetch_objects/generate.pyi b/weaviate/collections/queries/fetch_objects/generate.pyi index bc81514bb..a8083f9f8 100644 --- a/weaviate/collections/queries/fetch_objects/generate.pyi +++ b/weaviate/collections/queries/fetch_objects/generate.pyi @@ -1,6 +1,7 @@ from typing import Generic, List, Literal, Optional, Union, Type, overload from weaviate.collections.classes.filters import _Filters +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import ( METADATA, PROPERTIES, @@ -26,6 +27,7 @@ class _FetchObjectsGenerateAsync(Generic[Properties, References], _Base[Properti single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -43,6 +45,7 @@ class _FetchObjectsGenerateAsync(Generic[Properties, References], _Base[Properti single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -60,6 +63,7 @@ class _FetchObjectsGenerateAsync(Generic[Properties, References], _Base[Properti single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -77,6 +81,7 @@ class _FetchObjectsGenerateAsync(Generic[Properties, References], _Base[Properti single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -94,6 +99,7 @@ class _FetchObjectsGenerateAsync(Generic[Properties, References], _Base[Properti single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -111,6 +117,7 @@ class _FetchObjectsGenerateAsync(Generic[Properties, References], _Base[Properti single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -128,6 +135,7 @@ class _FetchObjectsGenerateAsync(Generic[Properties, References], _Base[Properti single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -147,6 +155,7 @@ class _FetchObjectsGenerate(Generic[Properties, References], _Base[Properties, R single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -164,6 +173,7 @@ class _FetchObjectsGenerate(Generic[Properties, References], _Base[Properties, R single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -181,6 +191,7 @@ class _FetchObjectsGenerate(Generic[Properties, References], _Base[Properties, R single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -198,6 +209,7 @@ class _FetchObjectsGenerate(Generic[Properties, References], _Base[Properties, R single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -215,6 +227,7 @@ class _FetchObjectsGenerate(Generic[Properties, References], _Base[Properties, R single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -232,6 +245,7 @@ class _FetchObjectsGenerate(Generic[Properties, References], _Base[Properties, R single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -249,6 +263,7 @@ class _FetchObjectsGenerate(Generic[Properties, References], _Base[Properties, R single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, diff --git a/weaviate/collections/queries/fetch_objects_by_ids/generate.py b/weaviate/collections/queries/fetch_objects_by_ids/generate.py index 15ae18ea1..f3d2b9cd2 100644 --- a/weaviate/collections/queries/fetch_objects_by_ids/generate.py +++ b/weaviate/collections/queries/fetch_objects_by_ids/generate.py @@ -2,6 +2,7 @@ from weaviate import syncify from weaviate.collections.classes.filters import Filter +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import METADATA, Sorting from weaviate.collections.classes.internal import ( GenerativeReturnType, @@ -26,6 +27,7 @@ async def fetch_objects_by_ids( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -35,7 +37,10 @@ async def fetch_objects_by_ids( return_properties: Optional[ReturnProperties[TProperties]] = None, return_references: Optional[ReturnReferences[TReferences]] = None ) -> GenerativeReturnType[Properties, References, TProperties, TReferences]: - """Special case of fetch_objects based on filters on uuid""" + """Perform retrieval-augmented generation (RaG) on the results of a simple get query of objects matching the provided IDs in this collection. + + See the docstring of `fetch_objects` for more information on the arguments. + """ if not ids: res = search_get_pb2.SearchReply(results=None) else: @@ -52,6 +57,7 @@ async def fetch_objects_by_ids( single=single_prompt, grouped=grouped_task, grouped_properties=grouped_properties, + generative_provider=generative_provider, ), ) return self._result_to_generative_query_return( diff --git a/weaviate/collections/queries/fetch_objects_by_ids/generate.pyi b/weaviate/collections/queries/fetch_objects_by_ids/generate.pyi index 4f2837fea..f6a1a4128 100644 --- a/weaviate/collections/queries/fetch_objects_by_ids/generate.pyi +++ b/weaviate/collections/queries/fetch_objects_by_ids/generate.pyi @@ -1,5 +1,6 @@ from typing import Generic, Iterable, List, Literal, Optional, Type, Union, overload +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import ( METADATA, PROPERTIES, @@ -28,6 +29,7 @@ class _FetchObjectsByIDsGenerateAsync( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -45,6 +47,7 @@ class _FetchObjectsByIDsGenerateAsync( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -62,6 +65,7 @@ class _FetchObjectsByIDsGenerateAsync( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -79,6 +83,7 @@ class _FetchObjectsByIDsGenerateAsync( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -96,6 +101,7 @@ class _FetchObjectsByIDsGenerateAsync( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -113,6 +119,7 @@ class _FetchObjectsByIDsGenerateAsync( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -130,6 +137,7 @@ class _FetchObjectsByIDsGenerateAsync( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -149,6 +157,7 @@ class _FetchObjectsByIDsGenerate(Generic[Properties, References], _Base[Properti single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -166,6 +175,7 @@ class _FetchObjectsByIDsGenerate(Generic[Properties, References], _Base[Properti single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -183,6 +193,7 @@ class _FetchObjectsByIDsGenerate(Generic[Properties, References], _Base[Properti single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -200,6 +211,7 @@ class _FetchObjectsByIDsGenerate(Generic[Properties, References], _Base[Properti single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -217,6 +229,7 @@ class _FetchObjectsByIDsGenerate(Generic[Properties, References], _Base[Properti single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -234,6 +247,7 @@ class _FetchObjectsByIDsGenerate(Generic[Properties, References], _Base[Properti single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, @@ -251,6 +265,7 @@ class _FetchObjectsByIDsGenerate(Generic[Properties, References], _Base[Properti single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, limit: Optional[int] = None, offset: Optional[int] = None, after: Optional[UUID] = None, diff --git a/weaviate/collections/queries/hybrid/generate.py b/weaviate/collections/queries/hybrid/generate.py index 0fc92a414..f7e154b3a 100644 --- a/weaviate/collections/queries/hybrid/generate.py +++ b/weaviate/collections/queries/hybrid/generate.py @@ -4,6 +4,7 @@ from weaviate.collections.classes.filters import ( _Filters, ) +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import ( METADATA, GroupBy, @@ -34,6 +35,7 @@ async def hybrid( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -64,6 +66,8 @@ async def hybrid( The prompt to use for RaG on the entire result set. `grouped_properties` The properties to use in the RaG on the entire result set. + `dynamic_rag` + The provider-specific options used to customize the generation step of the RAG query. Use the `DynamicRAG` factory to create a suitably object for your use-case. `alpha` The weight of the BM25 score. If not specified, the default weight specified by the server is used. `vector` @@ -135,6 +139,7 @@ async def hybrid( single=single_prompt, grouped=grouped_task, grouped_properties=grouped_properties, + generative_provider=generative_provider, ), ) return self._result_to_generative_return( diff --git a/weaviate/collections/queries/hybrid/generate.pyi b/weaviate/collections/queries/hybrid/generate.pyi index 2adf267f7..641abffe1 100644 --- a/weaviate/collections/queries/hybrid/generate.pyi +++ b/weaviate/collections/queries/hybrid/generate.pyi @@ -3,6 +3,7 @@ from typing import Generic, List, Literal, Optional, Type, Union, overload from weaviate.collections.classes.filters import ( _Filters, ) +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import ( METADATA, PROPERTIES, @@ -34,6 +35,7 @@ class _HybridGenerateAsync(Generic[Properties, References], _Base[Properties, Re single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -59,6 +61,7 @@ class _HybridGenerateAsync(Generic[Properties, References], _Base[Properties, Re single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -84,6 +87,7 @@ class _HybridGenerateAsync(Generic[Properties, References], _Base[Properties, Re single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -109,6 +113,7 @@ class _HybridGenerateAsync(Generic[Properties, References], _Base[Properties, Re single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -134,6 +139,7 @@ class _HybridGenerateAsync(Generic[Properties, References], _Base[Properties, Re single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -159,6 +165,7 @@ class _HybridGenerateAsync(Generic[Properties, References], _Base[Properties, Re single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -187,6 +194,7 @@ class _HybridGenerateAsync(Generic[Properties, References], _Base[Properties, Re single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -212,6 +220,7 @@ class _HybridGenerateAsync(Generic[Properties, References], _Base[Properties, Re single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -237,6 +246,7 @@ class _HybridGenerateAsync(Generic[Properties, References], _Base[Properties, Re single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -262,6 +272,7 @@ class _HybridGenerateAsync(Generic[Properties, References], _Base[Properties, Re single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -287,6 +298,7 @@ class _HybridGenerateAsync(Generic[Properties, References], _Base[Properties, Re single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -312,6 +324,7 @@ class _HybridGenerateAsync(Generic[Properties, References], _Base[Properties, Re single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -337,6 +350,7 @@ class _HybridGenerateAsync(Generic[Properties, References], _Base[Properties, Re single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -364,6 +378,7 @@ class _HybridGenerate(Generic[Properties, References], _Base[Properties, Referen single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -389,6 +404,7 @@ class _HybridGenerate(Generic[Properties, References], _Base[Properties, Referen single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -414,6 +430,7 @@ class _HybridGenerate(Generic[Properties, References], _Base[Properties, Referen single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -439,6 +456,7 @@ class _HybridGenerate(Generic[Properties, References], _Base[Properties, Referen single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -464,6 +482,7 @@ class _HybridGenerate(Generic[Properties, References], _Base[Properties, Referen single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -489,6 +508,7 @@ class _HybridGenerate(Generic[Properties, References], _Base[Properties, Referen single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -517,6 +537,7 @@ class _HybridGenerate(Generic[Properties, References], _Base[Properties, Referen single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -542,6 +563,7 @@ class _HybridGenerate(Generic[Properties, References], _Base[Properties, Referen single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -567,6 +589,7 @@ class _HybridGenerate(Generic[Properties, References], _Base[Properties, Referen single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -592,6 +615,7 @@ class _HybridGenerate(Generic[Properties, References], _Base[Properties, Referen single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -617,6 +641,7 @@ class _HybridGenerate(Generic[Properties, References], _Base[Properties, Referen single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -642,6 +667,7 @@ class _HybridGenerate(Generic[Properties, References], _Base[Properties, Referen single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, @@ -668,6 +694,7 @@ class _HybridGenerate(Generic[Properties, References], _Base[Properties, Referen single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, alpha: NUMBER = 0.7, vector: Optional[HybridVectorType] = None, query_properties: Optional[List[str]] = None, diff --git a/weaviate/collections/queries/near_image/generate.py b/weaviate/collections/queries/near_image/generate.py index 3ac12c368..b42b407f0 100644 --- a/weaviate/collections/queries/near_image/generate.py +++ b/weaviate/collections/queries/near_image/generate.py @@ -6,6 +6,7 @@ from weaviate.collections.classes.filters import ( _Filters, ) +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import METADATA, GroupBy, Rerank, TargetVectorJoinType from weaviate.collections.classes.internal import ( _Generative, @@ -28,6 +29,7 @@ async def near_image( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -52,6 +54,14 @@ async def near_image( Arguments: `near_image` The image file to search on, REQUIRED. This can be a base64 encoded string of the binary, a path to the file, or a file-like object. + `single_prompt` + The prompt to use for RaG on each object individually. + `grouped_task` + The prompt to use for RaG on the entire result set. + `grouped_properties` + The properties to use in the RaG on the entire result set. + `dynamic_rag` + The provider-specific options used to customize the generation step of the RAG query. Use the `DynamicRAG` factory to create a suitably object for your use-case. `certainty` The minimum similarity score to return. If not specified, the default certainty specified by the server is used. `distance` @@ -105,6 +115,7 @@ async def near_image( single=single_prompt, grouped=grouped_task, grouped_properties=grouped_properties, + generative_provider=generative_provider, ), limit=limit, offset=offset, diff --git a/weaviate/collections/queries/near_image/generate.pyi b/weaviate/collections/queries/near_image/generate.pyi index d10093ac6..0ed0432be 100644 --- a/weaviate/collections/queries/near_image/generate.pyi +++ b/weaviate/collections/queries/near_image/generate.pyi @@ -5,6 +5,7 @@ from typing import Generic, List, Literal, Optional, Type, Union, overload from weaviate.collections.classes.filters import ( _Filters, ) +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import ( METADATA, PROPERTIES, @@ -34,6 +35,7 @@ class _NearImageGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -56,6 +58,7 @@ class _NearImageGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -78,6 +81,7 @@ class _NearImageGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -100,6 +104,7 @@ class _NearImageGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -122,6 +127,7 @@ class _NearImageGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -144,6 +150,7 @@ class _NearImageGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -167,6 +174,7 @@ class _NearImageGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -189,6 +197,7 @@ class _NearImageGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -211,6 +220,7 @@ class _NearImageGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -233,6 +243,7 @@ class _NearImageGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -255,6 +266,7 @@ class _NearImageGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -277,6 +289,7 @@ class _NearImageGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -301,6 +314,7 @@ class _NearImageGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -325,6 +339,7 @@ class _NearImageGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -347,6 +362,7 @@ class _NearImageGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -369,6 +385,7 @@ class _NearImageGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -391,6 +408,7 @@ class _NearImageGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -413,6 +431,7 @@ class _NearImageGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -435,6 +454,7 @@ class _NearImageGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -458,6 +478,7 @@ class _NearImageGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -480,6 +501,7 @@ class _NearImageGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -502,6 +524,7 @@ class _NearImageGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -524,6 +547,7 @@ class _NearImageGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -546,6 +570,7 @@ class _NearImageGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -568,6 +593,7 @@ class _NearImageGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -591,6 +617,7 @@ class _NearImageGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, diff --git a/weaviate/collections/queries/near_media/generate.py b/weaviate/collections/queries/near_media/generate.py index 6d93d7903..72e00df6d 100644 --- a/weaviate/collections/queries/near_media/generate.py +++ b/weaviate/collections/queries/near_media/generate.py @@ -6,6 +6,7 @@ from weaviate.collections.classes.filters import ( _Filters, ) +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import ( METADATA, GroupBy, @@ -35,6 +36,7 @@ async def near_media( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -61,6 +63,14 @@ async def near_media( The media file to search on, REQUIRED. This can be a base64 encoded string of the binary, a path to the file, or a file-like object. `media_type` The type of the provided media file, REQUIRED. + `single_prompt` + The prompt to use for RaG on each object individually. + `grouped_task` + The prompt to use for RaG on the entire result set. + `grouped_properties` + The properties to use in the RaG on the entire result set. + `dynamic_rag` + The provider-specific options used to customize the generation step of the RAG query. Use the `DynamicRAG` factory to create a suitably object for your use-case. `certainty` The minimum similarity score to return. If not specified, the default certainty specified by the server is used. `distance` @@ -114,6 +124,7 @@ async def near_media( single=single_prompt, grouped=grouped_task, grouped_properties=grouped_properties, + generative_provider=generative_provider, ), limit=limit, offset=offset, diff --git a/weaviate/collections/queries/near_media/generate.pyi b/weaviate/collections/queries/near_media/generate.pyi index 86aaf04b5..55ae1db9b 100644 --- a/weaviate/collections/queries/near_media/generate.pyi +++ b/weaviate/collections/queries/near_media/generate.pyi @@ -5,6 +5,7 @@ from typing import Generic, List, Literal, Optional, Type, Union, overload from weaviate.collections.classes.filters import ( _Filters, ) +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import ( METADATA, PROPERTIES, @@ -36,6 +37,7 @@ class _NearMediaGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -59,6 +61,7 @@ class _NearMediaGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -82,6 +85,7 @@ class _NearMediaGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -105,6 +109,7 @@ class _NearMediaGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -128,6 +133,7 @@ class _NearMediaGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -151,6 +157,7 @@ class _NearMediaGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -175,6 +182,7 @@ class _NearMediaGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -198,6 +206,7 @@ class _NearMediaGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -221,6 +230,7 @@ class _NearMediaGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -244,6 +254,7 @@ class _NearMediaGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -267,6 +278,7 @@ class _NearMediaGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -290,6 +302,7 @@ class _NearMediaGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -315,6 +328,7 @@ class _NearMediaGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -340,6 +354,7 @@ class _NearMediaGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -363,6 +378,7 @@ class _NearMediaGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -386,6 +402,7 @@ class _NearMediaGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -409,6 +426,7 @@ class _NearMediaGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -432,6 +450,7 @@ class _NearMediaGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -455,6 +474,7 @@ class _NearMediaGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -479,6 +499,7 @@ class _NearMediaGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -502,6 +523,7 @@ class _NearMediaGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -525,6 +547,7 @@ class _NearMediaGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -548,6 +571,7 @@ class _NearMediaGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -571,6 +595,7 @@ class _NearMediaGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -594,6 +619,7 @@ class _NearMediaGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -619,6 +645,7 @@ class _NearMediaGenerate(Generic[Properties, References], _Base[Properties, Refe single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, diff --git a/weaviate/collections/queries/near_object/generate.py b/weaviate/collections/queries/near_object/generate.py index 8ddc02601..bd3155c4a 100644 --- a/weaviate/collections/queries/near_object/generate.py +++ b/weaviate/collections/queries/near_object/generate.py @@ -4,6 +4,7 @@ from weaviate.collections.classes.filters import ( _Filters, ) +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import METADATA, GroupBy, Rerank, TargetVectorJoinType from weaviate.collections.classes.internal import ( _Generative, @@ -26,6 +27,7 @@ async def near_object( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -47,6 +49,14 @@ async def near_object( Arguments: `near_object` The UUID of the object to search on, REQUIRED. + `single_prompt` + The prompt to use for RaG on each object individually. + `grouped_task` + The prompt to use for RaG on the entire result set. + `grouped_properties` + The properties to use in the RaG on the entire result set. + `dynamic_rag` + The provider-specific options used to customize the generation step of the RAG query. Use the `DynamicRAG` factory to create a suitably object for your use-case. `certainty` The minimum similarity score to return. If not specified, the default certainty specified by the server is used. `distance` @@ -102,6 +112,7 @@ async def near_object( single=single_prompt, grouped=grouped_task, grouped_properties=grouped_properties, + generative_provider=generative_provider, ), return_metadata=self._parse_return_metadata(return_metadata, include_vector), return_properties=self._parse_return_properties(return_properties), diff --git a/weaviate/collections/queries/near_object/generate.pyi b/weaviate/collections/queries/near_object/generate.pyi index a227483d8..2856ee00d 100644 --- a/weaviate/collections/queries/near_object/generate.pyi +++ b/weaviate/collections/queries/near_object/generate.pyi @@ -3,6 +3,7 @@ from typing import Generic, List, Literal, Optional, Type, Union, overload from weaviate.collections.classes.filters import ( _Filters, ) +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import ( METADATA, PROPERTIES, @@ -32,6 +33,7 @@ class _NearObjectGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -54,6 +56,7 @@ class _NearObjectGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -76,6 +79,7 @@ class _NearObjectGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -98,6 +102,7 @@ class _NearObjectGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -120,6 +125,7 @@ class _NearObjectGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -142,6 +148,7 @@ class _NearObjectGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -165,6 +172,7 @@ class _NearObjectGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -187,6 +195,7 @@ class _NearObjectGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -209,6 +218,7 @@ class _NearObjectGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -231,6 +241,7 @@ class _NearObjectGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -253,6 +264,7 @@ class _NearObjectGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -275,6 +287,7 @@ class _NearObjectGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -299,6 +312,7 @@ class _NearObjectGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -323,6 +337,7 @@ class _NearObjectGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -345,6 +360,7 @@ class _NearObjectGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -367,6 +383,7 @@ class _NearObjectGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -389,6 +406,7 @@ class _NearObjectGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -411,6 +429,7 @@ class _NearObjectGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -433,6 +452,7 @@ class _NearObjectGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -456,6 +476,7 @@ class _NearObjectGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -478,6 +499,7 @@ class _NearObjectGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -500,6 +522,7 @@ class _NearObjectGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -522,6 +545,7 @@ class _NearObjectGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -544,6 +568,7 @@ class _NearObjectGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -566,6 +591,7 @@ class _NearObjectGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -590,6 +616,7 @@ class _NearObjectGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, diff --git a/weaviate/collections/queries/near_text/generate.py b/weaviate/collections/queries/near_text/generate.py index 4aee65151..2994db7be 100644 --- a/weaviate/collections/queries/near_text/generate.py +++ b/weaviate/collections/queries/near_text/generate.py @@ -4,6 +4,7 @@ from weaviate.collections.classes.filters import ( _Filters, ) +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import ( METADATA, GroupBy, @@ -32,6 +33,7 @@ async def near_text( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -58,6 +60,14 @@ async def near_text( Arguments: `query` The text or texts to search on, REQUIRED. + `single_prompt` + The prompt to use for RaG on each object individually. + `grouped_task` + The prompt to use for RaG on the entire result set. + `grouped_properties` + The properties to use in the RaG on the entire result set. + `dynamic_rag` + The provider-specific options used to customize the generation step of the RAG query. Use the `DynamicRAG` factory to create a suitably object for your use-case. `certainty` The minimum similarity score to return. If not specified, the default certainty specified by the server is used. `distance` @@ -115,6 +125,7 @@ async def near_text( single=single_prompt, grouped=grouped_task, grouped_properties=grouped_properties, + generative_provider=generative_provider, ), return_metadata=self._parse_return_metadata(return_metadata, include_vector), return_properties=self._parse_return_properties(return_properties), diff --git a/weaviate/collections/queries/near_text/generate.pyi b/weaviate/collections/queries/near_text/generate.pyi index 6aad6a0c8..850cd04c4 100644 --- a/weaviate/collections/queries/near_text/generate.pyi +++ b/weaviate/collections/queries/near_text/generate.pyi @@ -3,6 +3,7 @@ from typing import Generic, List, Literal, Optional, Type, Union, overload from weaviate.collections.classes.filters import ( _Filters, ) +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import ( METADATA, PROPERTIES, @@ -33,6 +34,7 @@ class _NearTextGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -57,6 +59,7 @@ class _NearTextGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -81,6 +84,7 @@ class _NearTextGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -105,6 +109,7 @@ class _NearTextGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -129,6 +134,7 @@ class _NearTextGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -153,6 +159,7 @@ class _NearTextGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -178,6 +185,7 @@ class _NearTextGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -202,6 +210,7 @@ class _NearTextGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -226,6 +235,7 @@ class _NearTextGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -250,6 +260,7 @@ class _NearTextGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -274,6 +285,7 @@ class _NearTextGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -298,6 +310,7 @@ class _NearTextGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -324,6 +337,7 @@ class _NearTextGenerateAsync(Generic[Properties, References], _Base[Properties, single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -350,6 +364,7 @@ class _NearTextGenerate(Generic[Properties, References], _Base[Properties, Refer single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -374,6 +389,7 @@ class _NearTextGenerate(Generic[Properties, References], _Base[Properties, Refer single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -398,6 +414,7 @@ class _NearTextGenerate(Generic[Properties, References], _Base[Properties, Refer single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -422,6 +439,7 @@ class _NearTextGenerate(Generic[Properties, References], _Base[Properties, Refer single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -446,6 +464,7 @@ class _NearTextGenerate(Generic[Properties, References], _Base[Properties, Refer single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -470,6 +489,7 @@ class _NearTextGenerate(Generic[Properties, References], _Base[Properties, Refer single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -495,6 +515,7 @@ class _NearTextGenerate(Generic[Properties, References], _Base[Properties, Refer single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -519,6 +540,7 @@ class _NearTextGenerate(Generic[Properties, References], _Base[Properties, Refer single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -543,6 +565,7 @@ class _NearTextGenerate(Generic[Properties, References], _Base[Properties, Refer single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -567,6 +590,7 @@ class _NearTextGenerate(Generic[Properties, References], _Base[Properties, Refer single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -591,6 +615,7 @@ class _NearTextGenerate(Generic[Properties, References], _Base[Properties, Refer single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -615,6 +640,7 @@ class _NearTextGenerate(Generic[Properties, References], _Base[Properties, Refer single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, @@ -641,6 +667,7 @@ class _NearTextGenerate(Generic[Properties, References], _Base[Properties, Refer single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, move_to: Optional[Move] = None, diff --git a/weaviate/collections/queries/near_vector/generate.py b/weaviate/collections/queries/near_vector/generate.py index 2f3bd5f07..b99ab7eb1 100644 --- a/weaviate/collections/queries/near_vector/generate.py +++ b/weaviate/collections/queries/near_vector/generate.py @@ -4,6 +4,7 @@ from weaviate.collections.classes.filters import ( _Filters, ) +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import ( METADATA, GroupBy, @@ -32,6 +33,7 @@ async def near_vector( single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -53,6 +55,14 @@ async def near_vector( Arguments: `near_vector` The vector to search on, REQUIRED. This can be a base64 encoded string of the binary, a path to the file, or a file-like object. + `single_prompt` + The prompt to use for RaG on each object individually. + `grouped_task` + The prompt to use for RaG on the entire result set. + `grouped_properties` + The properties to use in the RaG on the entire result set. + `dynamic_rag` + The provider-specific options used to customize the generation step of the RAG query. Use the `DynamicRAG` factory to create a suitably object for your use-case. `certainty` The minimum similarity score to return. If not specified, the default certainty specified by the server is used. `distance` @@ -103,6 +113,7 @@ async def near_vector( single=single_prompt, grouped=grouped_task, grouped_properties=grouped_properties, + generative_provider=generative_provider, ), limit=limit, offset=offset, diff --git a/weaviate/collections/queries/near_vector/generate.pyi b/weaviate/collections/queries/near_vector/generate.pyi index a405c9a13..fc21bd092 100644 --- a/weaviate/collections/queries/near_vector/generate.pyi +++ b/weaviate/collections/queries/near_vector/generate.pyi @@ -3,6 +3,7 @@ from typing import Generic, List, Literal, Optional, Type, Union, overload from weaviate.collections.classes.filters import ( _Filters, ) +from weaviate.collections.classes.generative import _GenerativeProviderDynamic from weaviate.collections.classes.grpc import ( METADATA, PROPERTIES, @@ -33,6 +34,7 @@ class _NearVectorGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -55,6 +57,7 @@ class _NearVectorGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -77,6 +80,7 @@ class _NearVectorGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -99,6 +103,7 @@ class _NearVectorGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -121,6 +126,7 @@ class _NearVectorGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -143,6 +149,7 @@ class _NearVectorGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -166,6 +173,7 @@ class _NearVectorGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -188,6 +196,7 @@ class _NearVectorGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -210,6 +219,7 @@ class _NearVectorGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -232,6 +242,7 @@ class _NearVectorGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -254,6 +265,7 @@ class _NearVectorGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -276,6 +288,7 @@ class _NearVectorGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -300,6 +313,7 @@ class _NearVectorGenerateAsync(Generic[Properties, References], _Base[Properties single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -324,6 +338,7 @@ class _NearVectorGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -346,6 +361,7 @@ class _NearVectorGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -368,6 +384,7 @@ class _NearVectorGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -390,6 +407,7 @@ class _NearVectorGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -412,6 +430,7 @@ class _NearVectorGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -434,6 +453,7 @@ class _NearVectorGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -457,6 +477,7 @@ class _NearVectorGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -479,6 +500,7 @@ class _NearVectorGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -501,6 +523,7 @@ class _NearVectorGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -523,6 +546,7 @@ class _NearVectorGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -545,6 +569,7 @@ class _NearVectorGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -567,6 +592,7 @@ class _NearVectorGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, @@ -591,6 +617,7 @@ class _NearVectorGenerate(Generic[Properties, References], _Base[Properties, Ref single_prompt: Optional[str] = None, grouped_task: Optional[str] = None, grouped_properties: Optional[List[str]] = None, + generative_provider: Optional[_GenerativeProviderDynamic] = None, certainty: Optional[NUMBER] = None, distance: Optional[NUMBER] = None, limit: Optional[int] = None, diff --git a/weaviate/proto/v1/generative_pb2.py b/weaviate/proto/v1/generative_pb2.py index 5f8c937f9..996d7763b 100644 --- a/weaviate/proto/v1/generative_pb2.py +++ b/weaviate/proto/v1/generative_pb2.py @@ -17,7 +17,7 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile( - b'\n\x13v1/generative.proto\x12\x0bweaviate.v1\x1a\rv1/base.proto"\x9b\x03\n\x10GenerativeSearch\x12"\n\x16single_response_prompt\x18\x01 \x01(\tB\x02\x18\x01\x12!\n\x15grouped_response_task\x18\x02 \x01(\tB\x02\x18\x01\x12\x1e\n\x12grouped_properties\x18\x03 \x03(\tB\x02\x18\x01\x12\x34\n\x06single\x18\x04 \x01(\x0b\x32$.weaviate.v1.GenerativeSearch.Single\x12\x36\n\x07grouped\x18\x05 \x01(\x0b\x32%.weaviate.v1.GenerativeSearch.Grouped\x1aY\n\x06Single\x12\x0e\n\x06prompt\x18\x01 \x01(\t\x12\r\n\x05\x64\x65\x62ug\x18\x02 \x01(\x08\x12\x30\n\x07queries\x18\x03 \x03(\x0b\x32\x1f.weaviate.v1.GenerativeProvider\x1aW\n\x07Grouped\x12\x0c\n\x04task\x18\x01 \x01(\t\x12/\n\nproperties\x18\x02 \x01(\x0b\x32\x16.weaviate.v1.TextArrayH\x00\x88\x01\x01\x42\r\n\x0b_properties"\xa3\x04\n\x12GenerativeProvider\x12\x17\n\x0freturn_metadata\x18\x01 \x01(\x08\x12\x35\n\tanthropic\x18\x02 \x01(\x0b\x32 .weaviate.v1.GenerativeAnthropicH\x00\x12\x33\n\x08\x61nyscale\x18\x03 \x01(\x0b\x32\x1f.weaviate.v1.GenerativeAnyscaleH\x00\x12)\n\x03\x61ws\x18\x04 \x01(\x0b\x32\x1a.weaviate.v1.GenerativeAWSH\x00\x12/\n\x06\x63ohere\x18\x05 \x01(\x0b\x32\x1d.weaviate.v1.GenerativeCohereH\x00\x12-\n\x05\x64ummy\x18\x06 \x01(\x0b\x32\x1c.weaviate.v1.GenerativeDummyH\x00\x12\x31\n\x07mistral\x18\x07 \x01(\x0b\x32\x1e.weaviate.v1.GenerativeMistralH\x00\x12/\n\x06octoai\x18\x08 \x01(\x0b\x32\x1d.weaviate.v1.GenerativeOctoAIH\x00\x12/\n\x06ollama\x18\t \x01(\x0b\x32\x1d.weaviate.v1.GenerativeOllamaH\x00\x12/\n\x06openai\x18\n \x01(\x0b\x32\x1d.weaviate.v1.GenerativeOpenAIH\x00\x12/\n\x06google\x18\x0b \x01(\x0b\x32\x1d.weaviate.v1.GenerativeGoogleH\x00\x42\x06\n\x04kind"\xad\x02\n\x13GenerativeAnthropic\x12\x15\n\x08\x62\x61se_url\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x17\n\nmax_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x12\n\x05model\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x18\n\x0btemperature\x18\x04 \x01(\x01H\x03\x88\x01\x01\x12\x12\n\x05top_k\x18\x05 \x01(\x03H\x04\x88\x01\x01\x12\x12\n\x05top_p\x18\x06 \x01(\x01H\x05\x88\x01\x01\x12\x33\n\x0estop_sequences\x18\x07 \x01(\x0b\x32\x16.weaviate.v1.TextArrayH\x06\x88\x01\x01\x42\x0b\n\t_base_urlB\r\n\x0b_max_tokensB\x08\n\x06_modelB\x0e\n\x0c_temperatureB\x08\n\x06_top_kB\x08\n\x06_top_pB\x11\n\x0f_stop_sequences"\x80\x01\n\x12GenerativeAnyscale\x12\x15\n\x08\x62\x61se_url\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x12\n\x05model\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0btemperature\x18\x03 \x01(\x01H\x02\x88\x01\x01\x42\x0b\n\t_base_urlB\x08\n\x06_modelB\x0e\n\x0c_temperature"W\n\rGenerativeAWS\x12\x12\n\x05model\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0btemperature\x18\x08 \x01(\x01H\x01\x88\x01\x01\x42\x08\n\x06_modelB\x0e\n\x0c_temperature"\x84\x03\n\x10GenerativeCohere\x12\x15\n\x08\x62\x61se_url\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11\x66requency_penalty\x18\x02 \x01(\x01H\x01\x88\x01\x01\x12\x17\n\nmax_tokens\x18\x03 \x01(\x03H\x02\x88\x01\x01\x12\x12\n\x05model\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x0e\n\x01k\x18\x05 \x01(\x03H\x04\x88\x01\x01\x12\x0e\n\x01p\x18\x06 \x01(\x01H\x05\x88\x01\x01\x12\x1d\n\x10presence_penalty\x18\x07 \x01(\x01H\x06\x88\x01\x01\x12\x33\n\x0estop_sequences\x18\x08 \x01(\x0b\x32\x16.weaviate.v1.TextArrayH\x07\x88\x01\x01\x12\x18\n\x0btemperature\x18\t \x01(\x01H\x08\x88\x01\x01\x42\x0b\n\t_base_urlB\x14\n\x12_frequency_penaltyB\r\n\x0b_max_tokensB\x08\n\x06_modelB\x04\n\x02_kB\x04\n\x02_pB\x13\n\x11_presence_penaltyB\x11\n\x0f_stop_sequencesB\x0e\n\x0c_temperature"\x11\n\x0fGenerativeDummy"\xc5\x01\n\x11GenerativeMistral\x12\x15\n\x08\x62\x61se_url\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x17\n\nmax_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x12\n\x05model\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x18\n\x0btemperature\x18\x04 \x01(\x01H\x03\x88\x01\x01\x12\x12\n\x05top_p\x18\x05 \x01(\x01H\x04\x88\x01\x01\x42\x0b\n\t_base_urlB\r\n\x0b_max_tokensB\x08\n\x06_modelB\x0e\n\x0c_temperatureB\x08\n\x06_top_p"\xda\x01\n\x10GenerativeOctoAI\x12\x15\n\x08\x62\x61se_url\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x17\n\nmax_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x12\n\x05model\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x0e\n\x01n\x18\x04 \x01(\x03H\x03\x88\x01\x01\x12\x18\n\x0btemperature\x18\x05 \x01(\x01H\x04\x88\x01\x01\x12\x12\n\x05top_p\x18\x06 \x01(\x01H\x05\x88\x01\x01\x42\x0b\n\t_base_urlB\r\n\x0b_max_tokensB\x08\n\x06_modelB\x04\n\x02_nB\x0e\n\x0c_temperatureB\x08\n\x06_top_p"\x86\x01\n\x10GenerativeOllama\x12\x19\n\x0c\x61pi_endpoint\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x12\n\x05model\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0btemperature\x18\x03 \x01(\x01H\x02\x88\x01\x01\x42\x0f\n\r_api_endpointB\x08\n\x06_modelB\x0e\n\x0c_temperature"\x99\x03\n\x10GenerativeOpenAI\x12\x1e\n\x11\x66requency_penalty\x18\x01 \x01(\x01H\x00\x88\x01\x01\x12\x16\n\tlog_probs\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x17\n\nmax_tokens\x18\x03 \x01(\x03H\x02\x88\x01\x01\x12\r\n\x05model\x18\x04 \x01(\t\x12\x0e\n\x01n\x18\x05 \x01(\x03H\x03\x88\x01\x01\x12\x1d\n\x10presence_penalty\x18\x06 \x01(\x01H\x04\x88\x01\x01\x12)\n\x04stop\x18\x07 \x01(\x0b\x32\x16.weaviate.v1.TextArrayH\x05\x88\x01\x01\x12\x18\n\x0btemperature\x18\x08 \x01(\x01H\x06\x88\x01\x01\x12\x12\n\x05top_p\x18\t \x01(\x01H\x07\x88\x01\x01\x12\x1a\n\rtop_log_probs\x18\n \x01(\x03H\x08\x88\x01\x01\x42\x14\n\x12_frequency_penaltyB\x0c\n\n_log_probsB\r\n\x0b_max_tokensB\x04\n\x02_nB\x13\n\x11_presence_penaltyB\x07\n\x05_stopB\x0e\n\x0c_temperatureB\x08\n\x06_top_pB\x10\n\x0e_top_log_probs"\xf0\x02\n\x10GenerativeGoogle\x12\x1e\n\x11\x66requency_penalty\x18\x01 \x01(\x01H\x00\x88\x01\x01\x12\x17\n\nmax_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x12\n\x05model\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x1d\n\x10presence_penalty\x18\x04 \x01(\x01H\x03\x88\x01\x01\x12\x18\n\x0btemperature\x18\x05 \x01(\x01H\x04\x88\x01\x01\x12\x12\n\x05top_k\x18\x06 \x01(\x03H\x05\x88\x01\x01\x12\x12\n\x05top_p\x18\x07 \x01(\x01H\x06\x88\x01\x01\x12\x33\n\x0estop_sequences\x18\x08 \x01(\x0b\x32\x16.weaviate.v1.TextArrayH\x07\x88\x01\x01\x42\x14\n\x12_frequency_penaltyB\r\n\x0b_max_tokensB\x08\n\x06_modelB\x13\n\x11_presence_penaltyB\x0e\n\x0c_temperatureB\x08\n\x06_top_kB\x08\n\x06_top_pB\x11\n\x0f_stop_sequences"\x92\x01\n\x1bGenerativeAnthropicMetadata\x12=\n\x05usage\x18\x01 \x01(\x0b\x32..weaviate.v1.GenerativeAnthropicMetadata.Usage\x1a\x34\n\x05Usage\x12\x14\n\x0cinput_tokens\x18\x01 \x01(\x03\x12\x15\n\routput_tokens\x18\x02 \x01(\x03"\x1c\n\x1aGenerativeAnyscaleMetadata"\x17\n\x15GenerativeAWSMetadata"\x9c\x06\n\x18GenerativeCohereMetadata\x12J\n\x0b\x61pi_version\x18\x01 \x01(\x0b\x32\x30.weaviate.v1.GenerativeCohereMetadata.ApiVersionH\x00\x88\x01\x01\x12L\n\x0c\x62illed_units\x18\x02 \x01(\x0b\x32\x31.weaviate.v1.GenerativeCohereMetadata.BilledUnitsH\x01\x88\x01\x01\x12\x41\n\x06tokens\x18\x03 \x01(\x0b\x32,.weaviate.v1.GenerativeCohereMetadata.TokensH\x02\x88\x01\x01\x12-\n\x08warnings\x18\x04 \x01(\x0b\x32\x16.weaviate.v1.TextArrayH\x03\x88\x01\x01\x1a\x8e\x01\n\nApiVersion\x12\x14\n\x07version\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\ris_deprecated\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x1c\n\x0fis_experimental\x18\x03 \x01(\x08H\x02\x88\x01\x01\x42\n\n\x08_versionB\x10\n\x0e_is_deprecatedB\x12\n\x10_is_experimental\x1a\xc5\x01\n\x0b\x42illedUnits\x12\x19\n\x0cinput_tokens\x18\x01 \x01(\x01H\x00\x88\x01\x01\x12\x1a\n\routput_tokens\x18\x02 \x01(\x01H\x01\x88\x01\x01\x12\x19\n\x0csearch_units\x18\x03 \x01(\x01H\x02\x88\x01\x01\x12\x1c\n\x0f\x63lassifications\x18\x04 \x01(\x01H\x03\x88\x01\x01\x42\x0f\n\r_input_tokensB\x10\n\x0e_output_tokensB\x0f\n\r_search_unitsB\x12\n\x10_classifications\x1a\x62\n\x06Tokens\x12\x19\n\x0cinput_tokens\x18\x01 \x01(\x01H\x00\x88\x01\x01\x12\x1a\n\routput_tokens\x18\x02 \x01(\x01H\x01\x88\x01\x01\x42\x0f\n\r_input_tokensB\x10\n\x0e_output_tokensB\x0e\n\x0c_api_versionB\x0f\n\r_billed_unitsB\t\n\x07_tokensB\x0b\n\t_warnings"\x19\n\x17GenerativeDummyMetadata"\x81\x02\n\x19GenerativeMistralMetadata\x12@\n\x05usage\x18\x01 \x01(\x0b\x32,.weaviate.v1.GenerativeMistralMetadata.UsageH\x00\x88\x01\x01\x1a\x97\x01\n\x05Usage\x12\x1a\n\rprompt_tokens\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12\x1e\n\x11\x63ompletion_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x19\n\x0ctotal_tokens\x18\x03 \x01(\x03H\x02\x88\x01\x01\x42\x10\n\x0e_prompt_tokensB\x14\n\x12_completion_tokensB\x0f\n\r_total_tokensB\x08\n\x06_usage"\xff\x01\n\x18GenerativeOctoAIMetadata\x12?\n\x05usage\x18\x01 \x01(\x0b\x32+.weaviate.v1.GenerativeOctoAIMetadata.UsageH\x00\x88\x01\x01\x1a\x97\x01\n\x05Usage\x12\x1a\n\rprompt_tokens\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12\x1e\n\x11\x63ompletion_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x19\n\x0ctotal_tokens\x18\x03 \x01(\x03H\x02\x88\x01\x01\x42\x10\n\x0e_prompt_tokensB\x14\n\x12_completion_tokensB\x0f\n\r_total_tokensB\x08\n\x06_usage"\x1a\n\x18GenerativeOllamaMetadata"\xff\x01\n\x18GenerativeOpenAIMetadata\x12?\n\x05usage\x18\x01 \x01(\x0b\x32+.weaviate.v1.GenerativeOpenAIMetadata.UsageH\x00\x88\x01\x01\x1a\x97\x01\n\x05Usage\x12\x1a\n\rprompt_tokens\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12\x1e\n\x11\x63ompletion_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x19\n\x0ctotal_tokens\x18\x03 \x01(\x03H\x02\x88\x01\x01\x42\x10\n\x0e_prompt_tokensB\x14\n\x12_completion_tokensB\x0f\n\r_total_tokensB\x08\n\x06_usage"\xe8\x06\n\x18GenerativeGoogleMetadata\x12\x45\n\x08metadata\x18\x01 \x01(\x0b\x32..weaviate.v1.GenerativeGoogleMetadata.MetadataH\x00\x88\x01\x01\x12P\n\x0eusage_metadata\x18\x02 \x01(\x0b\x32\x33.weaviate.v1.GenerativeGoogleMetadata.UsageMetadataH\x01\x88\x01\x01\x1a~\n\nTokenCount\x12&\n\x19total_billable_characters\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12\x19\n\x0ctotal_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x42\x1c\n\x1a_total_billable_charactersB\x0f\n\r_total_tokens\x1a\xe1\x01\n\rTokenMetadata\x12P\n\x11input_token_count\x18\x01 \x01(\x0b\x32\x30.weaviate.v1.GenerativeGoogleMetadata.TokenCountH\x00\x88\x01\x01\x12Q\n\x12output_token_count\x18\x02 \x01(\x0b\x32\x30.weaviate.v1.GenerativeGoogleMetadata.TokenCountH\x01\x88\x01\x01\x42\x14\n\x12_input_token_countB\x15\n\x13_output_token_count\x1ao\n\x08Metadata\x12P\n\x0etoken_metadata\x18\x01 \x01(\x0b\x32\x33.weaviate.v1.GenerativeGoogleMetadata.TokenMetadataH\x00\x88\x01\x01\x42\x11\n\x0f_token_metadata\x1a\xbd\x01\n\rUsageMetadata\x12\x1f\n\x12prompt_token_count\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12#\n\x16\x63\x61ndidates_token_count\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x1e\n\x11total_token_count\x18\x03 \x01(\x03H\x02\x88\x01\x01\x42\x15\n\x13_prompt_token_countB\x19\n\x17_candidates_token_countB\x14\n\x12_total_token_countB\x0b\n\t_metadataB\x11\n\x0f_usage_metadata"\xda\x04\n\x12GenerativeMetadata\x12=\n\tanthropic\x18\x01 \x01(\x0b\x32(.weaviate.v1.GenerativeAnthropicMetadataH\x00\x12;\n\x08\x61nyscale\x18\x02 \x01(\x0b\x32\'.weaviate.v1.GenerativeAnyscaleMetadataH\x00\x12\x31\n\x03\x61ws\x18\x03 \x01(\x0b\x32".weaviate.v1.GenerativeAWSMetadataH\x00\x12\x37\n\x06\x63ohere\x18\x04 \x01(\x0b\x32%.weaviate.v1.GenerativeCohereMetadataH\x00\x12\x35\n\x05\x64ummy\x18\x05 \x01(\x0b\x32$.weaviate.v1.GenerativeDummyMetadataH\x00\x12\x39\n\x07mistral\x18\x06 \x01(\x0b\x32&.weaviate.v1.GenerativeMistralMetadataH\x00\x12\x37\n\x06octoai\x18\x07 \x01(\x0b\x32%.weaviate.v1.GenerativeOctoAIMetadataH\x00\x12\x37\n\x06ollama\x18\x08 \x01(\x0b\x32%.weaviate.v1.GenerativeOllamaMetadataH\x00\x12\x37\n\x06openai\x18\t \x01(\x0b\x32%.weaviate.v1.GenerativeOpenAIMetadataH\x00\x12\x37\n\x06google\x18\n \x01(\x0b\x32%.weaviate.v1.GenerativeGoogleMetadataH\x00\x42\x06\n\x04kind"\xa2\x01\n\x0fGenerativeReply\x12\x0e\n\x06result\x18\x01 \x01(\t\x12\x30\n\x05\x64\x65\x62ug\x18\x02 \x01(\x0b\x32\x1c.weaviate.v1.GenerativeDebugH\x00\x88\x01\x01\x12\x36\n\x08metadata\x18\x03 \x01(\x0b\x32\x1f.weaviate.v1.GenerativeMetadataH\x01\x88\x01\x01\x42\x08\n\x06_debugB\x0b\n\t_metadata"@\n\x10GenerativeResult\x12,\n\x06values\x18\x01 \x03(\x0b\x32\x1c.weaviate.v1.GenerativeReply";\n\x0fGenerativeDebug\x12\x18\n\x0b\x66ull_prompt\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0e\n\x0c_full_promptBt\n#io.weaviate.client.grpc.protocol.v1B\x17WeaviateProtoGenerativeZ4github.com/weaviate/weaviate/grpc/generated;protocolb\x06proto3' + b'\n\x13v1/generative.proto\x12\x0bweaviate.v1\x1a\rv1/base.proto"\xce\x03\n\x10GenerativeSearch\x12"\n\x16single_response_prompt\x18\x01 \x01(\tB\x02\x18\x01\x12!\n\x15grouped_response_task\x18\x02 \x01(\tB\x02\x18\x01\x12\x1e\n\x12grouped_properties\x18\x03 \x03(\tB\x02\x18\x01\x12\x34\n\x06single\x18\x04 \x01(\x0b\x32$.weaviate.v1.GenerativeSearch.Single\x12\x36\n\x07grouped\x18\x05 \x01(\x0b\x32%.weaviate.v1.GenerativeSearch.Grouped\x1aY\n\x06Single\x12\x0e\n\x06prompt\x18\x01 \x01(\t\x12\r\n\x05\x64\x65\x62ug\x18\x02 \x01(\x08\x12\x30\n\x07queries\x18\x03 \x03(\x0b\x32\x1f.weaviate.v1.GenerativeProvider\x1a\x89\x01\n\x07Grouped\x12\x0c\n\x04task\x18\x01 \x01(\t\x12/\n\nproperties\x18\x02 \x01(\x0b\x32\x16.weaviate.v1.TextArrayH\x00\x88\x01\x01\x12\x30\n\x07queries\x18\x03 \x03(\x0b\x32\x1f.weaviate.v1.GenerativeProviderB\r\n\x0b_properties"\xe4\x04\n\x12GenerativeProvider\x12\x17\n\x0freturn_metadata\x18\x01 \x01(\x08\x12\x35\n\tanthropic\x18\x02 \x01(\x0b\x32 .weaviate.v1.GenerativeAnthropicH\x00\x12\x33\n\x08\x61nyscale\x18\x03 \x01(\x0b\x32\x1f.weaviate.v1.GenerativeAnyscaleH\x00\x12)\n\x03\x61ws\x18\x04 \x01(\x0b\x32\x1a.weaviate.v1.GenerativeAWSH\x00\x12/\n\x06\x63ohere\x18\x05 \x01(\x0b\x32\x1d.weaviate.v1.GenerativeCohereH\x00\x12-\n\x05\x64ummy\x18\x06 \x01(\x0b\x32\x1c.weaviate.v1.GenerativeDummyH\x00\x12\x31\n\x07mistral\x18\x07 \x01(\x0b\x32\x1e.weaviate.v1.GenerativeMistralH\x00\x12/\n\x06ollama\x18\x08 \x01(\x0b\x32\x1d.weaviate.v1.GenerativeOllamaH\x00\x12/\n\x06openai\x18\t \x01(\x0b\x32\x1d.weaviate.v1.GenerativeOpenAIH\x00\x12/\n\x06google\x18\n \x01(\x0b\x32\x1d.weaviate.v1.GenerativeGoogleH\x00\x12\x37\n\ndatabricks\x18\x0b \x01(\x0b\x32!.weaviate.v1.GenerativeDatabricksH\x00\x12\x37\n\nfriendliai\x18\x0c \x01(\x0b\x32!.weaviate.v1.GenerativeFriendliAIH\x00\x42\x06\n\x04kind"\xad\x02\n\x13GenerativeAnthropic\x12\x15\n\x08\x62\x61se_url\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x17\n\nmax_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x12\n\x05model\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x18\n\x0btemperature\x18\x04 \x01(\x01H\x03\x88\x01\x01\x12\x12\n\x05top_k\x18\x05 \x01(\x03H\x04\x88\x01\x01\x12\x12\n\x05top_p\x18\x06 \x01(\x01H\x05\x88\x01\x01\x12\x33\n\x0estop_sequences\x18\x07 \x01(\x0b\x32\x16.weaviate.v1.TextArrayH\x06\x88\x01\x01\x42\x0b\n\t_base_urlB\r\n\x0b_max_tokensB\x08\n\x06_modelB\x0e\n\x0c_temperatureB\x08\n\x06_top_kB\x08\n\x06_top_pB\x11\n\x0f_stop_sequences"\x80\x01\n\x12GenerativeAnyscale\x12\x15\n\x08\x62\x61se_url\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x12\n\x05model\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0btemperature\x18\x03 \x01(\x01H\x02\x88\x01\x01\x42\x0b\n\t_base_urlB\x08\n\x06_modelB\x0e\n\x0c_temperature"\x99\x02\n\rGenerativeAWS\x12\x12\n\x05model\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0btemperature\x18\x08 \x01(\x01H\x01\x88\x01\x01\x12\x14\n\x07service\x18\t \x01(\tH\x02\x88\x01\x01\x12\x13\n\x06region\x18\n \x01(\tH\x03\x88\x01\x01\x12\x15\n\x08\x65ndpoint\x18\x0b \x01(\tH\x04\x88\x01\x01\x12\x19\n\x0ctarget_model\x18\x0c \x01(\tH\x05\x88\x01\x01\x12\x1b\n\x0etarget_variant\x18\r \x01(\tH\x06\x88\x01\x01\x42\x08\n\x06_modelB\x0e\n\x0c_temperatureB\n\n\x08_serviceB\t\n\x07_regionB\x0b\n\t_endpointB\x0f\n\r_target_modelB\x11\n\x0f_target_variant"\x84\x03\n\x10GenerativeCohere\x12\x15\n\x08\x62\x61se_url\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11\x66requency_penalty\x18\x02 \x01(\x01H\x01\x88\x01\x01\x12\x17\n\nmax_tokens\x18\x03 \x01(\x03H\x02\x88\x01\x01\x12\x12\n\x05model\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x0e\n\x01k\x18\x05 \x01(\x03H\x04\x88\x01\x01\x12\x0e\n\x01p\x18\x06 \x01(\x01H\x05\x88\x01\x01\x12\x1d\n\x10presence_penalty\x18\x07 \x01(\x01H\x06\x88\x01\x01\x12\x33\n\x0estop_sequences\x18\x08 \x01(\x0b\x32\x16.weaviate.v1.TextArrayH\x07\x88\x01\x01\x12\x18\n\x0btemperature\x18\t \x01(\x01H\x08\x88\x01\x01\x42\x0b\n\t_base_urlB\x14\n\x12_frequency_penaltyB\r\n\x0b_max_tokensB\x08\n\x06_modelB\x04\n\x02_kB\x04\n\x02_pB\x13\n\x11_presence_penaltyB\x11\n\x0f_stop_sequencesB\x0e\n\x0c_temperature"\x11\n\x0fGenerativeDummy"\xc5\x01\n\x11GenerativeMistral\x12\x15\n\x08\x62\x61se_url\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x17\n\nmax_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x12\n\x05model\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x18\n\x0btemperature\x18\x04 \x01(\x01H\x03\x88\x01\x01\x12\x12\n\x05top_p\x18\x05 \x01(\x01H\x04\x88\x01\x01\x42\x0b\n\t_base_urlB\r\n\x0b_max_tokensB\x08\n\x06_modelB\x0e\n\x0c_temperatureB\x08\n\x06_top_p"\x86\x01\n\x10GenerativeOllama\x12\x19\n\x0c\x61pi_endpoint\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x12\n\x05model\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0btemperature\x18\x03 \x01(\x01H\x02\x88\x01\x01\x42\x0f\n\r_api_endpointB\x08\n\x06_modelB\x0e\n\x0c_temperature"\x93\x04\n\x10GenerativeOpenAI\x12\x1e\n\x11\x66requency_penalty\x18\x01 \x01(\x01H\x00\x88\x01\x01\x12\x17\n\nmax_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\r\n\x05model\x18\x03 \x01(\t\x12\x0e\n\x01n\x18\x04 \x01(\x03H\x02\x88\x01\x01\x12\x1d\n\x10presence_penalty\x18\x05 \x01(\x01H\x03\x88\x01\x01\x12)\n\x04stop\x18\x06 \x01(\x0b\x32\x16.weaviate.v1.TextArrayH\x04\x88\x01\x01\x12\x18\n\x0btemperature\x18\x07 \x01(\x01H\x05\x88\x01\x01\x12\x12\n\x05top_p\x18\x08 \x01(\x01H\x06\x88\x01\x01\x12\x15\n\x08\x62\x61se_url\x18\t \x01(\tH\x07\x88\x01\x01\x12\x18\n\x0b\x61pi_version\x18\n \x01(\tH\x08\x88\x01\x01\x12\x1a\n\rresource_name\x18\x0b \x01(\tH\t\x88\x01\x01\x12\x1a\n\rdeployment_id\x18\x0c \x01(\tH\n\x88\x01\x01\x12\x15\n\x08is_azure\x18\r \x01(\x08H\x0b\x88\x01\x01\x42\x14\n\x12_frequency_penaltyB\r\n\x0b_max_tokensB\x04\n\x02_nB\x13\n\x11_presence_penaltyB\x07\n\x05_stopB\x0e\n\x0c_temperatureB\x08\n\x06_top_pB\x0b\n\t_base_urlB\x0e\n\x0c_api_versionB\x10\n\x0e_resource_nameB\x10\n\x0e_deployment_idB\x0b\n\t_is_azure"\x8e\x04\n\x10GenerativeGoogle\x12\x1e\n\x11\x66requency_penalty\x18\x01 \x01(\x01H\x00\x88\x01\x01\x12\x17\n\nmax_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x12\n\x05model\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x1d\n\x10presence_penalty\x18\x04 \x01(\x01H\x03\x88\x01\x01\x12\x18\n\x0btemperature\x18\x05 \x01(\x01H\x04\x88\x01\x01\x12\x12\n\x05top_k\x18\x06 \x01(\x03H\x05\x88\x01\x01\x12\x12\n\x05top_p\x18\x07 \x01(\x01H\x06\x88\x01\x01\x12\x33\n\x0estop_sequences\x18\x08 \x01(\x0b\x32\x16.weaviate.v1.TextArrayH\x07\x88\x01\x01\x12\x19\n\x0c\x61pi_endpoint\x18\t \x01(\tH\x08\x88\x01\x01\x12\x17\n\nproject_id\x18\n \x01(\tH\t\x88\x01\x01\x12\x18\n\x0b\x65ndpoint_id\x18\x0b \x01(\tH\n\x88\x01\x01\x12\x13\n\x06region\x18\x0c \x01(\tH\x0b\x88\x01\x01\x42\x14\n\x12_frequency_penaltyB\r\n\x0b_max_tokensB\x08\n\x06_modelB\x13\n\x11_presence_penaltyB\x0e\n\x0c_temperatureB\x08\n\x06_top_kB\x08\n\x06_top_pB\x11\n\x0f_stop_sequencesB\x0f\n\r_api_endpointB\r\n\x0b_project_idB\x0e\n\x0c_endpoint_idB\t\n\x07_region"\xd0\x03\n\x14GenerativeDatabricks\x12\x15\n\x08\x65ndpoint\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x12\n\x05model\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1e\n\x11\x66requency_penalty\x18\x03 \x01(\x01H\x02\x88\x01\x01\x12\x16\n\tlog_probs\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x1a\n\rtop_log_probs\x18\x05 \x01(\x03H\x04\x88\x01\x01\x12\x17\n\nmax_tokens\x18\x06 \x01(\x03H\x05\x88\x01\x01\x12\x0e\n\x01n\x18\x07 \x01(\x03H\x06\x88\x01\x01\x12\x1d\n\x10presence_penalty\x18\x08 \x01(\x01H\x07\x88\x01\x01\x12)\n\x04stop\x18\t \x01(\x0b\x32\x16.weaviate.v1.TextArrayH\x08\x88\x01\x01\x12\x18\n\x0btemperature\x18\n \x01(\x01H\t\x88\x01\x01\x12\x12\n\x05top_p\x18\x0b \x01(\x01H\n\x88\x01\x01\x42\x0b\n\t_endpointB\x08\n\x06_modelB\x14\n\x12_frequency_penaltyB\x0c\n\n_log_probsB\x10\n\x0e_top_log_probsB\r\n\x0b_max_tokensB\x04\n\x02_nB\x13\n\x11_presence_penaltyB\x07\n\x05_stopB\x0e\n\x0c_temperatureB\x08\n\x06_top_p"\xde\x01\n\x14GenerativeFriendliAI\x12\x15\n\x08\x62\x61se_url\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x12\n\x05model\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x17\n\nmax_tokens\x18\x03 \x01(\x03H\x02\x88\x01\x01\x12\x18\n\x0btemperature\x18\x04 \x01(\x01H\x03\x88\x01\x01\x12\x0e\n\x01n\x18\x05 \x01(\x03H\x04\x88\x01\x01\x12\x12\n\x05top_p\x18\x06 \x01(\x01H\x05\x88\x01\x01\x42\x0b\n\t_base_urlB\x08\n\x06_modelB\r\n\x0b_max_tokensB\x0e\n\x0c_temperatureB\x04\n\x02_nB\x08\n\x06_top_p"\x92\x01\n\x1bGenerativeAnthropicMetadata\x12=\n\x05usage\x18\x01 \x01(\x0b\x32..weaviate.v1.GenerativeAnthropicMetadata.Usage\x1a\x34\n\x05Usage\x12\x14\n\x0cinput_tokens\x18\x01 \x01(\x03\x12\x15\n\routput_tokens\x18\x02 \x01(\x03"\x1c\n\x1aGenerativeAnyscaleMetadata"\x17\n\x15GenerativeAWSMetadata"\x9c\x06\n\x18GenerativeCohereMetadata\x12J\n\x0b\x61pi_version\x18\x01 \x01(\x0b\x32\x30.weaviate.v1.GenerativeCohereMetadata.ApiVersionH\x00\x88\x01\x01\x12L\n\x0c\x62illed_units\x18\x02 \x01(\x0b\x32\x31.weaviate.v1.GenerativeCohereMetadata.BilledUnitsH\x01\x88\x01\x01\x12\x41\n\x06tokens\x18\x03 \x01(\x0b\x32,.weaviate.v1.GenerativeCohereMetadata.TokensH\x02\x88\x01\x01\x12-\n\x08warnings\x18\x04 \x01(\x0b\x32\x16.weaviate.v1.TextArrayH\x03\x88\x01\x01\x1a\x8e\x01\n\nApiVersion\x12\x14\n\x07version\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\ris_deprecated\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x1c\n\x0fis_experimental\x18\x03 \x01(\x08H\x02\x88\x01\x01\x42\n\n\x08_versionB\x10\n\x0e_is_deprecatedB\x12\n\x10_is_experimental\x1a\xc5\x01\n\x0b\x42illedUnits\x12\x19\n\x0cinput_tokens\x18\x01 \x01(\x01H\x00\x88\x01\x01\x12\x1a\n\routput_tokens\x18\x02 \x01(\x01H\x01\x88\x01\x01\x12\x19\n\x0csearch_units\x18\x03 \x01(\x01H\x02\x88\x01\x01\x12\x1c\n\x0f\x63lassifications\x18\x04 \x01(\x01H\x03\x88\x01\x01\x42\x0f\n\r_input_tokensB\x10\n\x0e_output_tokensB\x0f\n\r_search_unitsB\x12\n\x10_classifications\x1a\x62\n\x06Tokens\x12\x19\n\x0cinput_tokens\x18\x01 \x01(\x01H\x00\x88\x01\x01\x12\x1a\n\routput_tokens\x18\x02 \x01(\x01H\x01\x88\x01\x01\x42\x0f\n\r_input_tokensB\x10\n\x0e_output_tokensB\x0e\n\x0c_api_versionB\x0f\n\r_billed_unitsB\t\n\x07_tokensB\x0b\n\t_warnings"\x19\n\x17GenerativeDummyMetadata"\x81\x02\n\x19GenerativeMistralMetadata\x12@\n\x05usage\x18\x01 \x01(\x0b\x32,.weaviate.v1.GenerativeMistralMetadata.UsageH\x00\x88\x01\x01\x1a\x97\x01\n\x05Usage\x12\x1a\n\rprompt_tokens\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12\x1e\n\x11\x63ompletion_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x19\n\x0ctotal_tokens\x18\x03 \x01(\x03H\x02\x88\x01\x01\x42\x10\n\x0e_prompt_tokensB\x14\n\x12_completion_tokensB\x0f\n\r_total_tokensB\x08\n\x06_usage"\x1a\n\x18GenerativeOllamaMetadata"\xff\x01\n\x18GenerativeOpenAIMetadata\x12?\n\x05usage\x18\x01 \x01(\x0b\x32+.weaviate.v1.GenerativeOpenAIMetadata.UsageH\x00\x88\x01\x01\x1a\x97\x01\n\x05Usage\x12\x1a\n\rprompt_tokens\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12\x1e\n\x11\x63ompletion_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x19\n\x0ctotal_tokens\x18\x03 \x01(\x03H\x02\x88\x01\x01\x42\x10\n\x0e_prompt_tokensB\x14\n\x12_completion_tokensB\x0f\n\r_total_tokensB\x08\n\x06_usage"\xe8\x06\n\x18GenerativeGoogleMetadata\x12\x45\n\x08metadata\x18\x01 \x01(\x0b\x32..weaviate.v1.GenerativeGoogleMetadata.MetadataH\x00\x88\x01\x01\x12P\n\x0eusage_metadata\x18\x02 \x01(\x0b\x32\x33.weaviate.v1.GenerativeGoogleMetadata.UsageMetadataH\x01\x88\x01\x01\x1a~\n\nTokenCount\x12&\n\x19total_billable_characters\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12\x19\n\x0ctotal_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x42\x1c\n\x1a_total_billable_charactersB\x0f\n\r_total_tokens\x1a\xe1\x01\n\rTokenMetadata\x12P\n\x11input_token_count\x18\x01 \x01(\x0b\x32\x30.weaviate.v1.GenerativeGoogleMetadata.TokenCountH\x00\x88\x01\x01\x12Q\n\x12output_token_count\x18\x02 \x01(\x0b\x32\x30.weaviate.v1.GenerativeGoogleMetadata.TokenCountH\x01\x88\x01\x01\x42\x14\n\x12_input_token_countB\x15\n\x13_output_token_count\x1ao\n\x08Metadata\x12P\n\x0etoken_metadata\x18\x01 \x01(\x0b\x32\x33.weaviate.v1.GenerativeGoogleMetadata.TokenMetadataH\x00\x88\x01\x01\x42\x11\n\x0f_token_metadata\x1a\xbd\x01\n\rUsageMetadata\x12\x1f\n\x12prompt_token_count\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12#\n\x16\x63\x61ndidates_token_count\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x1e\n\x11total_token_count\x18\x03 \x01(\x03H\x02\x88\x01\x01\x42\x15\n\x13_prompt_token_countB\x19\n\x17_candidates_token_countB\x14\n\x12_total_token_countB\x0b\n\t_metadataB\x11\n\x0f_usage_metadata"\x87\x02\n\x1cGenerativeDatabricksMetadata\x12\x43\n\x05usage\x18\x01 \x01(\x0b\x32/.weaviate.v1.GenerativeDatabricksMetadata.UsageH\x00\x88\x01\x01\x1a\x97\x01\n\x05Usage\x12\x1a\n\rprompt_tokens\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12\x1e\n\x11\x63ompletion_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x19\n\x0ctotal_tokens\x18\x03 \x01(\x03H\x02\x88\x01\x01\x42\x10\n\x0e_prompt_tokensB\x14\n\x12_completion_tokensB\x0f\n\r_total_tokensB\x08\n\x06_usage"\x87\x02\n\x1cGenerativeFriendliAIMetadata\x12\x43\n\x05usage\x18\x01 \x01(\x0b\x32/.weaviate.v1.GenerativeFriendliAIMetadata.UsageH\x00\x88\x01\x01\x1a\x97\x01\n\x05Usage\x12\x1a\n\rprompt_tokens\x18\x01 \x01(\x03H\x00\x88\x01\x01\x12\x1e\n\x11\x63ompletion_tokens\x18\x02 \x01(\x03H\x01\x88\x01\x01\x12\x19\n\x0ctotal_tokens\x18\x03 \x01(\x03H\x02\x88\x01\x01\x42\x10\n\x0e_prompt_tokensB\x14\n\x12_completion_tokensB\x0f\n\r_total_tokensB\x08\n\x06_usage"\xa3\x05\n\x12GenerativeMetadata\x12=\n\tanthropic\x18\x01 \x01(\x0b\x32(.weaviate.v1.GenerativeAnthropicMetadataH\x00\x12;\n\x08\x61nyscale\x18\x02 \x01(\x0b\x32\'.weaviate.v1.GenerativeAnyscaleMetadataH\x00\x12\x31\n\x03\x61ws\x18\x03 \x01(\x0b\x32".weaviate.v1.GenerativeAWSMetadataH\x00\x12\x37\n\x06\x63ohere\x18\x04 \x01(\x0b\x32%.weaviate.v1.GenerativeCohereMetadataH\x00\x12\x35\n\x05\x64ummy\x18\x05 \x01(\x0b\x32$.weaviate.v1.GenerativeDummyMetadataH\x00\x12\x39\n\x07mistral\x18\x06 \x01(\x0b\x32&.weaviate.v1.GenerativeMistralMetadataH\x00\x12\x37\n\x06ollama\x18\x07 \x01(\x0b\x32%.weaviate.v1.GenerativeOllamaMetadataH\x00\x12\x37\n\x06openai\x18\x08 \x01(\x0b\x32%.weaviate.v1.GenerativeOpenAIMetadataH\x00\x12\x37\n\x06google\x18\t \x01(\x0b\x32%.weaviate.v1.GenerativeGoogleMetadataH\x00\x12?\n\ndatabricks\x18\n \x01(\x0b\x32).weaviate.v1.GenerativeDatabricksMetadataH\x00\x12?\n\nfriendliai\x18\x0b \x01(\x0b\x32).weaviate.v1.GenerativeFriendliAIMetadataH\x00\x42\x06\n\x04kind"\xa2\x01\n\x0fGenerativeReply\x12\x0e\n\x06result\x18\x01 \x01(\t\x12\x30\n\x05\x64\x65\x62ug\x18\x02 \x01(\x0b\x32\x1c.weaviate.v1.GenerativeDebugH\x00\x88\x01\x01\x12\x36\n\x08metadata\x18\x03 \x01(\x0b\x32\x1f.weaviate.v1.GenerativeMetadataH\x01\x88\x01\x01\x42\x08\n\x06_debugB\x0b\n\t_metadata"@\n\x10GenerativeResult\x12,\n\x06values\x18\x01 \x03(\x0b\x32\x1c.weaviate.v1.GenerativeReply";\n\x0fGenerativeDebug\x12\x18\n\x0b\x66ull_prompt\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0e\n\x0c_full_promptBt\n#io.weaviate.client.grpc.protocol.v1B\x17WeaviateProtoGenerativeZ4github.com/weaviate/weaviate/grpc/generated;protocolb\x06proto3' ) _globals = globals() @@ -41,81 +41,87 @@ "grouped_properties" ]._serialized_options = b"\030\001" _globals["_GENERATIVESEARCH"]._serialized_start = 52 - _globals["_GENERATIVESEARCH"]._serialized_end = 463 + _globals["_GENERATIVESEARCH"]._serialized_end = 514 _globals["_GENERATIVESEARCH_SINGLE"]._serialized_start = 285 _globals["_GENERATIVESEARCH_SINGLE"]._serialized_end = 374 - _globals["_GENERATIVESEARCH_GROUPED"]._serialized_start = 376 - _globals["_GENERATIVESEARCH_GROUPED"]._serialized_end = 463 - _globals["_GENERATIVEPROVIDER"]._serialized_start = 466 - _globals["_GENERATIVEPROVIDER"]._serialized_end = 1013 - _globals["_GENERATIVEANTHROPIC"]._serialized_start = 1016 - _globals["_GENERATIVEANTHROPIC"]._serialized_end = 1317 - _globals["_GENERATIVEANYSCALE"]._serialized_start = 1320 - _globals["_GENERATIVEANYSCALE"]._serialized_end = 1448 - _globals["_GENERATIVEAWS"]._serialized_start = 1450 - _globals["_GENERATIVEAWS"]._serialized_end = 1537 - _globals["_GENERATIVECOHERE"]._serialized_start = 1540 - _globals["_GENERATIVECOHERE"]._serialized_end = 1928 - _globals["_GENERATIVEDUMMY"]._serialized_start = 1930 - _globals["_GENERATIVEDUMMY"]._serialized_end = 1947 - _globals["_GENERATIVEMISTRAL"]._serialized_start = 1950 - _globals["_GENERATIVEMISTRAL"]._serialized_end = 2147 - _globals["_GENERATIVEOCTOAI"]._serialized_start = 2150 - _globals["_GENERATIVEOCTOAI"]._serialized_end = 2368 - _globals["_GENERATIVEOLLAMA"]._serialized_start = 2371 - _globals["_GENERATIVEOLLAMA"]._serialized_end = 2505 - _globals["_GENERATIVEOPENAI"]._serialized_start = 2508 - _globals["_GENERATIVEOPENAI"]._serialized_end = 2917 - _globals["_GENERATIVEGOOGLE"]._serialized_start = 2920 - _globals["_GENERATIVEGOOGLE"]._serialized_end = 3288 - _globals["_GENERATIVEANTHROPICMETADATA"]._serialized_start = 3291 - _globals["_GENERATIVEANTHROPICMETADATA"]._serialized_end = 3437 - _globals["_GENERATIVEANTHROPICMETADATA_USAGE"]._serialized_start = 3385 - _globals["_GENERATIVEANTHROPICMETADATA_USAGE"]._serialized_end = 3437 - _globals["_GENERATIVEANYSCALEMETADATA"]._serialized_start = 3439 - _globals["_GENERATIVEANYSCALEMETADATA"]._serialized_end = 3467 - _globals["_GENERATIVEAWSMETADATA"]._serialized_start = 3469 - _globals["_GENERATIVEAWSMETADATA"]._serialized_end = 3492 - _globals["_GENERATIVECOHEREMETADATA"]._serialized_start = 3495 - _globals["_GENERATIVECOHEREMETADATA"]._serialized_end = 4291 - _globals["_GENERATIVECOHEREMETADATA_APIVERSION"]._serialized_start = 3792 - _globals["_GENERATIVECOHEREMETADATA_APIVERSION"]._serialized_end = 3934 - _globals["_GENERATIVECOHEREMETADATA_BILLEDUNITS"]._serialized_start = 3937 - _globals["_GENERATIVECOHEREMETADATA_BILLEDUNITS"]._serialized_end = 4134 - _globals["_GENERATIVECOHEREMETADATA_TOKENS"]._serialized_start = 4136 - _globals["_GENERATIVECOHEREMETADATA_TOKENS"]._serialized_end = 4234 - _globals["_GENERATIVEDUMMYMETADATA"]._serialized_start = 4293 - _globals["_GENERATIVEDUMMYMETADATA"]._serialized_end = 4318 - _globals["_GENERATIVEMISTRALMETADATA"]._serialized_start = 4321 - _globals["_GENERATIVEMISTRALMETADATA"]._serialized_end = 4578 - _globals["_GENERATIVEMISTRALMETADATA_USAGE"]._serialized_start = 4417 - _globals["_GENERATIVEMISTRALMETADATA_USAGE"]._serialized_end = 4568 - _globals["_GENERATIVEOCTOAIMETADATA"]._serialized_start = 4581 - _globals["_GENERATIVEOCTOAIMETADATA"]._serialized_end = 4836 - _globals["_GENERATIVEOCTOAIMETADATA_USAGE"]._serialized_start = 4417 - _globals["_GENERATIVEOCTOAIMETADATA_USAGE"]._serialized_end = 4568 - _globals["_GENERATIVEOLLAMAMETADATA"]._serialized_start = 4838 - _globals["_GENERATIVEOLLAMAMETADATA"]._serialized_end = 4864 - _globals["_GENERATIVEOPENAIMETADATA"]._serialized_start = 4867 - _globals["_GENERATIVEOPENAIMETADATA"]._serialized_end = 5122 - _globals["_GENERATIVEOPENAIMETADATA_USAGE"]._serialized_start = 4417 - _globals["_GENERATIVEOPENAIMETADATA_USAGE"]._serialized_end = 4568 - _globals["_GENERATIVEGOOGLEMETADATA"]._serialized_start = 5125 - _globals["_GENERATIVEGOOGLEMETADATA"]._serialized_end = 5997 - _globals["_GENERATIVEGOOGLEMETADATA_TOKENCOUNT"]._serialized_start = 5306 - _globals["_GENERATIVEGOOGLEMETADATA_TOKENCOUNT"]._serialized_end = 5432 - _globals["_GENERATIVEGOOGLEMETADATA_TOKENMETADATA"]._serialized_start = 5435 - _globals["_GENERATIVEGOOGLEMETADATA_TOKENMETADATA"]._serialized_end = 5660 - _globals["_GENERATIVEGOOGLEMETADATA_METADATA"]._serialized_start = 5662 - _globals["_GENERATIVEGOOGLEMETADATA_METADATA"]._serialized_end = 5773 - _globals["_GENERATIVEGOOGLEMETADATA_USAGEMETADATA"]._serialized_start = 5776 - _globals["_GENERATIVEGOOGLEMETADATA_USAGEMETADATA"]._serialized_end = 5965 - _globals["_GENERATIVEMETADATA"]._serialized_start = 6000 - _globals["_GENERATIVEMETADATA"]._serialized_end = 6602 - _globals["_GENERATIVEREPLY"]._serialized_start = 6605 - _globals["_GENERATIVEREPLY"]._serialized_end = 6767 - _globals["_GENERATIVERESULT"]._serialized_start = 6769 - _globals["_GENERATIVERESULT"]._serialized_end = 6833 - _globals["_GENERATIVEDEBUG"]._serialized_start = 6835 - _globals["_GENERATIVEDEBUG"]._serialized_end = 6894 + _globals["_GENERATIVESEARCH_GROUPED"]._serialized_start = 377 + _globals["_GENERATIVESEARCH_GROUPED"]._serialized_end = 514 + _globals["_GENERATIVEPROVIDER"]._serialized_start = 517 + _globals["_GENERATIVEPROVIDER"]._serialized_end = 1129 + _globals["_GENERATIVEANTHROPIC"]._serialized_start = 1132 + _globals["_GENERATIVEANTHROPIC"]._serialized_end = 1433 + _globals["_GENERATIVEANYSCALE"]._serialized_start = 1436 + _globals["_GENERATIVEANYSCALE"]._serialized_end = 1564 + _globals["_GENERATIVEAWS"]._serialized_start = 1567 + _globals["_GENERATIVEAWS"]._serialized_end = 1848 + _globals["_GENERATIVECOHERE"]._serialized_start = 1851 + _globals["_GENERATIVECOHERE"]._serialized_end = 2239 + _globals["_GENERATIVEDUMMY"]._serialized_start = 2241 + _globals["_GENERATIVEDUMMY"]._serialized_end = 2258 + _globals["_GENERATIVEMISTRAL"]._serialized_start = 2261 + _globals["_GENERATIVEMISTRAL"]._serialized_end = 2458 + _globals["_GENERATIVEOLLAMA"]._serialized_start = 2461 + _globals["_GENERATIVEOLLAMA"]._serialized_end = 2595 + _globals["_GENERATIVEOPENAI"]._serialized_start = 2598 + _globals["_GENERATIVEOPENAI"]._serialized_end = 3129 + _globals["_GENERATIVEGOOGLE"]._serialized_start = 3132 + _globals["_GENERATIVEGOOGLE"]._serialized_end = 3658 + _globals["_GENERATIVEDATABRICKS"]._serialized_start = 3661 + _globals["_GENERATIVEDATABRICKS"]._serialized_end = 4125 + _globals["_GENERATIVEFRIENDLIAI"]._serialized_start = 4128 + _globals["_GENERATIVEFRIENDLIAI"]._serialized_end = 4350 + _globals["_GENERATIVEANTHROPICMETADATA"]._serialized_start = 4353 + _globals["_GENERATIVEANTHROPICMETADATA"]._serialized_end = 4499 + _globals["_GENERATIVEANTHROPICMETADATA_USAGE"]._serialized_start = 4447 + _globals["_GENERATIVEANTHROPICMETADATA_USAGE"]._serialized_end = 4499 + _globals["_GENERATIVEANYSCALEMETADATA"]._serialized_start = 4501 + _globals["_GENERATIVEANYSCALEMETADATA"]._serialized_end = 4529 + _globals["_GENERATIVEAWSMETADATA"]._serialized_start = 4531 + _globals["_GENERATIVEAWSMETADATA"]._serialized_end = 4554 + _globals["_GENERATIVECOHEREMETADATA"]._serialized_start = 4557 + _globals["_GENERATIVECOHEREMETADATA"]._serialized_end = 5353 + _globals["_GENERATIVECOHEREMETADATA_APIVERSION"]._serialized_start = 4854 + _globals["_GENERATIVECOHEREMETADATA_APIVERSION"]._serialized_end = 4996 + _globals["_GENERATIVECOHEREMETADATA_BILLEDUNITS"]._serialized_start = 4999 + _globals["_GENERATIVECOHEREMETADATA_BILLEDUNITS"]._serialized_end = 5196 + _globals["_GENERATIVECOHEREMETADATA_TOKENS"]._serialized_start = 5198 + _globals["_GENERATIVECOHEREMETADATA_TOKENS"]._serialized_end = 5296 + _globals["_GENERATIVEDUMMYMETADATA"]._serialized_start = 5355 + _globals["_GENERATIVEDUMMYMETADATA"]._serialized_end = 5380 + _globals["_GENERATIVEMISTRALMETADATA"]._serialized_start = 5383 + _globals["_GENERATIVEMISTRALMETADATA"]._serialized_end = 5640 + _globals["_GENERATIVEMISTRALMETADATA_USAGE"]._serialized_start = 5479 + _globals["_GENERATIVEMISTRALMETADATA_USAGE"]._serialized_end = 5630 + _globals["_GENERATIVEOLLAMAMETADATA"]._serialized_start = 5642 + _globals["_GENERATIVEOLLAMAMETADATA"]._serialized_end = 5668 + _globals["_GENERATIVEOPENAIMETADATA"]._serialized_start = 5671 + _globals["_GENERATIVEOPENAIMETADATA"]._serialized_end = 5926 + _globals["_GENERATIVEOPENAIMETADATA_USAGE"]._serialized_start = 5479 + _globals["_GENERATIVEOPENAIMETADATA_USAGE"]._serialized_end = 5630 + _globals["_GENERATIVEGOOGLEMETADATA"]._serialized_start = 5929 + _globals["_GENERATIVEGOOGLEMETADATA"]._serialized_end = 6801 + _globals["_GENERATIVEGOOGLEMETADATA_TOKENCOUNT"]._serialized_start = 6110 + _globals["_GENERATIVEGOOGLEMETADATA_TOKENCOUNT"]._serialized_end = 6236 + _globals["_GENERATIVEGOOGLEMETADATA_TOKENMETADATA"]._serialized_start = 6239 + _globals["_GENERATIVEGOOGLEMETADATA_TOKENMETADATA"]._serialized_end = 6464 + _globals["_GENERATIVEGOOGLEMETADATA_METADATA"]._serialized_start = 6466 + _globals["_GENERATIVEGOOGLEMETADATA_METADATA"]._serialized_end = 6577 + _globals["_GENERATIVEGOOGLEMETADATA_USAGEMETADATA"]._serialized_start = 6580 + _globals["_GENERATIVEGOOGLEMETADATA_USAGEMETADATA"]._serialized_end = 6769 + _globals["_GENERATIVEDATABRICKSMETADATA"]._serialized_start = 6804 + _globals["_GENERATIVEDATABRICKSMETADATA"]._serialized_end = 7067 + _globals["_GENERATIVEDATABRICKSMETADATA_USAGE"]._serialized_start = 5479 + _globals["_GENERATIVEDATABRICKSMETADATA_USAGE"]._serialized_end = 5630 + _globals["_GENERATIVEFRIENDLIAIMETADATA"]._serialized_start = 7070 + _globals["_GENERATIVEFRIENDLIAIMETADATA"]._serialized_end = 7333 + _globals["_GENERATIVEFRIENDLIAIMETADATA_USAGE"]._serialized_start = 5479 + _globals["_GENERATIVEFRIENDLIAIMETADATA_USAGE"]._serialized_end = 5630 + _globals["_GENERATIVEMETADATA"]._serialized_start = 7336 + _globals["_GENERATIVEMETADATA"]._serialized_end = 8011 + _globals["_GENERATIVEREPLY"]._serialized_start = 8014 + _globals["_GENERATIVEREPLY"]._serialized_end = 8176 + _globals["_GENERATIVERESULT"]._serialized_start = 8178 + _globals["_GENERATIVERESULT"]._serialized_end = 8242 + _globals["_GENERATIVEDEBUG"]._serialized_start = 8244 + _globals["_GENERATIVEDEBUG"]._serialized_end = 8303 # @@protoc_insertion_point(module_scope) diff --git a/weaviate/proto/v1/generative_pb2.pyi b/weaviate/proto/v1/generative_pb2.pyi index 63c34a58f..c1b936005 100644 --- a/weaviate/proto/v1/generative_pb2.pyi +++ b/weaviate/proto/v1/generative_pb2.pyi @@ -37,15 +37,18 @@ class GenerativeSearch(_message.Message): ) -> None: ... class Grouped(_message.Message): - __slots__ = ("task", "properties") + __slots__ = ("task", "properties", "queries") TASK_FIELD_NUMBER: _ClassVar[int] PROPERTIES_FIELD_NUMBER: _ClassVar[int] + QUERIES_FIELD_NUMBER: _ClassVar[int] task: str properties: _base_pb2.TextArray + queries: _containers.RepeatedCompositeFieldContainer[GenerativeProvider] def __init__( self, task: _Optional[str] = ..., properties: _Optional[_Union[_base_pb2.TextArray, _Mapping]] = ..., + queries: _Optional[_Iterable[_Union[GenerativeProvider, _Mapping]]] = ..., ) -> None: ... SINGLE_RESPONSE_PROMPT_FIELD_NUMBER: _ClassVar[int] @@ -76,10 +79,11 @@ class GenerativeProvider(_message.Message): "cohere", "dummy", "mistral", - "octoai", "ollama", "openai", "google", + "databricks", + "friendliai", ) RETURN_METADATA_FIELD_NUMBER: _ClassVar[int] ANTHROPIC_FIELD_NUMBER: _ClassVar[int] @@ -88,10 +92,11 @@ class GenerativeProvider(_message.Message): COHERE_FIELD_NUMBER: _ClassVar[int] DUMMY_FIELD_NUMBER: _ClassVar[int] MISTRAL_FIELD_NUMBER: _ClassVar[int] - OCTOAI_FIELD_NUMBER: _ClassVar[int] OLLAMA_FIELD_NUMBER: _ClassVar[int] OPENAI_FIELD_NUMBER: _ClassVar[int] GOOGLE_FIELD_NUMBER: _ClassVar[int] + DATABRICKS_FIELD_NUMBER: _ClassVar[int] + FRIENDLIAI_FIELD_NUMBER: _ClassVar[int] return_metadata: bool anthropic: GenerativeAnthropic anyscale: GenerativeAnyscale @@ -99,10 +104,11 @@ class GenerativeProvider(_message.Message): cohere: GenerativeCohere dummy: GenerativeDummy mistral: GenerativeMistral - octoai: GenerativeOctoAI ollama: GenerativeOllama openai: GenerativeOpenAI google: GenerativeGoogle + databricks: GenerativeDatabricks + friendliai: GenerativeFriendliAI def __init__( self, return_metadata: bool = ..., @@ -112,10 +118,11 @@ class GenerativeProvider(_message.Message): cohere: _Optional[_Union[GenerativeCohere, _Mapping]] = ..., dummy: _Optional[_Union[GenerativeDummy, _Mapping]] = ..., mistral: _Optional[_Union[GenerativeMistral, _Mapping]] = ..., - octoai: _Optional[_Union[GenerativeOctoAI, _Mapping]] = ..., ollama: _Optional[_Union[GenerativeOllama, _Mapping]] = ..., openai: _Optional[_Union[GenerativeOpenAI, _Mapping]] = ..., google: _Optional[_Union[GenerativeGoogle, _Mapping]] = ..., + databricks: _Optional[_Union[GenerativeDatabricks, _Mapping]] = ..., + friendliai: _Optional[_Union[GenerativeFriendliAI, _Mapping]] = ..., ) -> None: ... class GenerativeAnthropic(_message.Message): @@ -169,13 +176,38 @@ class GenerativeAnyscale(_message.Message): ) -> None: ... class GenerativeAWS(_message.Message): - __slots__ = ("model", "temperature") + __slots__ = ( + "model", + "temperature", + "service", + "region", + "endpoint", + "target_model", + "target_variant", + ) MODEL_FIELD_NUMBER: _ClassVar[int] TEMPERATURE_FIELD_NUMBER: _ClassVar[int] + SERVICE_FIELD_NUMBER: _ClassVar[int] + REGION_FIELD_NUMBER: _ClassVar[int] + ENDPOINT_FIELD_NUMBER: _ClassVar[int] + TARGET_MODEL_FIELD_NUMBER: _ClassVar[int] + TARGET_VARIANT_FIELD_NUMBER: _ClassVar[int] model: str temperature: float + service: str + region: str + endpoint: str + target_model: str + target_variant: str def __init__( - self, model: _Optional[str] = ..., temperature: _Optional[float] = ... + self, + model: _Optional[str] = ..., + temperature: _Optional[float] = ..., + service: _Optional[str] = ..., + region: _Optional[str] = ..., + endpoint: _Optional[str] = ..., + target_model: _Optional[str] = ..., + target_variant: _Optional[str] = ..., ) -> None: ... class GenerativeCohere(_message.Message): @@ -246,30 +278,6 @@ class GenerativeMistral(_message.Message): top_p: _Optional[float] = ..., ) -> None: ... -class GenerativeOctoAI(_message.Message): - __slots__ = ("base_url", "max_tokens", "model", "n", "temperature", "top_p") - BASE_URL_FIELD_NUMBER: _ClassVar[int] - MAX_TOKENS_FIELD_NUMBER: _ClassVar[int] - MODEL_FIELD_NUMBER: _ClassVar[int] - N_FIELD_NUMBER: _ClassVar[int] - TEMPERATURE_FIELD_NUMBER: _ClassVar[int] - TOP_P_FIELD_NUMBER: _ClassVar[int] - base_url: str - max_tokens: int - model: str - n: int - temperature: float - top_p: float - def __init__( - self, - base_url: _Optional[str] = ..., - max_tokens: _Optional[int] = ..., - model: _Optional[str] = ..., - n: _Optional[int] = ..., - temperature: _Optional[float] = ..., - top_p: _Optional[float] = ..., - ) -> None: ... - class GenerativeOllama(_message.Message): __slots__ = ("api_endpoint", "model", "temperature") API_ENDPOINT_FIELD_NUMBER: _ClassVar[int] @@ -288,7 +296,6 @@ class GenerativeOllama(_message.Message): class GenerativeOpenAI(_message.Message): __slots__ = ( "frequency_penalty", - "log_probs", "max_tokens", "model", "n", @@ -296,10 +303,13 @@ class GenerativeOpenAI(_message.Message): "stop", "temperature", "top_p", - "top_log_probs", + "base_url", + "api_version", + "resource_name", + "deployment_id", + "is_azure", ) FREQUENCY_PENALTY_FIELD_NUMBER: _ClassVar[int] - LOG_PROBS_FIELD_NUMBER: _ClassVar[int] MAX_TOKENS_FIELD_NUMBER: _ClassVar[int] MODEL_FIELD_NUMBER: _ClassVar[int] N_FIELD_NUMBER: _ClassVar[int] @@ -307,9 +317,12 @@ class GenerativeOpenAI(_message.Message): STOP_FIELD_NUMBER: _ClassVar[int] TEMPERATURE_FIELD_NUMBER: _ClassVar[int] TOP_P_FIELD_NUMBER: _ClassVar[int] - TOP_LOG_PROBS_FIELD_NUMBER: _ClassVar[int] + BASE_URL_FIELD_NUMBER: _ClassVar[int] + API_VERSION_FIELD_NUMBER: _ClassVar[int] + RESOURCE_NAME_FIELD_NUMBER: _ClassVar[int] + DEPLOYMENT_ID_FIELD_NUMBER: _ClassVar[int] + IS_AZURE_FIELD_NUMBER: _ClassVar[int] frequency_penalty: float - log_probs: bool max_tokens: int model: str n: int @@ -317,11 +330,14 @@ class GenerativeOpenAI(_message.Message): stop: _base_pb2.TextArray temperature: float top_p: float - top_log_probs: int + base_url: str + api_version: str + resource_name: str + deployment_id: str + is_azure: bool def __init__( self, frequency_penalty: _Optional[float] = ..., - log_probs: bool = ..., max_tokens: _Optional[int] = ..., model: _Optional[str] = ..., n: _Optional[int] = ..., @@ -329,7 +345,11 @@ class GenerativeOpenAI(_message.Message): stop: _Optional[_Union[_base_pb2.TextArray, _Mapping]] = ..., temperature: _Optional[float] = ..., top_p: _Optional[float] = ..., - top_log_probs: _Optional[int] = ..., + base_url: _Optional[str] = ..., + api_version: _Optional[str] = ..., + resource_name: _Optional[str] = ..., + deployment_id: _Optional[str] = ..., + is_azure: bool = ..., ) -> None: ... class GenerativeGoogle(_message.Message): @@ -342,6 +362,10 @@ class GenerativeGoogle(_message.Message): "top_k", "top_p", "stop_sequences", + "api_endpoint", + "project_id", + "endpoint_id", + "region", ) FREQUENCY_PENALTY_FIELD_NUMBER: _ClassVar[int] MAX_TOKENS_FIELD_NUMBER: _ClassVar[int] @@ -351,6 +375,10 @@ class GenerativeGoogle(_message.Message): TOP_K_FIELD_NUMBER: _ClassVar[int] TOP_P_FIELD_NUMBER: _ClassVar[int] STOP_SEQUENCES_FIELD_NUMBER: _ClassVar[int] + API_ENDPOINT_FIELD_NUMBER: _ClassVar[int] + PROJECT_ID_FIELD_NUMBER: _ClassVar[int] + ENDPOINT_ID_FIELD_NUMBER: _ClassVar[int] + REGION_FIELD_NUMBER: _ClassVar[int] frequency_penalty: float max_tokens: int model: str @@ -359,6 +387,10 @@ class GenerativeGoogle(_message.Message): top_k: int top_p: float stop_sequences: _base_pb2.TextArray + api_endpoint: str + project_id: str + endpoint_id: str + region: str def __init__( self, frequency_penalty: _Optional[float] = ..., @@ -369,6 +401,85 @@ class GenerativeGoogle(_message.Message): top_k: _Optional[int] = ..., top_p: _Optional[float] = ..., stop_sequences: _Optional[_Union[_base_pb2.TextArray, _Mapping]] = ..., + api_endpoint: _Optional[str] = ..., + project_id: _Optional[str] = ..., + endpoint_id: _Optional[str] = ..., + region: _Optional[str] = ..., + ) -> None: ... + +class GenerativeDatabricks(_message.Message): + __slots__ = ( + "endpoint", + "model", + "frequency_penalty", + "log_probs", + "top_log_probs", + "max_tokens", + "n", + "presence_penalty", + "stop", + "temperature", + "top_p", + ) + ENDPOINT_FIELD_NUMBER: _ClassVar[int] + MODEL_FIELD_NUMBER: _ClassVar[int] + FREQUENCY_PENALTY_FIELD_NUMBER: _ClassVar[int] + LOG_PROBS_FIELD_NUMBER: _ClassVar[int] + TOP_LOG_PROBS_FIELD_NUMBER: _ClassVar[int] + MAX_TOKENS_FIELD_NUMBER: _ClassVar[int] + N_FIELD_NUMBER: _ClassVar[int] + PRESENCE_PENALTY_FIELD_NUMBER: _ClassVar[int] + STOP_FIELD_NUMBER: _ClassVar[int] + TEMPERATURE_FIELD_NUMBER: _ClassVar[int] + TOP_P_FIELD_NUMBER: _ClassVar[int] + endpoint: str + model: str + frequency_penalty: float + log_probs: bool + top_log_probs: int + max_tokens: int + n: int + presence_penalty: float + stop: _base_pb2.TextArray + temperature: float + top_p: float + def __init__( + self, + endpoint: _Optional[str] = ..., + model: _Optional[str] = ..., + frequency_penalty: _Optional[float] = ..., + log_probs: bool = ..., + top_log_probs: _Optional[int] = ..., + max_tokens: _Optional[int] = ..., + n: _Optional[int] = ..., + presence_penalty: _Optional[float] = ..., + stop: _Optional[_Union[_base_pb2.TextArray, _Mapping]] = ..., + temperature: _Optional[float] = ..., + top_p: _Optional[float] = ..., + ) -> None: ... + +class GenerativeFriendliAI(_message.Message): + __slots__ = ("base_url", "model", "max_tokens", "temperature", "n", "top_p") + BASE_URL_FIELD_NUMBER: _ClassVar[int] + MODEL_FIELD_NUMBER: _ClassVar[int] + MAX_TOKENS_FIELD_NUMBER: _ClassVar[int] + TEMPERATURE_FIELD_NUMBER: _ClassVar[int] + N_FIELD_NUMBER: _ClassVar[int] + TOP_P_FIELD_NUMBER: _ClassVar[int] + base_url: str + model: str + max_tokens: int + temperature: float + n: int + top_p: float + def __init__( + self, + base_url: _Optional[str] = ..., + model: _Optional[str] = ..., + max_tokens: _Optional[int] = ..., + temperature: _Optional[float] = ..., + n: _Optional[int] = ..., + top_p: _Optional[float] = ..., ) -> None: ... class GenerativeAnthropicMetadata(_message.Message): @@ -488,30 +599,6 @@ class GenerativeMistralMetadata(_message.Message): self, usage: _Optional[_Union[GenerativeMistralMetadata.Usage, _Mapping]] = ... ) -> None: ... -class GenerativeOctoAIMetadata(_message.Message): - __slots__ = ("usage",) - - class Usage(_message.Message): - __slots__ = ("prompt_tokens", "completion_tokens", "total_tokens") - PROMPT_TOKENS_FIELD_NUMBER: _ClassVar[int] - COMPLETION_TOKENS_FIELD_NUMBER: _ClassVar[int] - TOTAL_TOKENS_FIELD_NUMBER: _ClassVar[int] - prompt_tokens: int - completion_tokens: int - total_tokens: int - def __init__( - self, - prompt_tokens: _Optional[int] = ..., - completion_tokens: _Optional[int] = ..., - total_tokens: _Optional[int] = ..., - ) -> None: ... - - USAGE_FIELD_NUMBER: _ClassVar[int] - usage: GenerativeOctoAIMetadata.Usage - def __init__( - self, usage: _Optional[_Union[GenerativeOctoAIMetadata.Usage, _Mapping]] = ... - ) -> None: ... - class GenerativeOllamaMetadata(_message.Message): __slots__ = () def __init__(self) -> None: ... @@ -607,6 +694,54 @@ class GenerativeGoogleMetadata(_message.Message): usage_metadata: _Optional[_Union[GenerativeGoogleMetadata.UsageMetadata, _Mapping]] = ..., ) -> None: ... +class GenerativeDatabricksMetadata(_message.Message): + __slots__ = ("usage",) + + class Usage(_message.Message): + __slots__ = ("prompt_tokens", "completion_tokens", "total_tokens") + PROMPT_TOKENS_FIELD_NUMBER: _ClassVar[int] + COMPLETION_TOKENS_FIELD_NUMBER: _ClassVar[int] + TOTAL_TOKENS_FIELD_NUMBER: _ClassVar[int] + prompt_tokens: int + completion_tokens: int + total_tokens: int + def __init__( + self, + prompt_tokens: _Optional[int] = ..., + completion_tokens: _Optional[int] = ..., + total_tokens: _Optional[int] = ..., + ) -> None: ... + + USAGE_FIELD_NUMBER: _ClassVar[int] + usage: GenerativeDatabricksMetadata.Usage + def __init__( + self, usage: _Optional[_Union[GenerativeDatabricksMetadata.Usage, _Mapping]] = ... + ) -> None: ... + +class GenerativeFriendliAIMetadata(_message.Message): + __slots__ = ("usage",) + + class Usage(_message.Message): + __slots__ = ("prompt_tokens", "completion_tokens", "total_tokens") + PROMPT_TOKENS_FIELD_NUMBER: _ClassVar[int] + COMPLETION_TOKENS_FIELD_NUMBER: _ClassVar[int] + TOTAL_TOKENS_FIELD_NUMBER: _ClassVar[int] + prompt_tokens: int + completion_tokens: int + total_tokens: int + def __init__( + self, + prompt_tokens: _Optional[int] = ..., + completion_tokens: _Optional[int] = ..., + total_tokens: _Optional[int] = ..., + ) -> None: ... + + USAGE_FIELD_NUMBER: _ClassVar[int] + usage: GenerativeFriendliAIMetadata.Usage + def __init__( + self, usage: _Optional[_Union[GenerativeFriendliAIMetadata.Usage, _Mapping]] = ... + ) -> None: ... + class GenerativeMetadata(_message.Message): __slots__ = ( "anthropic", @@ -615,10 +750,11 @@ class GenerativeMetadata(_message.Message): "cohere", "dummy", "mistral", - "octoai", "ollama", "openai", "google", + "databricks", + "friendliai", ) ANTHROPIC_FIELD_NUMBER: _ClassVar[int] ANYSCALE_FIELD_NUMBER: _ClassVar[int] @@ -626,20 +762,22 @@ class GenerativeMetadata(_message.Message): COHERE_FIELD_NUMBER: _ClassVar[int] DUMMY_FIELD_NUMBER: _ClassVar[int] MISTRAL_FIELD_NUMBER: _ClassVar[int] - OCTOAI_FIELD_NUMBER: _ClassVar[int] OLLAMA_FIELD_NUMBER: _ClassVar[int] OPENAI_FIELD_NUMBER: _ClassVar[int] GOOGLE_FIELD_NUMBER: _ClassVar[int] + DATABRICKS_FIELD_NUMBER: _ClassVar[int] + FRIENDLIAI_FIELD_NUMBER: _ClassVar[int] anthropic: GenerativeAnthropicMetadata anyscale: GenerativeAnyscaleMetadata aws: GenerativeAWSMetadata cohere: GenerativeCohereMetadata dummy: GenerativeDummyMetadata mistral: GenerativeMistralMetadata - octoai: GenerativeOctoAIMetadata ollama: GenerativeOllamaMetadata openai: GenerativeOpenAIMetadata google: GenerativeGoogleMetadata + databricks: GenerativeDatabricksMetadata + friendliai: GenerativeFriendliAIMetadata def __init__( self, anthropic: _Optional[_Union[GenerativeAnthropicMetadata, _Mapping]] = ..., @@ -648,10 +786,11 @@ class GenerativeMetadata(_message.Message): cohere: _Optional[_Union[GenerativeCohereMetadata, _Mapping]] = ..., dummy: _Optional[_Union[GenerativeDummyMetadata, _Mapping]] = ..., mistral: _Optional[_Union[GenerativeMistralMetadata, _Mapping]] = ..., - octoai: _Optional[_Union[GenerativeOctoAIMetadata, _Mapping]] = ..., ollama: _Optional[_Union[GenerativeOllamaMetadata, _Mapping]] = ..., openai: _Optional[_Union[GenerativeOpenAIMetadata, _Mapping]] = ..., google: _Optional[_Union[GenerativeGoogleMetadata, _Mapping]] = ..., + databricks: _Optional[_Union[GenerativeDatabricksMetadata, _Mapping]] = ..., + friendliai: _Optional[_Union[GenerativeFriendliAIMetadata, _Mapping]] = ..., ) -> None: ... class GenerativeReply(_message.Message):