Class: Tavily::ResearchTask
- Includes:
- Envelope
- Defined in:
- lib/tavily/responses.rb
Overview
A research task, returned by Client#research (status pending) and by Client#research_task / Client#wait_for_research (with the final result).
Instance Attribute Summary
Attributes inherited from Object
Instance Method Summary collapse
-
#completed? ⇒ Boolean
Whether the task finished successfully.
-
#content ⇒ String, ...
The final report (String, or Hash when
output_schemaused). -
#created_at ⇒ String?
Creation timestamp (ISO 8601).
-
#failed? ⇒ Boolean
Whether the task failed.
-
#input ⇒ String?
Echo of the research input.
-
#model ⇒ String?
The model used (“mini”, “pro”, or resolved from “auto”).
-
#pending? ⇒ Boolean
Whether the task is still running or queued.
-
#request_id ⇒ String?
Research task id (use to poll for results).
-
#sources ⇒ Array<ResearchSource>
Sources used in the research.
-
#status ⇒ String?
One of “pending”, “in_progress”, “completed”, “failed”.
Methods included from Envelope
Methods inherited from Object
#==, #[], attribute, #dig, #hash, #initialize, #inspect, #key?, #to_h
Constructor Details
This class inherits a constructor from Tavily::Object
Instance Method Details
#completed? ⇒ Boolean
Returns whether the task finished successfully.
178 179 180 |
# File 'lib/tavily/responses.rb', line 178 def completed? status == "completed" end |
#content ⇒ String, ...
Returns the final report (String, or Hash when output_schema used).
173 |
# File 'lib/tavily/responses.rb', line 173 attribute :content |
#created_at ⇒ String?
Returns creation timestamp (ISO 8601).
165 |
# File 'lib/tavily/responses.rb', line 165 attribute :created_at |
#failed? ⇒ Boolean
Returns whether the task failed.
183 184 185 |
# File 'lib/tavily/responses.rb', line 183 def failed? status == "failed" end |
#input ⇒ String?
Returns echo of the research input.
169 |
# File 'lib/tavily/responses.rb', line 169 attribute :input |
#model ⇒ String?
Returns the model used (“mini”, “pro”, or resolved from “auto”).
171 |
# File 'lib/tavily/responses.rb', line 171 attribute :model |
#pending? ⇒ Boolean
Returns whether the task is still running or queued.
188 189 190 |
# File 'lib/tavily/responses.rb', line 188 def pending? %w[pending in_progress].include?(status) end |
#request_id ⇒ String?
Returns research task id (use to poll for results).
163 |
# File 'lib/tavily/responses.rb', line 163 attribute :request_id |
#sources ⇒ Array<ResearchSource>
Returns sources used in the research.
175 |
# File 'lib/tavily/responses.rb', line 175 attribute :sources, wrap: ResearchSource, collection: true |
#status ⇒ String?
Returns one of “pending”, “in_progress”, “completed”, “failed”.
167 |
# File 'lib/tavily/responses.rb', line 167 attribute :status |