WeaviateEx.Query.GenerativeResult (WeaviateEx v0.7.4)
View SourceResult structure for generative search queries.
This struct holds the results from a combined search + generation query, including both the matched objects and their generated content.
Fields
:objects- List of matched objects with their properties:generated- The grouped generation result (if grouped_task was used):generated_per_object- List of per-object generation results (if single_prompt was used):metadata- Optional metadata about the generative operation (token usage, etc.)
Examples
# Result with per-object generation
%GenerativeResult{
objects: [
%{uuid: "uuid-1", properties: %{title: "Article 1"}},
%{uuid: "uuid-2", properties: %{title: "Article 2"}}
],
generated: nil,
generated_per_object: ["Summary of Article 1", "Summary of Article 2"]
}
# Result with grouped generation
%GenerativeResult{
objects: [%{uuid: "uuid-1", properties: %{title: "Article 1"}}],
generated: "Overall summary of all articles",
generated_per_object: []
}
Summary
Functions
Creates a GenerativeResult from a gRPC SearchReply.
Checks if the result has a grouped generation.
Checks if the result has any objects.
Checks if the result has per-object generations.
Creates a new empty GenerativeResult.
Creates a GenerativeResult from parsed objects.
Returns the count of objects in the result.
Types
@type debug_metadata() :: %{optional(:full_prompt) => String.t()}
@type metadata() :: %{ optional(:usage) => usage_metadata(), optional(:debug) => debug_metadata() }
Functions
Creates a GenerativeResult from a gRPC SearchReply.
Parses the gRPC response structure to extract:
- Objects from the search results
- Grouped generative results (if present)
- Per-object generative results (if present)
- Optional metadata (usage, debug info)
Checks if the result has a grouped generation.
Checks if the result has any objects.
Checks if the result has per-object generations.
@spec new() :: t()
Creates a new empty GenerativeResult.
Creates a GenerativeResult from parsed objects.
@spec object_count(t()) :: non_neg_integer()
Returns the count of objects in the result.