Get research task status
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.
GET
/
web_search
/
research
/
{task_id}
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.webSearch.research.retrieve('task_id');
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.web_search.research.retrieve(
"task_id",
)
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
research, err := client.WebSearch.Research.Get(
context.TODO(),
"task_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", research.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var response = client.webSearch().research().retrieve("task_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.web_search.research.retrieve("task_id")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->webSearch->research->retrieve(
'task_id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx web-search:research retrieve \
--api-key 'My API Key' \
--task-id bf3026a5-dd57-44dd-b922-200041be3a4bcurl --request GET \
--url https://api.telnyx.com/v2/web_search/research/{task_id} \
--header 'Authorization: Bearer <token>'{
"data": {
"task_id": "bf3026a5-dd57-44dd-b922-200041be3a4b",
"status": "completed",
"answer": "RAG and fine-tuning serve different purposes...",
"citations": [
{
"url": "https://arxiv.org/abs/2401.15884",
"title": "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks"
}
]
}
}Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.webSearch.research.retrieve('task_id');
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.web_search.research.retrieve(
"task_id",
)
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
research, err := client.WebSearch.Research.Get(
context.TODO(),
"task_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", research.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var response = client.webSearch().research().retrieve("task_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.web_search.research.retrieve("task_id")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->webSearch->research->retrieve(
'task_id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx web-search:research retrieve \
--api-key 'My API Key' \
--task-id bf3026a5-dd57-44dd-b922-200041be3a4bcurl --request GET \
--url https://api.telnyx.com/v2/web_search/research/{task_id} \
--header 'Authorization: Bearer <token>'{
"data": {
"task_id": "bf3026a5-dd57-44dd-b922-200041be3a4b",
"status": "completed",
"answer": "RAG and fine-tuning serve different purposes...",
"citations": [
{
"url": "https://arxiv.org/abs/2401.15884",
"title": "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks"
}
]
}
}