Class: Telnyx::Resources::WebSearch::Research
- Inherits:
-
Object
- Object
- Telnyx::Resources::WebSearch::Research
- Defined in:
- lib/telnyx/resources/web_search/research.rb,
sig/telnyx/resources/web_search/research.rbs
Overview
Deep research with citations and async task polling.
Instance Method Summary collapse
-
#create(query:, background: nil, max_sources: nil, research_effort: nil, request_options: {}) ⇒ Telnyx::Models::WebSearch::ResearchCreateResponse
Some parameter documentations has been truncated, see Models::WebSearch::ResearchCreateParams for more details.
-
#initialize(client:) ⇒ Research
constructor
private
A new instance of Research.
-
#retrieve(task_id, request_options: {}) ⇒ Telnyx::Models::WebSearch::ResearchRetrieveResponse
Some parameter documentations has been truncated, see Models::WebSearch::ResearchRetrieveParams for more details.
Constructor Details
#initialize(client:) ⇒ Research
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Research.
80 81 82 |
# File 'lib/telnyx/resources/web_search/research.rb', line 80 def initialize(client:) @client = client end |
Instance Method Details
#create(query:, background: nil, max_sources: nil, research_effort: nil, request_options: {}) ⇒ Telnyx::Models::WebSearch::ResearchCreateResponse
Some parameter documentations has been truncated, see Models::WebSearch::ResearchCreateParams for more details.
Starts a deep research task that runs multiple searches, reads sources, and synthesizes an answer with citations.
Synchronous mode (default)
When background is false or omitted, the request blocks until the research
completes and returns the answer with citations. This can take up to 120 seconds
depending on research_effort.
Asynchronous mode
When background is true, the request returns immediately with a task_id
and status: pending. Poll GET /web_search/research/{task_id} to check when
the research completes and retrieve the answer.
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/telnyx/resources/web_search/research.rb', line 41 def create(params) parsed, = Telnyx::WebSearch::ResearchCreateParams.dump_request(params) @client.request( method: :post, path: "web_search/research", body: parsed, model: Telnyx::Models::WebSearch::ResearchCreateResponse, options: ) end |
#retrieve(task_id, request_options: {}) ⇒ Telnyx::Models::WebSearch::ResearchRetrieveResponse
Some parameter documentations has been truncated, see Models::WebSearch::ResearchRetrieveParams for more details.
Polls the status of a previously started asynchronous research task. When the
status is completed, the response includes the answer and citations. When the
status is failed, the response includes an error message.
68 69 70 71 72 73 74 75 |
# File 'lib/telnyx/resources/web_search/research.rb', line 68 def retrieve(task_id, params = {}) @client.request( method: :get, path: ["web_search/research/%1$s", task_id], model: Telnyx::Models::WebSearch::ResearchRetrieveResponse, options: params[:request_options] ) end |