=encoding utf8

=head1 NAME

OpenAPI::Client::OpenAI::Path::threads-thread_id-runs-run_id-steps - Documentation for the /threads/{thread_id}/runs/{run_id}/steps path.

=head1 OPERATIONS

=head2 GET /threads/{thread_id}/runs/{run_id}/steps

=head3 listRunSteps

  $client->list_run_steps({
      body => { ... },
  });

Returns a list of run steps belonging to a run.

=head4 Path/query parameters

=over

=item * C<thread_id> (in path, required, string) - The ID of the thread the run and run steps belong to.

=item * C<run_id> (in path, required, string) - The ID of the run the run steps belong to.

=item * C<limit> (in query, optional, integer) - A limit on the number of objects to be returned. Limit can range between 1 and
100, and the default is 20.

Default: 20

=item * C<order> (in query, optional, string) - Sort order by the C<created_at> timestamp of the objects. C<asc> for ascending
order and C<desc> for descending order.

Allowed values: asc, desc

Default: desc

=item * C<after> (in query, optional, string) - A cursor for use in pagination. C<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.

=item * C<before> (in query, optional, string) - A cursor for use in pagination. C<before> is an object ID that defines your
place in the list. For instance, if you make a list request and receive 100
objects, starting with obj_foo, your subsequent call can include
before=obj_foo in order to fetch the previous page of the list.

=item * C<include[]> (in query, optional, array) - A list of additional fields to include in the response. Currently the only
supported value is
C<step_details.tool_calls[I<].file_search.results[>].content> to fetch the
file search result content.

See the
L<file search tool documentation|https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings>
for more information.

=back

=head4 Responses

B<200 - OK>

Content-Type: application/json

Example:

    {
       "data" : [
          "{\n  \"id\": \"step_abc123\",\n  \"object\": \"thread.run.step\",\n  \"created_at\": 1699063291,\n  \"run_id\": \"run_abc123\",\n  \"assistant_id\": \"asst_abc123\",\n  \"thread_id\": \"thread_abc123\",\n  \"type\": \"message_creation\",\n  \"status\": \"completed\",\n  \"cancelled_at\": null,\n  \"completed_at\": 1699063291,\n  \"expired_at\": null,\n  \"failed_at\": null,\n  \"last_error\": null,\n  \"step_details\": {\n    \"type\": \"message_creation\",\n    \"message_creation\": {\n      \"message_id\": \"msg_abc123\"\n    }\n  },\n  \"usage\": {\n    \"prompt_tokens\": 123,\n    \"completion_tokens\": 456,\n    \"total_tokens\": 579\n  }\n}\n"
       ],
       "first_id" : "step_abc123",
       "has_more" : false,
       "last_id" : "step_abc456",
       "object" : "list"
    }

=head1 SCHEMAS

=head2 ListRunStepsResponse

Properties:

=over

=item * C<data> (array of RunStepObject, required)

=item * C<first_id> (string, required)

=item * C<has_more> (boolean, required)

=item * C<last_id> (string, required)

=item * C<object> (string, required)

=back

=head2 Metadata

Set of 16 key-value pairs that can be attached to an object. This can be
useful for storing additional information about the object in a structured
format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings
with a maximum length of 512 characters.

=head2 RunStepCompletionUsage

Usage statistics related to the run step. This value will be C<null> while the
run step's status is C<in_progress> .

=head2 RunStepObject

Properties:

=over

=item * C<assistant_id> (string, required) - The ID of the
L<assistant|https://platform.openai.com/docs/api-reference/assistants>
associated with the run step.

=item * C<cancelled_at> (anyOf, required)

=item * C<completed_at> (anyOf, required)

=item * C<created_at> (integer, required) - The Unix timestamp (in seconds) for when the run step was created.

=item * C<expired_at> (anyOf, required)

=item * C<failed_at> (anyOf, required)

=item * C<id> (string, required) - The identifier of the run step, which can be referenced in API endpoints.

=item * C<last_error> (anyOf, required)

=item * C<metadata> (Metadata, required)

See L</Metadata> below for shape.

=item * C<object> (string, required) - The object type, which is always C<thread.run.step> .

Allowed values: thread.run.step

=item * C<run_id> (string, required) - The ID of the L<run|https://platform.openai.com/docs/api-reference/runs> that
this run step is a part of.

=item * C<status> (string, required) - The status of the run step, which can be either C<in_progress> , C<cancelled>
, C<failed> , C<completed> , or C<expired> .

Allowed values: in_progress, cancelled, failed, completed, expired

=item * C<step_details> (object, required) - The details of the run step.

=item * C<thread_id> (string, required) - The ID of the L<thread|https://platform.openai.com/docs/api-reference/threads>
that was run.

=item * C<type> (string, required) - The type of run step, which can be either C<message_creation> or C<tool_calls>
.

Allowed values: message_creation, tool_calls

=item * C<usage> (RunStepCompletionUsage, required)

See L</RunStepCompletionUsage> below for shape.

=back

=head1 SEE ALSO

L<OpenAPI::Client::OpenAI::Path>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2023-2026 by Nelson Ferraz

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.14.0 or,
at your option, any later version of Perl 5 you may have available.

=cut
