Responses
List input items for a response
Retrieves the input items associated with the specified response.
Parâmetros de caminho
response_id
string
exigido
The response id path parameter.
Parâmetros de consulta
limit
integer
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
order
enum
Sort order by the created_at timestamp of the objects. asc for ascending order anddesc
for descending order.
after
string
A cursor for use in pagination. after is an object ID that defines your place in the list.
For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
subsequent call can include after=obj_foo in order to fetch the next page of the list.
before
string
A cursor for use in pagination. before is an object ID that defines your place in the list.
For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
subsequent call can include before=obj_foo in order to fetch the previous page of the list.
Parâmetros do cabeçalho
x-ms-user-identity
string
Opaque per-user identity string used to scope endpoint-scoped data to a specific end user. The caller must have the agents/endpoints/UserIdentityImpersonation/action RBAC permission.
Respostas
The request has succeeded.
Cabeçalhos
x-agent-session-id
string
Session ID for this request. Only present for hosted agent responses. Returns the provided session ID or an auto-generated one if not provided in the request.
Corpo
data
OpenAI.ItemResource[]
exigido
The requested list of items.
first_id
string
The first ID represented in this list.
last_id
string
The last ID represented in this list.
has_more
boolean
exigido
A value indicating whether there are additional values available not captured in this list.
Solicitar
curl https://api.openai.com/v1/responses/resp_abc123/input_items \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY"
import OpenAI from "openai";
const client = new OpenAI();
const response = await client.responses.inputItems.list("resp_123");
console.log(response.data);
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
page = client.responses.input_items.list(
response_id="response_id",
)
page = page.data[0]
print(page)
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const responseItem of client.responses.inputItems.list('response_id')) {
console.log(responseItem);
}
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
"github.com/openai/openai-go/responses"
)
func main() {
client := openai.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Responses.InputItems.List(
context.TODO(),
"response_id",
responses.InputItemListParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v
", page)
}
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.responses.inputitems.InputItemListPage;
import com.openai.models.responses.inputitems.InputItemListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
InputItemListPage page = client.responses().inputItems().list("response_id");
}
}
require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
page = openai.responses.input_items.list("response_id")
puts(page)
Resposta
{
"object": "list",
"data": [
{
"id": "msg_abc123",
"type": "message",
"role": "user",
"content": [
{
"type": "input_text",
"text": "Tell me a three sentence bedtime story about a unicorn."
}
]
}
],
"first_id": "msg_abc123",
"last_id": "msg_abc123",
"has_more": false
}