diff --git a/en/java/resources/beta/subresources/threads/index.md b/en/java/resources/beta/subresources/threads/index.md index 6f5a864..e852d83 100644 --- a/en/java/resources/beta/subresources/threads/index.md +++ b/en/java/resources/beta/subresources/threads/index.md @@ -6,7 +6,7 @@ **post** `/threads` -Create a thread. +Create thread ### Parameters @@ -309,7 +309,7 @@ public final class Main { **post** `/threads/runs` -Create a thread and run it in one request. +Create thread and run ### Parameters @@ -591,76 +591,10 @@ Create a thread and run it in one request. The ID of the [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) attached to this assistant. There can be a maximum of 1 vector store attached to the assistant. - - `Optional> tools` + - `Optional> tools` Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. - - `class CodeInterpreterTool:` - - - `class FileSearchTool:` - - - `JsonValue; type "file_search"constant` - - The type of tool being defined: `file_search` - - - `FILE_SEARCH("file_search")` - - - `Optional fileSearch` - - Overrides for the file search tool. - - - `Optional maxNumResults` - - The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `Optional rankingOptions` - - The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - - See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `double scoreThreshold` - - The score threshold for the file search. All values must be a floating point number between 0 and 1. - - - `Optional ranker` - - The ranker to use for the file search. If not specified will use the `auto` ranker. - - - `AUTO("auto")` - - - `DEFAULT_2024_08_21("default_2024_08_21")` - - - `class FunctionTool:` - - - `FunctionDefinition function` - - - `String name` - - The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - - - `Optional description` - - A description of what the function does, used by the model to choose when and how to call the function. - - - `Optional parameters` - - The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. - - - `Optional strict` - - Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://platform.openai.com/docs/guides/function-calling). - - - `JsonValue; type "function"constant` - - The type of tool being defined: `function` - - - `FUNCTION("function")` - - `Optional topP` An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. @@ -901,27 +835,7 @@ Create a thread and run it in one request. The Unix timestamp (in seconds) for when the run was started. - - `RunStatus status` - - The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. - - - `QUEUED("queued")` - - - `IN_PROGRESS("in_progress")` - - - `REQUIRES_ACTION("requires_action")` - - - `CANCELLING("cancelling")` - - - `CANCELLED("cancelled")` - - - `FAILED("failed")` - - - `COMPLETED("completed")` - - - `INCOMPLETE("incomplete")` - - - `EXPIRED("expired")` + - `JsonValue status` - `String threadId` @@ -963,82 +877,10 @@ Create a thread and run it in one request. The name of the function to call. - - `List tools` + - `List tools` The list of tools that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run. - - `class CodeInterpreterTool:` - - - `JsonValue; type "code_interpreter"constant` - - The type of tool being defined: `code_interpreter` - - - `CODE_INTERPRETER("code_interpreter")` - - - `class FileSearchTool:` - - - `JsonValue; type "file_search"constant` - - The type of tool being defined: `file_search` - - - `FILE_SEARCH("file_search")` - - - `Optional fileSearch` - - Overrides for the file search tool. - - - `Optional maxNumResults` - - The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `Optional rankingOptions` - - The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - - See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `double scoreThreshold` - - The score threshold for the file search. All values must be a floating point number between 0 and 1. - - - `Optional ranker` - - The ranker to use for the file search. If not specified will use the `auto` ranker. - - - `AUTO("auto")` - - - `DEFAULT_2024_08_21("default_2024_08_21")` - - - `class FunctionTool:` - - - `FunctionDefinition function` - - - `String name` - - The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - - - `Optional description` - - A description of what the function does, used by the model to choose when and how to call the function. - - - `Optional parameters` - - The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. - - - `Optional strict` - - Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://platform.openai.com/docs/guides/function-calling). - - - `JsonValue; type "function"constant` - - The type of tool being defined: `function` - - - `FUNCTION("function")` - - `Optional truncationStrategy` Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run. @@ -1147,13 +989,11 @@ public final class Main { }, "response_format": "auto", "started_at": 0, - "status": "queued", + "status": {}, "thread_id": "thread_id", "tool_choice": "none", "tools": [ - { - "type": "code_interpreter" - } + {} ], "truncation_strategy": { "type": "auto", @@ -1175,7 +1015,7 @@ public final class Main { **get** `/threads/{thread_id}` -Retrieves a thread. +Retrieve thread ### Parameters @@ -1280,7 +1120,7 @@ public final class Main { **post** `/threads/{thread_id}` -Modifies a thread. +Modify thread ### Parameters @@ -1410,7 +1250,7 @@ public final class Main { **delete** `/threads/{thread_id}` -Delete a thread. +Delete thread ### Parameters @@ -1673,7 +1513,7 @@ public final class Main { **get** `/threads/{thread_id}/runs` -Returns a list of runs belonging to a thread. +List runs ### Parameters @@ -1919,27 +1759,7 @@ Returns a list of runs belonging to a thread. The Unix timestamp (in seconds) for when the run was started. - - `RunStatus status` - - The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. - - - `QUEUED("queued")` - - - `IN_PROGRESS("in_progress")` - - - `REQUIRES_ACTION("requires_action")` - - - `CANCELLING("cancelling")` - - - `CANCELLED("cancelled")` - - - `FAILED("failed")` - - - `COMPLETED("completed")` - - - `INCOMPLETE("incomplete")` - - - `EXPIRED("expired")` + - `JsonValue status` - `String threadId` @@ -1981,82 +1801,10 @@ Returns a list of runs belonging to a thread. The name of the function to call. - - `List tools` + - `List tools` The list of tools that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run. - - `class CodeInterpreterTool:` - - - `JsonValue; type "code_interpreter"constant` - - The type of tool being defined: `code_interpreter` - - - `CODE_INTERPRETER("code_interpreter")` - - - `class FileSearchTool:` - - - `JsonValue; type "file_search"constant` - - The type of tool being defined: `file_search` - - - `FILE_SEARCH("file_search")` - - - `Optional fileSearch` - - Overrides for the file search tool. - - - `Optional maxNumResults` - - The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `Optional rankingOptions` - - The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - - See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `double scoreThreshold` - - The score threshold for the file search. All values must be a floating point number between 0 and 1. - - - `Optional ranker` - - The ranker to use for the file search. If not specified will use the `auto` ranker. - - - `AUTO("auto")` - - - `DEFAULT_2024_08_21("default_2024_08_21")` - - - `class FunctionTool:` - - - `FunctionDefinition function` - - - `String name` - - The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - - - `Optional description` - - A description of what the function does, used by the model to choose when and how to call the function. - - - `Optional parameters` - - The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. - - - `Optional strict` - - Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://platform.openai.com/docs/guides/function-calling). - - - `JsonValue; type "function"constant` - - The type of tool being defined: `function` - - - `FUNCTION("function")` - - `Optional truncationStrategy` Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run. @@ -2164,13 +1912,11 @@ public final class Main { }, "response_format": "auto", "started_at": 0, - "status": "queued", + "status": {}, "thread_id": "thread_id", "tool_choice": "none", "tools": [ - { - "type": "code_interpreter" - } + {} ], "truncation_strategy": { "type": "auto", @@ -2198,7 +1944,7 @@ public final class Main { **post** `/threads/{thread_id}/runs` -Create a run. +Create run ### Parameters @@ -2379,16 +2125,13 @@ Create a run. - `Optional reasoningEffort` - Constrains effort on reasoning for - [reasoning models](https://platform.openai.com/docs/guides/reasoning). - Currently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing - reasoning effort can result in faster responses and fewer tokens used - on reasoning in a response. - - - `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1. - - All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`. - - The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort. - - `xhigh` is supported for all models after `gpt-5.1-codex-max`. + Constrains effort on reasoning for reasoning models. Currently supported + values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. + Reducing reasoning effort can result in faster responses and fewer tokens + used on reasoning in a response. Not all reasoning models support every + value. See the + [reasoning guide](https://platform.openai.com/docs/guides/reasoning) + for model-specific support. - `Optional responseFormat` @@ -2412,76 +2155,10 @@ Create a run. `required` means the model must call one or more tools before responding to the user. Specifying a particular tool like `{"type": "file_search"}` or `{"type": "function", "function": {"name": "my_function"}}` forces the model to call that tool. - - `Optional> tools` + - `Optional> tools` Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. - - `class CodeInterpreterTool:` - - - `class FileSearchTool:` - - - `JsonValue; type "file_search"constant` - - The type of tool being defined: `file_search` - - - `FILE_SEARCH("file_search")` - - - `Optional fileSearch` - - Overrides for the file search tool. - - - `Optional maxNumResults` - - The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `Optional rankingOptions` - - The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - - See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `double scoreThreshold` - - The score threshold for the file search. All values must be a floating point number between 0 and 1. - - - `Optional ranker` - - The ranker to use for the file search. If not specified will use the `auto` ranker. - - - `AUTO("auto")` - - - `DEFAULT_2024_08_21("default_2024_08_21")` - - - `class FunctionTool:` - - - `FunctionDefinition function` - - - `String name` - - The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - - - `Optional description` - - A description of what the function does, used by the model to choose when and how to call the function. - - - `Optional parameters` - - The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. - - - `Optional strict` - - Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://platform.openai.com/docs/guides/function-calling). - - - `JsonValue; type "function"constant` - - The type of tool being defined: `function` - - - `FUNCTION("function")` - - `Optional topP` An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. @@ -2722,33 +2399,13 @@ Create a run. The Unix timestamp (in seconds) for when the run was started. - - `RunStatus status` - - The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. + - `JsonValue status` - - `QUEUED("queued")` + - `String threadId` - - `IN_PROGRESS("in_progress")` + The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was executed on as a part of this run. - - `REQUIRES_ACTION("requires_action")` - - - `CANCELLING("cancelling")` - - - `CANCELLED("cancelled")` - - - `FAILED("failed")` - - - `COMPLETED("completed")` - - - `INCOMPLETE("incomplete")` - - - `EXPIRED("expired")` - - - `String threadId` - - The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was executed on as a part of this run. - - - `Optional toolChoice` + - `Optional toolChoice` Controls which (if any) tool is called by the model. `none` means the model will not call any tools and instead generates a message. @@ -2784,82 +2441,10 @@ Create a run. The name of the function to call. - - `List tools` + - `List tools` The list of tools that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run. - - `class CodeInterpreterTool:` - - - `JsonValue; type "code_interpreter"constant` - - The type of tool being defined: `code_interpreter` - - - `CODE_INTERPRETER("code_interpreter")` - - - `class FileSearchTool:` - - - `JsonValue; type "file_search"constant` - - The type of tool being defined: `file_search` - - - `FILE_SEARCH("file_search")` - - - `Optional fileSearch` - - Overrides for the file search tool. - - - `Optional maxNumResults` - - The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `Optional rankingOptions` - - The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - - See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `double scoreThreshold` - - The score threshold for the file search. All values must be a floating point number between 0 and 1. - - - `Optional ranker` - - The ranker to use for the file search. If not specified will use the `auto` ranker. - - - `AUTO("auto")` - - - `DEFAULT_2024_08_21("default_2024_08_21")` - - - `class FunctionTool:` - - - `FunctionDefinition function` - - - `String name` - - The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - - - `Optional description` - - A description of what the function does, used by the model to choose when and how to call the function. - - - `Optional parameters` - - The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. - - - `Optional strict` - - Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://platform.openai.com/docs/guides/function-calling). - - - `JsonValue; type "function"constant` - - The type of tool being defined: `function` - - - `FUNCTION("function")` - - `Optional truncationStrategy` Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run. @@ -2969,13 +2554,11 @@ public final class Main { }, "response_format": "auto", "started_at": 0, - "status": "queued", + "status": {}, "thread_id": "thread_id", "tool_choice": "none", "tools": [ - { - "type": "code_interpreter" - } + {} ], "truncation_strategy": { "type": "auto", @@ -2997,7 +2580,7 @@ public final class Main { **get** `/threads/{thread_id}/runs/{run_id}` -Retrieves a run. +Retrieve run ### Parameters @@ -3225,27 +2808,7 @@ Retrieves a run. The Unix timestamp (in seconds) for when the run was started. - - `RunStatus status` - - The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. - - - `QUEUED("queued")` - - - `IN_PROGRESS("in_progress")` - - - `REQUIRES_ACTION("requires_action")` - - - `CANCELLING("cancelling")` - - - `CANCELLED("cancelled")` - - - `FAILED("failed")` - - - `COMPLETED("completed")` - - - `INCOMPLETE("incomplete")` - - - `EXPIRED("expired")` + - `JsonValue status` - `String threadId` @@ -3287,82 +2850,10 @@ Retrieves a run. The name of the function to call. - - `List tools` + - `List tools` The list of tools that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run. - - `class CodeInterpreterTool:` - - - `JsonValue; type "code_interpreter"constant` - - The type of tool being defined: `code_interpreter` - - - `CODE_INTERPRETER("code_interpreter")` - - - `class FileSearchTool:` - - - `JsonValue; type "file_search"constant` - - The type of tool being defined: `file_search` - - - `FILE_SEARCH("file_search")` - - - `Optional fileSearch` - - Overrides for the file search tool. - - - `Optional maxNumResults` - - The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `Optional rankingOptions` - - The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - - See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `double scoreThreshold` - - The score threshold for the file search. All values must be a floating point number between 0 and 1. - - - `Optional ranker` - - The ranker to use for the file search. If not specified will use the `auto` ranker. - - - `AUTO("auto")` - - - `DEFAULT_2024_08_21("default_2024_08_21")` - - - `class FunctionTool:` - - - `FunctionDefinition function` - - - `String name` - - The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - - - `Optional description` - - A description of what the function does, used by the model to choose when and how to call the function. - - - `Optional parameters` - - The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. - - - `Optional strict` - - Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://platform.openai.com/docs/guides/function-calling). - - - `JsonValue; type "function"constant` - - The type of tool being defined: `function` - - - `FUNCTION("function")` - - `Optional truncationStrategy` Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run. @@ -3472,13 +2963,11 @@ public final class Main { }, "response_format": "auto", "started_at": 0, - "status": "queued", + "status": {}, "thread_id": "thread_id", "tool_choice": "none", "tools": [ - { - "type": "code_interpreter" - } + {} ], "truncation_strategy": { "type": "auto", @@ -3500,7 +2989,7 @@ public final class Main { **post** `/threads/{thread_id}/runs/{run_id}` -Modifies a run. +Modify run ### Parameters @@ -3737,27 +3226,7 @@ Modifies a run. The Unix timestamp (in seconds) for when the run was started. - - `RunStatus status` - - The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. - - - `QUEUED("queued")` - - - `IN_PROGRESS("in_progress")` - - - `REQUIRES_ACTION("requires_action")` - - - `CANCELLING("cancelling")` - - - `CANCELLED("cancelled")` - - - `FAILED("failed")` - - - `COMPLETED("completed")` - - - `INCOMPLETE("incomplete")` - - - `EXPIRED("expired")` + - `JsonValue status` - `String threadId` @@ -3799,82 +3268,10 @@ Modifies a run. The name of the function to call. - - `List tools` + - `List tools` The list of tools that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run. - - `class CodeInterpreterTool:` - - - `JsonValue; type "code_interpreter"constant` - - The type of tool being defined: `code_interpreter` - - - `CODE_INTERPRETER("code_interpreter")` - - - `class FileSearchTool:` - - - `JsonValue; type "file_search"constant` - - The type of tool being defined: `file_search` - - - `FILE_SEARCH("file_search")` - - - `Optional fileSearch` - - Overrides for the file search tool. - - - `Optional maxNumResults` - - The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `Optional rankingOptions` - - The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - - See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `double scoreThreshold` - - The score threshold for the file search. All values must be a floating point number between 0 and 1. - - - `Optional ranker` - - The ranker to use for the file search. If not specified will use the `auto` ranker. - - - `AUTO("auto")` - - - `DEFAULT_2024_08_21("default_2024_08_21")` - - - `class FunctionTool:` - - - `FunctionDefinition function` - - - `String name` - - The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - - - `Optional description` - - A description of what the function does, used by the model to choose when and how to call the function. - - - `Optional parameters` - - The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. - - - `Optional strict` - - Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://platform.openai.com/docs/guides/function-calling). - - - `JsonValue; type "function"constant` - - The type of tool being defined: `function` - - - `FUNCTION("function")` - - `Optional truncationStrategy` Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run. @@ -3984,13 +3381,11 @@ public final class Main { }, "response_format": "auto", "started_at": 0, - "status": "queued", + "status": {}, "thread_id": "thread_id", "tool_choice": "none", "tools": [ - { - "type": "code_interpreter" - } + {} ], "truncation_strategy": { "type": "auto", @@ -4012,7 +3407,7 @@ public final class Main { **post** `/threads/{thread_id}/runs/{run_id}/submit_tool_outputs` -When a run has the `status: "requires_action"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request. +Submit tool outputs to run ### Parameters @@ -4252,27 +3647,7 @@ When a run has the `status: "requires_action"` and `required_action.type` is `su The Unix timestamp (in seconds) for when the run was started. - - `RunStatus status` - - The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. - - - `QUEUED("queued")` - - - `IN_PROGRESS("in_progress")` - - - `REQUIRES_ACTION("requires_action")` - - - `CANCELLING("cancelling")` - - - `CANCELLED("cancelled")` - - - `FAILED("failed")` - - - `COMPLETED("completed")` - - - `INCOMPLETE("incomplete")` - - - `EXPIRED("expired")` + - `JsonValue status` - `String threadId` @@ -4314,95 +3689,23 @@ When a run has the `status: "requires_action"` and `required_action.type` is `su The name of the function to call. - - `List tools` + - `List tools` The list of tools that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run. - - `class CodeInterpreterTool:` + - `Optional truncationStrategy` - - `JsonValue; type "code_interpreter"constant` + Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run. - The type of tool being defined: `code_interpreter` + - `Type type` - - `CODE_INTERPRETER("code_interpreter")` + The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`. - - `class FileSearchTool:` + - `AUTO("auto")` - - `JsonValue; type "file_search"constant` + - `LAST_MESSAGES("last_messages")` - The type of tool being defined: `file_search` - - - `FILE_SEARCH("file_search")` - - - `Optional fileSearch` - - Overrides for the file search tool. - - - `Optional maxNumResults` - - The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `Optional rankingOptions` - - The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - - See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `double scoreThreshold` - - The score threshold for the file search. All values must be a floating point number between 0 and 1. - - - `Optional ranker` - - The ranker to use for the file search. If not specified will use the `auto` ranker. - - - `AUTO("auto")` - - - `DEFAULT_2024_08_21("default_2024_08_21")` - - - `class FunctionTool:` - - - `FunctionDefinition function` - - - `String name` - - The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - - - `Optional description` - - A description of what the function does, used by the model to choose when and how to call the function. - - - `Optional parameters` - - The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. - - - `Optional strict` - - Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://platform.openai.com/docs/guides/function-calling). - - - `JsonValue; type "function"constant` - - The type of tool being defined: `function` - - - `FUNCTION("function")` - - - `Optional truncationStrategy` - - Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run. - - - `Type type` - - The truncation strategy to use for the thread. The default is `auto`. If set to `last_messages`, the thread will be truncated to the n most recent messages in the thread. When set to `auto`, messages in the middle of the thread will be dropped to fit the context length of the model, `max_prompt_tokens`. - - - `AUTO("auto")` - - - `LAST_MESSAGES("last_messages")` - - - `Optional lastMessages` + - `Optional lastMessages` The number of most recent messages from the thread when constructing the context for the run. @@ -4500,13 +3803,11 @@ public final class Main { }, "response_format": "auto", "started_at": 0, - "status": "queued", + "status": {}, "thread_id": "thread_id", "tool_choice": "none", "tools": [ - { - "type": "code_interpreter" - } + {} ], "truncation_strategy": { "type": "auto", @@ -4528,7 +3829,7 @@ public final class Main { **post** `/threads/{thread_id}/runs/{run_id}/cancel` -Cancels a run that is `in_progress`. +Cancel a run ### Parameters @@ -4756,27 +4057,7 @@ Cancels a run that is `in_progress`. The Unix timestamp (in seconds) for when the run was started. - - `RunStatus status` - - The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. - - - `QUEUED("queued")` - - - `IN_PROGRESS("in_progress")` - - - `REQUIRES_ACTION("requires_action")` - - - `CANCELLING("cancelling")` - - - `CANCELLED("cancelled")` - - - `FAILED("failed")` - - - `COMPLETED("completed")` - - - `INCOMPLETE("incomplete")` - - - `EXPIRED("expired")` + - `JsonValue status` - `String threadId` @@ -4818,82 +4099,10 @@ Cancels a run that is `in_progress`. The name of the function to call. - - `List tools` + - `List tools` The list of tools that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run. - - `class CodeInterpreterTool:` - - - `JsonValue; type "code_interpreter"constant` - - The type of tool being defined: `code_interpreter` - - - `CODE_INTERPRETER("code_interpreter")` - - - `class FileSearchTool:` - - - `JsonValue; type "file_search"constant` - - The type of tool being defined: `file_search` - - - `FILE_SEARCH("file_search")` - - - `Optional fileSearch` - - Overrides for the file search tool. - - - `Optional maxNumResults` - - The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `Optional rankingOptions` - - The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - - See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `double scoreThreshold` - - The score threshold for the file search. All values must be a floating point number between 0 and 1. - - - `Optional ranker` - - The ranker to use for the file search. If not specified will use the `auto` ranker. - - - `AUTO("auto")` - - - `DEFAULT_2024_08_21("default_2024_08_21")` - - - `class FunctionTool:` - - - `FunctionDefinition function` - - - `String name` - - The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - - - `Optional description` - - A description of what the function does, used by the model to choose when and how to call the function. - - - `Optional parameters` - - The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. - - - `Optional strict` - - Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://platform.openai.com/docs/guides/function-calling). - - - `JsonValue; type "function"constant` - - The type of tool being defined: `function` - - - `FUNCTION("function")` - - `Optional truncationStrategy` Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run. @@ -5003,13 +4212,11 @@ public final class Main { }, "response_format": "auto", "started_at": 0, - "status": "queued", + "status": {}, "thread_id": "thread_id", "tool_choice": "none", "tools": [ - { - "type": "code_interpreter" - } + {} ], "truncation_strategy": { "type": "auto", @@ -5273,27 +4480,7 @@ public final class Main { The Unix timestamp (in seconds) for when the run was started. - - `RunStatus status` - - The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. - - - `QUEUED("queued")` - - - `IN_PROGRESS("in_progress")` - - - `REQUIRES_ACTION("requires_action")` - - - `CANCELLING("cancelling")` - - - `CANCELLED("cancelled")` - - - `FAILED("failed")` - - - `COMPLETED("completed")` - - - `INCOMPLETE("incomplete")` - - - `EXPIRED("expired")` + - `JsonValue status` - `String threadId` @@ -5335,82 +4522,10 @@ public final class Main { The name of the function to call. - - `List tools` + - `List tools` The list of tools that the [assistant](https://platform.openai.com/docs/api-reference/assistants) used for this run. - - `class CodeInterpreterTool:` - - - `JsonValue; type "code_interpreter"constant` - - The type of tool being defined: `code_interpreter` - - - `CODE_INTERPRETER("code_interpreter")` - - - `class FileSearchTool:` - - - `JsonValue; type "file_search"constant` - - The type of tool being defined: `file_search` - - - `FILE_SEARCH("file_search")` - - - `Optional fileSearch` - - Overrides for the file search tool. - - - `Optional maxNumResults` - - The maximum number of results the file search tool should output. The default is 20 for `gpt-4*` models and 5 for `gpt-3.5-turbo`. This number should be between 1 and 50 inclusive. - - Note that the file search tool may output fewer than `max_num_results` results. See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `Optional rankingOptions` - - The ranking options for the file search. If not specified, the file search tool will use the `auto` ranker and a score_threshold of 0. - - See the [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) for more information. - - - `double scoreThreshold` - - The score threshold for the file search. All values must be a floating point number between 0 and 1. - - - `Optional ranker` - - The ranker to use for the file search. If not specified will use the `auto` ranker. - - - `AUTO("auto")` - - - `DEFAULT_2024_08_21("default_2024_08_21")` - - - `class FunctionTool:` - - - `FunctionDefinition function` - - - `String name` - - The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - - - `Optional description` - - A description of what the function does, used by the model to choose when and how to call the function. - - - `Optional parameters` - - The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. - - Omitting `parameters` defines a function with an empty parameter list. - - - `Optional strict` - - Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](https://platform.openai.com/docs/guides/function-calling). - - - `JsonValue; type "function"constant` - - The type of tool being defined: `function` - - - `FUNCTION("function")` - - `Optional truncationStrategy` Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run. @@ -5453,27 +4568,7 @@ public final class Main { ### Run Status -- `enum RunStatus:` - - The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. - - - `QUEUED("queued")` - - - `IN_PROGRESS("in_progress")` - - - `REQUIRES_ACTION("requires_action")` - - - `CANCELLING("cancelling")` - - - `CANCELLED("cancelled")` - - - `FAILED("failed")` - - - `COMPLETED("completed")` - - - `INCOMPLETE("incomplete")` - - - `EXPIRED("expired")` +- `class RunStatus:` # Steps @@ -5483,7 +4578,7 @@ public final class Main { **get** `/threads/{thread_id}/runs/{run_id}/steps` -Returns a list of run steps belonging to a run. +List run steps ### Parameters @@ -5628,187 +4723,43 @@ Returns a list of run steps belonging to a run. Details of the tool call. - - `List toolCalls` + - `List toolCalls` An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`. - - `class CodeInterpreterToolCall:` + - `JsonValue; type "tool_calls"constant` - Details of the Code Interpreter tool call the run step was involved in. + Always `tool_calls`. - - `String id` + - `TOOL_CALLS("tool_calls")` - The ID of the tool call. + - `String threadId` - - `CodeInterpreter codeInterpreter` + The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was run. - The Code Interpreter tool call definition. + - `Type type` - - `String input` + The type of run step, which can be either `message_creation` or `tool_calls`. - The input to the Code Interpreter tool call. + - `MESSAGE_CREATION("message_creation")` - - `List outputs` + - `TOOL_CALLS("tool_calls")` - The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. + - `Optional usage` - - `class LogsOutput:` + Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. - Text output from the Code Interpreter tool call as part of a run step. + - `long completionTokens` - - `String logs` + Number of completion tokens used over the course of the run step. - The text output from the Code Interpreter tool call. + - `long promptTokens` - - `JsonValue; type "logs"constant` + Number of prompt tokens used over the course of the run step. - Always `logs`. + - `long totalTokens` - - `LOGS("logs")` - - - `class ImageOutput:` - - - `Image image` - - - `String fileId` - - The [file](https://platform.openai.com/docs/api-reference/files) ID of the image. - - - `JsonValue; type "image"constant` - - Always `image`. - - - `IMAGE("image")` - - - `JsonValue; type "code_interpreter"constant` - - The type of tool call. This is always going to be `code_interpreter` for this type of tool call. - - - `CODE_INTERPRETER("code_interpreter")` - - - `class FileSearchToolCall:` - - - `String id` - - The ID of the tool call object. - - - `FileSearch fileSearch` - - For now, this is always going to be an empty object. - - - `Optional rankingOptions` - - The ranking options for the file search. - - - `Ranker ranker` - - The ranker to use for the file search. If not specified will use the `auto` ranker. - - - `AUTO("auto")` - - - `DEFAULT_2024_08_21("default_2024_08_21")` - - - `double scoreThreshold` - - The score threshold for the file search. All values must be a floating point number between 0 and 1. - - - `Optional> results` - - The results of the file search. - - - `String fileId` - - The ID of the file that result was found in. - - - `String fileName` - - The name of the file that result was found in. - - - `double score` - - The score of the result. All values must be a floating point number between 0 and 1. - - - `Optional> content` - - The content of the result that was found. The content is only included if requested via the include query parameter. - - - `Optional text` - - The text content of the file. - - - `Optional type` - - The type of the content. - - - `TEXT("text")` - - - `JsonValue; type "file_search"constant` - - The type of tool call. This is always going to be `file_search` for this type of tool call. - - - `FILE_SEARCH("file_search")` - - - `class FunctionToolCall:` - - - `String id` - - The ID of the tool call object. - - - `Function function` - - The definition of the function that was called. - - - `String arguments` - - The arguments passed to the function. - - - `String name` - - The name of the function. - - - `Optional output` - - The output of the function. This will be `null` if the outputs have not been [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) yet. - - - `JsonValue; type "function"constant` - - The type of tool call. This is always going to be `function` for this type of tool call. - - - `FUNCTION("function")` - - - `JsonValue; type "tool_calls"constant` - - Always `tool_calls`. - - - `TOOL_CALLS("tool_calls")` - - - `String threadId` - - The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was run. - - - `Type type` - - The type of run step, which can be either `message_creation` or `tool_calls`. - - - `MESSAGE_CREATION("message_creation")` - - - `TOOL_CALLS("tool_calls")` - - - `Optional usage` - - Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. - - - `long completionTokens` - - Number of completion tokens used over the course of the run step. - - - `long promptTokens` - - Number of prompt tokens used over the course of the run step. - - - `long totalTokens` - - Total number of tokens used (prompt + completion). + Total number of tokens used (prompt + completion). ### Example @@ -5886,7 +4837,7 @@ public final class Main { **get** `/threads/{thread_id}/runs/{run_id}/steps/{step_id}` -Retrieves a run step. +Retrieve run step ### Parameters @@ -6013,270 +4964,126 @@ Retrieves a run step. Details of the tool call. - - `List toolCalls` + - `List toolCalls` An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`. - - `class CodeInterpreterToolCall:` + - `JsonValue; type "tool_calls"constant` - Details of the Code Interpreter tool call the run step was involved in. + Always `tool_calls`. - - `String id` + - `TOOL_CALLS("tool_calls")` - The ID of the tool call. + - `String threadId` - - `CodeInterpreter codeInterpreter` + The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was run. - The Code Interpreter tool call definition. + - `Type type` - - `String input` + The type of run step, which can be either `message_creation` or `tool_calls`. - The input to the Code Interpreter tool call. + - `MESSAGE_CREATION("message_creation")` - - `List outputs` + - `TOOL_CALLS("tool_calls")` - The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. + - `Optional usage` - - `class LogsOutput:` + Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. - Text output from the Code Interpreter tool call as part of a run step. + - `long completionTokens` - - `String logs` + Number of completion tokens used over the course of the run step. - The text output from the Code Interpreter tool call. + - `long promptTokens` - - `JsonValue; type "logs"constant` + Number of prompt tokens used over the course of the run step. - Always `logs`. + - `long totalTokens` - - `LOGS("logs")` + Total number of tokens used (prompt + completion). - - `class ImageOutput:` +### Example - - `Image image` +```java +package com.openai.example; - - `String fileId` +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.beta.threads.runs.steps.RunStep; +import com.openai.models.beta.threads.runs.steps.StepRetrieveParams; - The [file](https://platform.openai.com/docs/api-reference/files) ID of the image. +public final class Main { + private Main() {} - - `JsonValue; type "image"constant` + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); - Always `image`. + StepRetrieveParams params = StepRetrieveParams.builder() + .threadId("thread_id") + .runId("run_id") + .stepId("step_id") + .build(); + RunStep runStep = client.beta().threads().runs().steps().retrieve(params); + } +} +``` - - `IMAGE("image")` +#### Response - - `JsonValue; type "code_interpreter"constant` +```json +{ + "id": "id", + "assistant_id": "assistant_id", + "cancelled_at": 0, + "completed_at": 0, + "created_at": 0, + "expired_at": 0, + "failed_at": 0, + "last_error": { + "code": "server_error", + "message": "message" + }, + "metadata": { + "foo": "string" + }, + "object": "thread.run.step", + "run_id": "run_id", + "status": "in_progress", + "step_details": { + "message_creation": { + "message_id": "message_id" + }, + "type": "message_creation" + }, + "thread_id": "thread_id", + "type": "message_creation", + "usage": { + "completion_tokens": 0, + "prompt_tokens": 0, + "total_tokens": 0 + } +} +``` - The type of tool call. This is always going to be `code_interpreter` for this type of tool call. +## Domain Types - - `CODE_INTERPRETER("code_interpreter")` +### Code Interpreter Logs - - `class FileSearchToolCall:` +- `class CodeInterpreterLogs:` - - `String id` + Text output from the Code Interpreter tool call as part of a run step. - The ID of the tool call object. + - `long index` - - `FileSearch fileSearch` + The index of the output in the outputs array. - For now, this is always going to be an empty object. + - `JsonValue; type "logs"constant` - - `Optional rankingOptions` + Always `logs`. - The ranking options for the file search. + - `LOGS("logs")` - - `Ranker ranker` - - The ranker to use for the file search. If not specified will use the `auto` ranker. - - - `AUTO("auto")` - - - `DEFAULT_2024_08_21("default_2024_08_21")` - - - `double scoreThreshold` - - The score threshold for the file search. All values must be a floating point number between 0 and 1. - - - `Optional> results` - - The results of the file search. - - - `String fileId` - - The ID of the file that result was found in. - - - `String fileName` - - The name of the file that result was found in. - - - `double score` - - The score of the result. All values must be a floating point number between 0 and 1. - - - `Optional> content` - - The content of the result that was found. The content is only included if requested via the include query parameter. - - - `Optional text` - - The text content of the file. - - - `Optional type` - - The type of the content. - - - `TEXT("text")` - - - `JsonValue; type "file_search"constant` - - The type of tool call. This is always going to be `file_search` for this type of tool call. - - - `FILE_SEARCH("file_search")` - - - `class FunctionToolCall:` - - - `String id` - - The ID of the tool call object. - - - `Function function` - - The definition of the function that was called. - - - `String arguments` - - The arguments passed to the function. - - - `String name` - - The name of the function. - - - `Optional output` - - The output of the function. This will be `null` if the outputs have not been [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) yet. - - - `JsonValue; type "function"constant` - - The type of tool call. This is always going to be `function` for this type of tool call. - - - `FUNCTION("function")` - - - `JsonValue; type "tool_calls"constant` - - Always `tool_calls`. - - - `TOOL_CALLS("tool_calls")` - - - `String threadId` - - The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was run. - - - `Type type` - - The type of run step, which can be either `message_creation` or `tool_calls`. - - - `MESSAGE_CREATION("message_creation")` - - - `TOOL_CALLS("tool_calls")` - - - `Optional usage` - - Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. - - - `long completionTokens` - - Number of completion tokens used over the course of the run step. - - - `long promptTokens` - - Number of prompt tokens used over the course of the run step. - - - `long totalTokens` - - Total number of tokens used (prompt + completion). - -### Example - -```java -package com.openai.example; - -import com.openai.client.OpenAIClient; -import com.openai.client.okhttp.OpenAIOkHttpClient; -import com.openai.models.beta.threads.runs.steps.RunStep; -import com.openai.models.beta.threads.runs.steps.StepRetrieveParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - OpenAIClient client = OpenAIOkHttpClient.fromEnv(); - - StepRetrieveParams params = StepRetrieveParams.builder() - .threadId("thread_id") - .runId("run_id") - .stepId("step_id") - .build(); - RunStep runStep = client.beta().threads().runs().steps().retrieve(params); - } -} -``` - -#### Response - -```json -{ - "id": "id", - "assistant_id": "assistant_id", - "cancelled_at": 0, - "completed_at": 0, - "created_at": 0, - "expired_at": 0, - "failed_at": 0, - "last_error": { - "code": "server_error", - "message": "message" - }, - "metadata": { - "foo": "string" - }, - "object": "thread.run.step", - "run_id": "run_id", - "status": "in_progress", - "step_details": { - "message_creation": { - "message_id": "message_id" - }, - "type": "message_creation" - }, - "thread_id": "thread_id", - "type": "message_creation", - "usage": { - "completion_tokens": 0, - "prompt_tokens": 0, - "total_tokens": 0 - } -} -``` - -## Domain Types - -### Code Interpreter Logs - -- `class CodeInterpreterLogs:` - - Text output from the Code Interpreter tool call as part of a run step. - - - `long index` - - The index of the output in the outputs array. - - - `JsonValue; type "logs"constant` - - Always `logs`. - - - `LOGS("logs")` - - - `Optional logs` + - `Optional logs` The text output from the Code Interpreter tool call. @@ -6699,153 +5506,123 @@ public final class Main { Details of the tool call. - - `List toolCalls` + - `List toolCalls` An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`. - - `class CodeInterpreterToolCall:` + - `JsonValue; type "tool_calls"constant` - Details of the Code Interpreter tool call the run step was involved in. + Always `tool_calls`. - - `String id` + - `TOOL_CALLS("tool_calls")` - The ID of the tool call. + - `String threadId` - - `CodeInterpreter codeInterpreter` + The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was run. - The Code Interpreter tool call definition. + - `Type type` - - `String input` + The type of run step, which can be either `message_creation` or `tool_calls`. - The input to the Code Interpreter tool call. + - `MESSAGE_CREATION("message_creation")` - - `List outputs` + - `TOOL_CALLS("tool_calls")` - The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. + - `Optional usage` - - `class LogsOutput:` + Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. - Text output from the Code Interpreter tool call as part of a run step. + - `long completionTokens` - - `String logs` + Number of completion tokens used over the course of the run step. - The text output from the Code Interpreter tool call. + - `long promptTokens` - - `JsonValue; type "logs"constant` + Number of prompt tokens used over the course of the run step. - Always `logs`. + - `long totalTokens` - - `LOGS("logs")` + Total number of tokens used (prompt + completion). - - `class ImageOutput:` +### Run Step Delta - - `Image image` +- `class RunStepDelta:` - - `String fileId` +### Run Step Delta Event - The [file](https://platform.openai.com/docs/api-reference/files) ID of the image. +- `class RunStepDeltaEvent:` - - `JsonValue; type "image"constant` + Represents a run step delta i.e. any changed fields on a run step during streaming. - Always `image`. + - `String id` - - `IMAGE("image")` + The identifier of the run step, which can be referenced in API endpoints. - - `JsonValue; type "code_interpreter"constant` + - `JsonValue delta` - The type of tool call. This is always going to be `code_interpreter` for this type of tool call. + - `JsonValue; object_ "thread.run.step.delta"constant` - - `CODE_INTERPRETER("code_interpreter")` + The object type, which is always `thread.run.step.delta`. - - `class FileSearchToolCall:` + - `THREAD_RUN_STEP_DELTA("thread.run.step.delta")` - - `String id` +### Run Step Delta Message Delta - The ID of the tool call object. +- `class RunStepDeltaMessageDelta:` - - `FileSearch fileSearch` + Details of the message creation by the run step. - For now, this is always going to be an empty object. + - `JsonValue; type "message_creation"constant` - - `Optional rankingOptions` + Always `message_creation`. - The ranking options for the file search. + - `MESSAGE_CREATION("message_creation")` - - `Ranker ranker` - - The ranker to use for the file search. If not specified will use the `auto` ranker. - - - `AUTO("auto")` - - - `DEFAULT_2024_08_21("default_2024_08_21")` - - - `double scoreThreshold` - - The score threshold for the file search. All values must be a floating point number between 0 and 1. - - - `Optional> results` - - The results of the file search. - - - `String fileId` - - The ID of the file that result was found in. - - - `String fileName` - - The name of the file that result was found in. - - - `double score` - - The score of the result. All values must be a floating point number between 0 and 1. - - - `Optional> content` - - The content of the result that was found. The content is only included if requested via the include query parameter. + - `Optional messageCreation` - - `Optional text` + - `Optional messageId` - The text content of the file. + The ID of the message that was created by this run step. - - `Optional type` +### Run Step Include - The type of the content. +- `enum RunStepInclude:` - - `TEXT("text")` + - `STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT("step_details.tool_calls[*].file_search.results[*].content")` - - `JsonValue; type "file_search"constant` +### Tool Call - The type of tool call. This is always going to be `file_search` for this type of tool call. +- `class ToolCall:` - - `FILE_SEARCH("file_search")` +### Tool Call Delta - - `class FunctionToolCall:` +- `class ToolCallDelta:` - - `String id` +### Tool Call Delta Object - The ID of the tool call object. +- `class ToolCallDeltaObject:` - - `Function function` + Details of the tool call. - The definition of the function that was called. + - `JsonValue; type "tool_calls"constant` - - `String arguments` + Always `tool_calls`. - The arguments passed to the function. + - `TOOL_CALLS("tool_calls")` - - `String name` + - `Optional> toolCalls` - The name of the function. + An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`. - - `Optional output` +### Tool Calls Step Details - The output of the function. This will be `null` if the outputs have not been [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) yet. +- `class ToolCallsStepDetails:` - - `JsonValue; type "function"constant` + Details of the tool call. - The type of tool call. This is always going to be `function` for this type of tool call. + - `List toolCalls` - - `FUNCTION("function")` + An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`. - `JsonValue; type "tool_calls"constant` @@ -6853,2842 +5630,263 @@ public final class Main { - `TOOL_CALLS("tool_calls")` - - `String threadId` - - The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was run. - - - `Type type` - - The type of run step, which can be either `message_creation` or `tool_calls`. - - - `MESSAGE_CREATION("message_creation")` +# Messages - - `TOOL_CALLS("tool_calls")` +## List messages - - `Optional usage` +`MessageListPage beta().threads().messages().list(MessageListParamsparams = MessageListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. +**get** `/threads/{thread_id}/messages` - - `long completionTokens` +List messages - Number of completion tokens used over the course of the run step. +### Parameters - - `long promptTokens` +- `MessageListParams params` - Number of prompt tokens used over the course of the run step. + - `Optional threadId` - - `long totalTokens` + - `Optional after` - Total number of tokens used (prompt + completion). + 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. -### Run Step Delta + - `Optional before` -- `class RunStepDelta:` + 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, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. - The delta containing the fields that have changed on the run step. + - `Optional limit` - - `Optional stepDetails` + A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - The details of the run step. + - `Optional order` - - `class RunStepDeltaMessageDelta:` + Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. - Details of the message creation by the run step. + - `ASC("asc")` - - `JsonValue; type "message_creation"constant` + - `DESC("desc")` - Always `message_creation`. + - `Optional runId` - - `MESSAGE_CREATION("message_creation")` + Filter messages by the run ID that generated them. - - `Optional messageCreation` +### Returns - - `Optional messageId` +- `class Message:` - The ID of the message that was created by this run step. + Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads). - - `class ToolCallDeltaObject:` + - `String id` - Details of the tool call. + The identifier, which can be referenced in API endpoints. - - `JsonValue; type "tool_calls"constant` + - `Optional assistantId` - Always `tool_calls`. + If applicable, the ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) that authored this message. - - `TOOL_CALLS("tool_calls")` + - `Optional> attachments` - - `Optional> toolCalls` + A list of files attached to the message, and the tools they were added to. - An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`. + - `Optional fileId` - - `class CodeInterpreterToolCallDelta:` + The ID of the file to attach to the message. - Details of the Code Interpreter tool call the run step was involved in. + - `Optional> tools` - - `long index` + The tools to add this file to. - The index of the tool call in the tool calls array. + - `class CodeInterpreterTool:` - `JsonValue; type "code_interpreter"constant` - The type of tool call. This is always going to be `code_interpreter` for this type of tool call. + The type of tool being defined: `code_interpreter` - `CODE_INTERPRETER("code_interpreter")` - - `Optional id` - - The ID of the tool call. - - - `Optional codeInterpreter` - - The Code Interpreter tool call definition. - - - `Optional input` - - The input to the Code Interpreter tool call. - - - `Optional> outputs` + - `JsonValue;` - The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. + - `JsonValue; type "file_search"constant` - - `class CodeInterpreterLogs:` + The type of tool being defined: `file_search` - Text output from the Code Interpreter tool call as part of a run step. + - `FILE_SEARCH("file_search")` - - `long index` + - `Optional completedAt` - The index of the output in the outputs array. + The Unix timestamp (in seconds) for when the message was completed. - - `JsonValue; type "logs"constant` + - `List content` - Always `logs`. + The content of the message in array of text and/or images. - - `LOGS("logs")` + - `long createdAt` - - `Optional logs` + The Unix timestamp (in seconds) for when the message was created. - The text output from the Code Interpreter tool call. + - `Optional incompleteAt` - - `class CodeInterpreterOutputImage:` + The Unix timestamp (in seconds) for when the message was marked as incomplete. - - `long index` + - `Optional incompleteDetails` - The index of the output in the outputs array. + On an incomplete message, details about why the message is incomplete. - - `JsonValue; type "image"constant` + - `Reason reason` - Always `image`. + The reason the message is incomplete. - - `IMAGE("image")` + - `CONTENT_FILTER("content_filter")` - - `Optional image` + - `MAX_TOKENS("max_tokens")` - - `Optional fileId` + - `RUN_CANCELLED("run_cancelled")` - The [file](https://platform.openai.com/docs/api-reference/files) ID of the image. + - `RUN_EXPIRED("run_expired")` - - `class FileSearchToolCallDelta:` + - `RUN_FAILED("run_failed")` - - `JsonValue fileSearch` + - `Optional metadata` - For now, this is always going to be an empty object. + 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. - - `long index` + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. - The index of the tool call in the tool calls array. + - `JsonValue; object_ "thread.message"constant` - - `JsonValue; type "file_search"constant` + The object type, which is always `thread.message`. - The type of tool call. This is always going to be `file_search` for this type of tool call. + - `THREAD_MESSAGE("thread.message")` - - `FILE_SEARCH("file_search")` + - `Role role` - - `Optional id` + The entity that produced the message. One of `user` or `assistant`. - The ID of the tool call object. + - `USER("user")` - - `class FunctionToolCallDelta:` + - `ASSISTANT("assistant")` - - `long index` + - `Optional runId` - The index of the tool call in the tool calls array. + The ID of the [run](https://platform.openai.com/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. - - `JsonValue; type "function"constant` + - `Status status` - The type of tool call. This is always going to be `function` for this type of tool call. + The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. - - `FUNCTION("function")` + - `IN_PROGRESS("in_progress")` - - `Optional id` + - `INCOMPLETE("incomplete")` - The ID of the tool call object. + - `COMPLETED("completed")` - - `Optional function` + - `String threadId` - The definition of the function that was called. + The [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to. - - `Optional arguments` +### Example - The arguments passed to the function. +```java +package com.openai.example; - - `Optional name` +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.beta.threads.messages.MessageListPage; +import com.openai.models.beta.threads.messages.MessageListParams; - The name of the function. +public final class Main { + private Main() {} - - `Optional output` + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); - The output of the function. This will be `null` if the outputs have not been [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) yet. + MessageListPage page = client.beta().threads().messages().list("thread_id"); + } +} +``` -### Run Step Delta Event +#### Response -- `class RunStepDeltaEvent:` - - Represents a run step delta i.e. any changed fields on a run step during streaming. - - - `String id` - - The identifier of the run step, which can be referenced in API endpoints. - - - `RunStepDelta delta` - - The delta containing the fields that have changed on the run step. - - - `Optional stepDetails` - - The details of the run step. - - - `class RunStepDeltaMessageDelta:` - - Details of the message creation by the run step. - - - `JsonValue; type "message_creation"constant` - - Always `message_creation`. - - - `MESSAGE_CREATION("message_creation")` - - - `Optional messageCreation` - - - `Optional messageId` - - The ID of the message that was created by this run step. - - - `class ToolCallDeltaObject:` - - Details of the tool call. - - - `JsonValue; type "tool_calls"constant` - - Always `tool_calls`. - - - `TOOL_CALLS("tool_calls")` - - - `Optional> toolCalls` - - An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`. - - - `class CodeInterpreterToolCallDelta:` - - Details of the Code Interpreter tool call the run step was involved in. - - - `long index` - - The index of the tool call in the tool calls array. - - - `JsonValue; type "code_interpreter"constant` - - The type of tool call. This is always going to be `code_interpreter` for this type of tool call. - - - `CODE_INTERPRETER("code_interpreter")` - - - `Optional id` - - The ID of the tool call. - - - `Optional codeInterpreter` - - The Code Interpreter tool call definition. - - - `Optional input` - - The input to the Code Interpreter tool call. - - - `Optional> outputs` - - The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. - - - `class CodeInterpreterLogs:` - - Text output from the Code Interpreter tool call as part of a run step. - - - `long index` - - The index of the output in the outputs array. - - - `JsonValue; type "logs"constant` - - Always `logs`. - - - `LOGS("logs")` - - - `Optional logs` - - The text output from the Code Interpreter tool call. - - - `class CodeInterpreterOutputImage:` - - - `long index` - - The index of the output in the outputs array. - - - `JsonValue; type "image"constant` - - Always `image`. - - - `IMAGE("image")` - - - `Optional image` - - - `Optional fileId` - - The [file](https://platform.openai.com/docs/api-reference/files) ID of the image. - - - `class FileSearchToolCallDelta:` - - - `JsonValue fileSearch` - - For now, this is always going to be an empty object. - - - `long index` - - The index of the tool call in the tool calls array. - - - `JsonValue; type "file_search"constant` - - The type of tool call. This is always going to be `file_search` for this type of tool call. - - - `FILE_SEARCH("file_search")` - - - `Optional id` - - The ID of the tool call object. - - - `class FunctionToolCallDelta:` - - - `long index` - - The index of the tool call in the tool calls array. - - - `JsonValue; type "function"constant` - - The type of tool call. This is always going to be `function` for this type of tool call. - - - `FUNCTION("function")` - - - `Optional id` - - The ID of the tool call object. - - - `Optional function` - - The definition of the function that was called. - - - `Optional arguments` - - The arguments passed to the function. - - - `Optional name` - - The name of the function. - - - `Optional output` - - The output of the function. This will be `null` if the outputs have not been [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) yet. - - - `JsonValue; object_ "thread.run.step.delta"constant` - - The object type, which is always `thread.run.step.delta`. - - - `THREAD_RUN_STEP_DELTA("thread.run.step.delta")` - -### Run Step Delta Message Delta - -- `class RunStepDeltaMessageDelta:` - - Details of the message creation by the run step. - - - `JsonValue; type "message_creation"constant` - - Always `message_creation`. - - - `MESSAGE_CREATION("message_creation")` - - - `Optional messageCreation` - - - `Optional messageId` - - The ID of the message that was created by this run step. - -### Run Step Include - -- `enum RunStepInclude:` - - - `STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT("step_details.tool_calls[*].file_search.results[*].content")` - -### Tool Call - -- `class ToolCall: A class that can be one of several variants.union` - - Details of the Code Interpreter tool call the run step was involved in. - - - `class CodeInterpreterToolCall:` - - Details of the Code Interpreter tool call the run step was involved in. - - - `String id` - - The ID of the tool call. - - - `CodeInterpreter codeInterpreter` - - The Code Interpreter tool call definition. - - - `String input` - - The input to the Code Interpreter tool call. - - - `List outputs` - - The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. - - - `class LogsOutput:` - - Text output from the Code Interpreter tool call as part of a run step. - - - `String logs` - - The text output from the Code Interpreter tool call. - - - `JsonValue; type "logs"constant` - - Always `logs`. - - - `LOGS("logs")` - - - `class ImageOutput:` - - - `Image image` - - - `String fileId` - - The [file](https://platform.openai.com/docs/api-reference/files) ID of the image. - - - `JsonValue; type "image"constant` - - Always `image`. - - - `IMAGE("image")` - - - `JsonValue; type "code_interpreter"constant` - - The type of tool call. This is always going to be `code_interpreter` for this type of tool call. - - - `CODE_INTERPRETER("code_interpreter")` - - - `class FileSearchToolCall:` - - - `String id` - - The ID of the tool call object. - - - `FileSearch fileSearch` - - For now, this is always going to be an empty object. - - - `Optional rankingOptions` - - The ranking options for the file search. - - - `Ranker ranker` - - The ranker to use for the file search. If not specified will use the `auto` ranker. - - - `AUTO("auto")` - - - `DEFAULT_2024_08_21("default_2024_08_21")` - - - `double scoreThreshold` - - The score threshold for the file search. All values must be a floating point number between 0 and 1. - - - `Optional> results` - - The results of the file search. - - - `String fileId` - - The ID of the file that result was found in. - - - `String fileName` - - The name of the file that result was found in. - - - `double score` - - The score of the result. All values must be a floating point number between 0 and 1. - - - `Optional> content` - - The content of the result that was found. The content is only included if requested via the include query parameter. - - - `Optional text` - - The text content of the file. - - - `Optional type` - - The type of the content. - - - `TEXT("text")` - - - `JsonValue; type "file_search"constant` - - The type of tool call. This is always going to be `file_search` for this type of tool call. - - - `FILE_SEARCH("file_search")` - - - `class FunctionToolCall:` - - - `String id` - - The ID of the tool call object. - - - `Function function` - - The definition of the function that was called. - - - `String arguments` - - The arguments passed to the function. - - - `String name` - - The name of the function. - - - `Optional output` - - The output of the function. This will be `null` if the outputs have not been [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) yet. - - - `JsonValue; type "function"constant` - - The type of tool call. This is always going to be `function` for this type of tool call. - - - `FUNCTION("function")` - -### Tool Call Delta - -- `class ToolCallDelta: A class that can be one of several variants.union` - - Details of the Code Interpreter tool call the run step was involved in. - - - `class CodeInterpreterToolCallDelta:` - - Details of the Code Interpreter tool call the run step was involved in. - - - `long index` - - The index of the tool call in the tool calls array. - - - `JsonValue; type "code_interpreter"constant` - - The type of tool call. This is always going to be `code_interpreter` for this type of tool call. - - - `CODE_INTERPRETER("code_interpreter")` - - - `Optional id` - - The ID of the tool call. - - - `Optional codeInterpreter` - - The Code Interpreter tool call definition. - - - `Optional input` - - The input to the Code Interpreter tool call. - - - `Optional> outputs` - - The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. - - - `class CodeInterpreterLogs:` - - Text output from the Code Interpreter tool call as part of a run step. - - - `long index` - - The index of the output in the outputs array. - - - `JsonValue; type "logs"constant` - - Always `logs`. - - - `LOGS("logs")` - - - `Optional logs` - - The text output from the Code Interpreter tool call. - - - `class CodeInterpreterOutputImage:` - - - `long index` - - The index of the output in the outputs array. - - - `JsonValue; type "image"constant` - - Always `image`. - - - `IMAGE("image")` - - - `Optional image` - - - `Optional fileId` - - The [file](https://platform.openai.com/docs/api-reference/files) ID of the image. - - - `class FileSearchToolCallDelta:` - - - `JsonValue fileSearch` - - For now, this is always going to be an empty object. - - - `long index` - - The index of the tool call in the tool calls array. - - - `JsonValue; type "file_search"constant` - - The type of tool call. This is always going to be `file_search` for this type of tool call. - - - `FILE_SEARCH("file_search")` - - - `Optional id` - - The ID of the tool call object. - - - `class FunctionToolCallDelta:` - - - `long index` - - The index of the tool call in the tool calls array. - - - `JsonValue; type "function"constant` - - The type of tool call. This is always going to be `function` for this type of tool call. - - - `FUNCTION("function")` - - - `Optional id` - - The ID of the tool call object. - - - `Optional function` - - The definition of the function that was called. - - - `Optional arguments` - - The arguments passed to the function. - - - `Optional name` - - The name of the function. - - - `Optional output` - - The output of the function. This will be `null` if the outputs have not been [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) yet. - -### Tool Call Delta Object - -- `class ToolCallDeltaObject:` - - Details of the tool call. - - - `JsonValue; type "tool_calls"constant` - - Always `tool_calls`. - - - `TOOL_CALLS("tool_calls")` - - - `Optional> toolCalls` - - An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`. - - - `class CodeInterpreterToolCallDelta:` - - Details of the Code Interpreter tool call the run step was involved in. - - - `long index` - - The index of the tool call in the tool calls array. - - - `JsonValue; type "code_interpreter"constant` - - The type of tool call. This is always going to be `code_interpreter` for this type of tool call. - - - `CODE_INTERPRETER("code_interpreter")` - - - `Optional id` - - The ID of the tool call. - - - `Optional codeInterpreter` - - The Code Interpreter tool call definition. - - - `Optional input` - - The input to the Code Interpreter tool call. - - - `Optional> outputs` - - The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. - - - `class CodeInterpreterLogs:` - - Text output from the Code Interpreter tool call as part of a run step. - - - `long index` - - The index of the output in the outputs array. - - - `JsonValue; type "logs"constant` - - Always `logs`. - - - `LOGS("logs")` - - - `Optional logs` - - The text output from the Code Interpreter tool call. - - - `class CodeInterpreterOutputImage:` - - - `long index` - - The index of the output in the outputs array. - - - `JsonValue; type "image"constant` - - Always `image`. - - - `IMAGE("image")` - - - `Optional image` - - - `Optional fileId` - - The [file](https://platform.openai.com/docs/api-reference/files) ID of the image. - - - `class FileSearchToolCallDelta:` - - - `JsonValue fileSearch` - - For now, this is always going to be an empty object. - - - `long index` - - The index of the tool call in the tool calls array. - - - `JsonValue; type "file_search"constant` - - The type of tool call. This is always going to be `file_search` for this type of tool call. - - - `FILE_SEARCH("file_search")` - - - `Optional id` - - The ID of the tool call object. - - - `class FunctionToolCallDelta:` - - - `long index` - - The index of the tool call in the tool calls array. - - - `JsonValue; type "function"constant` - - The type of tool call. This is always going to be `function` for this type of tool call. - - - `FUNCTION("function")` - - - `Optional id` - - The ID of the tool call object. - - - `Optional function` - - The definition of the function that was called. - - - `Optional arguments` - - The arguments passed to the function. - - - `Optional name` - - The name of the function. - - - `Optional output` - - The output of the function. This will be `null` if the outputs have not been [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) yet. - -### Tool Calls Step Details - -- `class ToolCallsStepDetails:` - - Details of the tool call. - - - `List toolCalls` - - An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `file_search`, or `function`. - - - `class CodeInterpreterToolCall:` - - Details of the Code Interpreter tool call the run step was involved in. - - - `String id` - - The ID of the tool call. - - - `CodeInterpreter codeInterpreter` - - The Code Interpreter tool call definition. - - - `String input` - - The input to the Code Interpreter tool call. - - - `List outputs` - - The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. - - - `class LogsOutput:` - - Text output from the Code Interpreter tool call as part of a run step. - - - `String logs` - - The text output from the Code Interpreter tool call. - - - `JsonValue; type "logs"constant` - - Always `logs`. - - - `LOGS("logs")` - - - `class ImageOutput:` - - - `Image image` - - - `String fileId` - - The [file](https://platform.openai.com/docs/api-reference/files) ID of the image. - - - `JsonValue; type "image"constant` - - Always `image`. - - - `IMAGE("image")` - - - `JsonValue; type "code_interpreter"constant` - - The type of tool call. This is always going to be `code_interpreter` for this type of tool call. - - - `CODE_INTERPRETER("code_interpreter")` - - - `class FileSearchToolCall:` - - - `String id` - - The ID of the tool call object. - - - `FileSearch fileSearch` - - For now, this is always going to be an empty object. - - - `Optional rankingOptions` - - The ranking options for the file search. - - - `Ranker ranker` - - The ranker to use for the file search. If not specified will use the `auto` ranker. - - - `AUTO("auto")` - - - `DEFAULT_2024_08_21("default_2024_08_21")` - - - `double scoreThreshold` - - The score threshold for the file search. All values must be a floating point number between 0 and 1. - - - `Optional> results` - - The results of the file search. - - - `String fileId` - - The ID of the file that result was found in. - - - `String fileName` - - The name of the file that result was found in. - - - `double score` - - The score of the result. All values must be a floating point number between 0 and 1. - - - `Optional> content` - - The content of the result that was found. The content is only included if requested via the include query parameter. - - - `Optional text` - - The text content of the file. - - - `Optional type` - - The type of the content. - - - `TEXT("text")` - - - `JsonValue; type "file_search"constant` - - The type of tool call. This is always going to be `file_search` for this type of tool call. - - - `FILE_SEARCH("file_search")` - - - `class FunctionToolCall:` - - - `String id` - - The ID of the tool call object. - - - `Function function` - - The definition of the function that was called. - - - `String arguments` - - The arguments passed to the function. - - - `String name` - - The name of the function. - - - `Optional output` - - The output of the function. This will be `null` if the outputs have not been [submitted](https://platform.openai.com/docs/api-reference/runs/submitToolOutputs) yet. - - - `JsonValue; type "function"constant` - - The type of tool call. This is always going to be `function` for this type of tool call. - - - `FUNCTION("function")` - - - `JsonValue; type "tool_calls"constant` - - Always `tool_calls`. - - - `TOOL_CALLS("tool_calls")` - -# Messages - -## List messages - -`MessageListPage beta().threads().messages().list(MessageListParamsparams = MessageListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/threads/{thread_id}/messages` - -Returns a list of messages for a given thread. - -### Parameters - -- `MessageListParams params` - - - `Optional threadId` - - - `Optional after` - - 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. - - - `Optional before` - - 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, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. - - - `Optional limit` - - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. - - - `Optional order` - - Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. - - - `ASC("asc")` - - - `DESC("desc")` - - - `Optional runId` - - Filter messages by the run ID that generated them. - -### Returns - -- `class Message:` - - Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads). - - - `String id` - - The identifier, which can be referenced in API endpoints. - - - `Optional assistantId` - - If applicable, the ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) that authored this message. - - - `Optional> attachments` - - A list of files attached to the message, and the tools they were added to. - - - `Optional fileId` - - The ID of the file to attach to the message. - - - `Optional> tools` - - The tools to add this file to. - - - `class CodeInterpreterTool:` - - - `JsonValue; type "code_interpreter"constant` - - The type of tool being defined: `code_interpreter` - - - `CODE_INTERPRETER("code_interpreter")` - - - `JsonValue;` - - - `JsonValue; type "file_search"constant` - - The type of tool being defined: `file_search` - - - `FILE_SEARCH("file_search")` - - - `Optional completedAt` - - The Unix timestamp (in seconds) for when the message was completed. - - - `List content` - - The content of the message in array of text and/or images. - - - `class ImageFileContentBlock:` - - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. - - - `ImageFile imageFile` - - - `String fileId` - - The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. - - - `Optional detail` - - Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. - - - `AUTO("auto")` - - - `LOW("low")` - - - `HIGH("high")` - - - `JsonValue; type "image_file"constant` - - Always `image_file`. - - - `IMAGE_FILE("image_file")` - - - `class ImageUrlContentBlock:` - - References an image URL in the content of a message. - - - `ImageUrl imageUrl` - - - `String url` - - The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. - - - `Optional detail` - - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` - - - `AUTO("auto")` - - - `LOW("low")` - - - `HIGH("high")` - - - `JsonValue; type "image_url"constant` - - The type of the content part. - - - `IMAGE_URL("image_url")` - - - `class TextContentBlock:` - - The text content that is part of a message. - - - `Text text` - - - `List annotations` - - - `class FileCitationAnnotation:` - - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - - - `long endIndex` - - - `FileCitation fileCitation` - - - `String fileId` - - The ID of the specific File the citation is from. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_citation"constant` - - Always `file_citation`. - - - `FILE_CITATION("file_citation")` - - - `class FilePathAnnotation:` - - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - - `long endIndex` - - - `FilePath filePath` - - - `String fileId` - - The ID of the file that was generated. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_path"constant` - - Always `file_path`. - - - `FILE_PATH("file_path")` - - - `String value` - - The data that makes up the text. - - - `JsonValue; type "text"constant` - - Always `text`. - - - `TEXT("text")` - - - `class RefusalContentBlock:` - - The refusal content generated by the assistant. - - - `String refusal` - - - `JsonValue; type "refusal"constant` - - Always `refusal`. - - - `REFUSAL("refusal")` - - - `long createdAt` - - The Unix timestamp (in seconds) for when the message was created. - - - `Optional incompleteAt` - - The Unix timestamp (in seconds) for when the message was marked as incomplete. - - - `Optional incompleteDetails` - - On an incomplete message, details about why the message is incomplete. - - - `Reason reason` - - The reason the message is incomplete. - - - `CONTENT_FILTER("content_filter")` - - - `MAX_TOKENS("max_tokens")` - - - `RUN_CANCELLED("run_cancelled")` - - - `RUN_EXPIRED("run_expired")` - - - `RUN_FAILED("run_failed")` - - - `Optional 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. - - - `JsonValue; object_ "thread.message"constant` - - The object type, which is always `thread.message`. - - - `THREAD_MESSAGE("thread.message")` - - - `Role role` - - The entity that produced the message. One of `user` or `assistant`. - - - `USER("user")` - - - `ASSISTANT("assistant")` - - - `Optional runId` - - The ID of the [run](https://platform.openai.com/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. - - - `Status status` - - The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. - - - `IN_PROGRESS("in_progress")` - - - `INCOMPLETE("incomplete")` - - - `COMPLETED("completed")` - - - `String threadId` - - The [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to. - -### Example - -```java -package com.openai.example; - -import com.openai.client.OpenAIClient; -import com.openai.client.okhttp.OpenAIOkHttpClient; -import com.openai.models.beta.threads.messages.MessageListPage; -import com.openai.models.beta.threads.messages.MessageListParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - OpenAIClient client = OpenAIOkHttpClient.fromEnv(); - - MessageListPage page = client.beta().threads().messages().list("thread_id"); - } -} -``` - -#### Response - -```json -{ - "data": [ - { - "id": "id", - "assistant_id": "assistant_id", - "attachments": [ - { - "file_id": "file_id", - "tools": [ - { - "type": "code_interpreter" - } - ] - } - ], - "completed_at": 0, - "content": [ - { - "image_file": { - "file_id": "file_id", - "detail": "auto" - }, - "type": "image_file" - } - ], - "created_at": 0, - "incomplete_at": 0, - "incomplete_details": { - "reason": "content_filter" - }, - "metadata": { - "foo": "string" - }, - "object": "thread.message", - "role": "user", - "run_id": "run_id", - "status": "in_progress", - "thread_id": "thread_id" - } - ], - "first_id": "msg_abc123", - "has_more": false, - "last_id": "msg_abc123", - "object": "list" -} -``` - -## Create message - -`Message beta().threads().messages().create(MessageCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` - -**post** `/threads/{thread_id}/messages` - -Create a message. - -### Parameters - -- `MessageCreateParams params` - - - `Optional threadId` - - - `Content content` - - The text contents of the message. - - - `String` - - - `List` - - - `class ImageFileContentBlock:` - - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. - - - `ImageFile imageFile` - - - `String fileId` - - The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. - - - `Optional detail` - - Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. - - - `AUTO("auto")` - - - `LOW("low")` - - - `HIGH("high")` - - - `JsonValue; type "image_file"constant` - - Always `image_file`. - - - `IMAGE_FILE("image_file")` - - - `class ImageUrlContentBlock:` - - References an image URL in the content of a message. - - - `ImageUrl imageUrl` - - - `String url` - - The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. - - - `Optional detail` - - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` - - - `AUTO("auto")` - - - `LOW("low")` - - - `HIGH("high")` - - - `JsonValue; type "image_url"constant` - - The type of the content part. - - - `IMAGE_URL("image_url")` - - - `class TextContentBlockParam:` - - The text content that is part of a message. - - - `String text` - - Text content to be sent to the model - - - `JsonValue; type "text"constant` - - Always `text`. - - - `TEXT("text")` - - - `Role role` - - The role of the entity that is creating the message. Allowed values include: - - - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. - - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation. - - - `USER("user")` - - - `ASSISTANT("assistant")` - - - `Optional> attachments` - - A list of files attached to the message, and the tools they should be added to. - - - `Optional fileId` - - The ID of the file to attach to the message. - - - `Optional> tools` - - The tools to add this file to. - - - `class CodeInterpreterTool:` - - - `JsonValue; type "code_interpreter"constant` - - The type of tool being defined: `code_interpreter` - - - `CODE_INTERPRETER("code_interpreter")` - - - `JsonValue;` - - - `JsonValue; type "file_search"constant` - - The type of tool being defined: `file_search` - - - `FILE_SEARCH("file_search")` - - - `Optional 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. - -### Returns - -- `class Message:` - - Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads). - - - `String id` - - The identifier, which can be referenced in API endpoints. - - - `Optional assistantId` - - If applicable, the ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) that authored this message. - - - `Optional> attachments` - - A list of files attached to the message, and the tools they were added to. - - - `Optional fileId` - - The ID of the file to attach to the message. - - - `Optional> tools` - - The tools to add this file to. - - - `class CodeInterpreterTool:` - - - `JsonValue; type "code_interpreter"constant` - - The type of tool being defined: `code_interpreter` - - - `CODE_INTERPRETER("code_interpreter")` - - - `JsonValue;` - - - `JsonValue; type "file_search"constant` - - The type of tool being defined: `file_search` - - - `FILE_SEARCH("file_search")` - - - `Optional completedAt` - - The Unix timestamp (in seconds) for when the message was completed. - - - `List content` - - The content of the message in array of text and/or images. - - - `class ImageFileContentBlock:` - - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. - - - `ImageFile imageFile` - - - `String fileId` - - The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. - - - `Optional detail` - - Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. - - - `AUTO("auto")` - - - `LOW("low")` - - - `HIGH("high")` - - - `JsonValue; type "image_file"constant` - - Always `image_file`. - - - `IMAGE_FILE("image_file")` - - - `class ImageUrlContentBlock:` - - References an image URL in the content of a message. - - - `ImageUrl imageUrl` - - - `String url` - - The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. - - - `Optional detail` - - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` - - - `AUTO("auto")` - - - `LOW("low")` - - - `HIGH("high")` - - - `JsonValue; type "image_url"constant` - - The type of the content part. - - - `IMAGE_URL("image_url")` - - - `class TextContentBlock:` - - The text content that is part of a message. - - - `Text text` - - - `List annotations` - - - `class FileCitationAnnotation:` - - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - - - `long endIndex` - - - `FileCitation fileCitation` - - - `String fileId` - - The ID of the specific File the citation is from. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_citation"constant` - - Always `file_citation`. - - - `FILE_CITATION("file_citation")` - - - `class FilePathAnnotation:` - - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - - `long endIndex` - - - `FilePath filePath` - - - `String fileId` - - The ID of the file that was generated. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_path"constant` - - Always `file_path`. - - - `FILE_PATH("file_path")` - - - `String value` - - The data that makes up the text. - - - `JsonValue; type "text"constant` - - Always `text`. - - - `TEXT("text")` - - - `class RefusalContentBlock:` - - The refusal content generated by the assistant. - - - `String refusal` - - - `JsonValue; type "refusal"constant` - - Always `refusal`. - - - `REFUSAL("refusal")` - - - `long createdAt` - - The Unix timestamp (in seconds) for when the message was created. - - - `Optional incompleteAt` - - The Unix timestamp (in seconds) for when the message was marked as incomplete. - - - `Optional incompleteDetails` - - On an incomplete message, details about why the message is incomplete. - - - `Reason reason` - - The reason the message is incomplete. - - - `CONTENT_FILTER("content_filter")` - - - `MAX_TOKENS("max_tokens")` - - - `RUN_CANCELLED("run_cancelled")` - - - `RUN_EXPIRED("run_expired")` - - - `RUN_FAILED("run_failed")` - - - `Optional 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. - - - `JsonValue; object_ "thread.message"constant` - - The object type, which is always `thread.message`. - - - `THREAD_MESSAGE("thread.message")` - - - `Role role` - - The entity that produced the message. One of `user` or `assistant`. - - - `USER("user")` - - - `ASSISTANT("assistant")` - - - `Optional runId` - - The ID of the [run](https://platform.openai.com/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. - - - `Status status` - - The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. - - - `IN_PROGRESS("in_progress")` - - - `INCOMPLETE("incomplete")` - - - `COMPLETED("completed")` - - - `String threadId` - - The [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to. - -### Example - -```java -package com.openai.example; - -import com.openai.client.OpenAIClient; -import com.openai.client.okhttp.OpenAIOkHttpClient; -import com.openai.models.beta.threads.messages.Message; -import com.openai.models.beta.threads.messages.MessageCreateParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - OpenAIClient client = OpenAIOkHttpClient.fromEnv(); - - MessageCreateParams params = MessageCreateParams.builder() - .threadId("thread_id") - .content("string") - .role(MessageCreateParams.Role.USER) - .build(); - Message message = client.beta().threads().messages().create(params); - } -} -``` - -#### Response - -```json -{ - "id": "id", - "assistant_id": "assistant_id", - "attachments": [ - { - "file_id": "file_id", - "tools": [ - { - "type": "code_interpreter" - } - ] - } - ], - "completed_at": 0, - "content": [ - { - "image_file": { - "file_id": "file_id", - "detail": "auto" - }, - "type": "image_file" - } - ], - "created_at": 0, - "incomplete_at": 0, - "incomplete_details": { - "reason": "content_filter" - }, - "metadata": { - "foo": "string" - }, - "object": "thread.message", - "role": "user", - "run_id": "run_id", - "status": "in_progress", - "thread_id": "thread_id" -} -``` - -## Modify message - -`Message beta().threads().messages().update(MessageUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` - -**post** `/threads/{thread_id}/messages/{message_id}` - -Modifies a message. - -### Parameters - -- `MessageUpdateParams params` - - - `String threadId` - - - `Optional messageId` - - - `Optional 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. - -### Returns - -- `class Message:` - - Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads). - - - `String id` - - The identifier, which can be referenced in API endpoints. - - - `Optional assistantId` - - If applicable, the ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) that authored this message. - - - `Optional> attachments` - - A list of files attached to the message, and the tools they were added to. - - - `Optional fileId` - - The ID of the file to attach to the message. - - - `Optional> tools` - - The tools to add this file to. - - - `class CodeInterpreterTool:` - - - `JsonValue; type "code_interpreter"constant` - - The type of tool being defined: `code_interpreter` - - - `CODE_INTERPRETER("code_interpreter")` - - - `JsonValue;` - - - `JsonValue; type "file_search"constant` - - The type of tool being defined: `file_search` - - - `FILE_SEARCH("file_search")` - - - `Optional completedAt` - - The Unix timestamp (in seconds) for when the message was completed. - - - `List content` - - The content of the message in array of text and/or images. - - - `class ImageFileContentBlock:` - - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. - - - `ImageFile imageFile` - - - `String fileId` - - The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. - - - `Optional detail` - - Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. - - - `AUTO("auto")` - - - `LOW("low")` - - - `HIGH("high")` - - - `JsonValue; type "image_file"constant` - - Always `image_file`. - - - `IMAGE_FILE("image_file")` - - - `class ImageUrlContentBlock:` - - References an image URL in the content of a message. - - - `ImageUrl imageUrl` - - - `String url` - - The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. - - - `Optional detail` - - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` - - - `AUTO("auto")` - - - `LOW("low")` - - - `HIGH("high")` - - - `JsonValue; type "image_url"constant` - - The type of the content part. - - - `IMAGE_URL("image_url")` - - - `class TextContentBlock:` - - The text content that is part of a message. - - - `Text text` - - - `List annotations` - - - `class FileCitationAnnotation:` - - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - - - `long endIndex` - - - `FileCitation fileCitation` - - - `String fileId` - - The ID of the specific File the citation is from. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_citation"constant` - - Always `file_citation`. - - - `FILE_CITATION("file_citation")` - - - `class FilePathAnnotation:` - - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - - `long endIndex` - - - `FilePath filePath` - - - `String fileId` - - The ID of the file that was generated. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_path"constant` - - Always `file_path`. - - - `FILE_PATH("file_path")` - - - `String value` - - The data that makes up the text. - - - `JsonValue; type "text"constant` - - Always `text`. - - - `TEXT("text")` - - - `class RefusalContentBlock:` - - The refusal content generated by the assistant. - - - `String refusal` - - - `JsonValue; type "refusal"constant` - - Always `refusal`. - - - `REFUSAL("refusal")` - - - `long createdAt` - - The Unix timestamp (in seconds) for when the message was created. - - - `Optional incompleteAt` - - The Unix timestamp (in seconds) for when the message was marked as incomplete. - - - `Optional incompleteDetails` - - On an incomplete message, details about why the message is incomplete. - - - `Reason reason` - - The reason the message is incomplete. - - - `CONTENT_FILTER("content_filter")` - - - `MAX_TOKENS("max_tokens")` - - - `RUN_CANCELLED("run_cancelled")` - - - `RUN_EXPIRED("run_expired")` - - - `RUN_FAILED("run_failed")` - - - `Optional 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. - - - `JsonValue; object_ "thread.message"constant` - - The object type, which is always `thread.message`. - - - `THREAD_MESSAGE("thread.message")` - - - `Role role` - - The entity that produced the message. One of `user` or `assistant`. - - - `USER("user")` - - - `ASSISTANT("assistant")` - - - `Optional runId` - - The ID of the [run](https://platform.openai.com/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. - - - `Status status` - - The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. - - - `IN_PROGRESS("in_progress")` - - - `INCOMPLETE("incomplete")` - - - `COMPLETED("completed")` - - - `String threadId` - - The [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to. - -### Example - -```java -package com.openai.example; - -import com.openai.client.OpenAIClient; -import com.openai.client.okhttp.OpenAIOkHttpClient; -import com.openai.models.beta.threads.messages.Message; -import com.openai.models.beta.threads.messages.MessageUpdateParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - OpenAIClient client = OpenAIOkHttpClient.fromEnv(); - - MessageUpdateParams params = MessageUpdateParams.builder() - .threadId("thread_id") - .messageId("message_id") - .build(); - Message message = client.beta().threads().messages().update(params); - } -} -``` - -#### Response - -```json -{ - "id": "id", - "assistant_id": "assistant_id", - "attachments": [ - { - "file_id": "file_id", - "tools": [ - { - "type": "code_interpreter" - } - ] - } - ], - "completed_at": 0, - "content": [ - { - "image_file": { - "file_id": "file_id", - "detail": "auto" - }, - "type": "image_file" - } - ], - "created_at": 0, - "incomplete_at": 0, - "incomplete_details": { - "reason": "content_filter" - }, - "metadata": { - "foo": "string" - }, - "object": "thread.message", - "role": "user", - "run_id": "run_id", - "status": "in_progress", - "thread_id": "thread_id" -} -``` - -## Retrieve message - -`Message beta().threads().messages().retrieve(MessageRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` - -**get** `/threads/{thread_id}/messages/{message_id}` - -Retrieve a message. - -### Parameters - -- `MessageRetrieveParams params` - - - `String threadId` - - - `Optional messageId` - -### Returns - -- `class Message:` - - Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads). - - - `String id` - - The identifier, which can be referenced in API endpoints. - - - `Optional assistantId` - - If applicable, the ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) that authored this message. - - - `Optional> attachments` - - A list of files attached to the message, and the tools they were added to. - - - `Optional fileId` - - The ID of the file to attach to the message. - - - `Optional> tools` - - The tools to add this file to. - - - `class CodeInterpreterTool:` - - - `JsonValue; type "code_interpreter"constant` - - The type of tool being defined: `code_interpreter` - - - `CODE_INTERPRETER("code_interpreter")` - - - `JsonValue;` - - - `JsonValue; type "file_search"constant` - - The type of tool being defined: `file_search` - - - `FILE_SEARCH("file_search")` - - - `Optional completedAt` - - The Unix timestamp (in seconds) for when the message was completed. - - - `List content` - - The content of the message in array of text and/or images. - - - `class ImageFileContentBlock:` - - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. - - - `ImageFile imageFile` - - - `String fileId` - - The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. - - - `Optional detail` - - Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. - - - `AUTO("auto")` - - - `LOW("low")` - - - `HIGH("high")` - - - `JsonValue; type "image_file"constant` - - Always `image_file`. - - - `IMAGE_FILE("image_file")` - - - `class ImageUrlContentBlock:` - - References an image URL in the content of a message. - - - `ImageUrl imageUrl` - - - `String url` - - The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. - - - `Optional detail` - - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` - - - `AUTO("auto")` - - - `LOW("low")` - - - `HIGH("high")` - - - `JsonValue; type "image_url"constant` - - The type of the content part. - - - `IMAGE_URL("image_url")` - - - `class TextContentBlock:` - - The text content that is part of a message. - - - `Text text` - - - `List annotations` - - - `class FileCitationAnnotation:` - - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - - - `long endIndex` - - - `FileCitation fileCitation` - - - `String fileId` - - The ID of the specific File the citation is from. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_citation"constant` - - Always `file_citation`. - - - `FILE_CITATION("file_citation")` - - - `class FilePathAnnotation:` - - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - - `long endIndex` - - - `FilePath filePath` - - - `String fileId` - - The ID of the file that was generated. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_path"constant` - - Always `file_path`. - - - `FILE_PATH("file_path")` - - - `String value` - - The data that makes up the text. - - - `JsonValue; type "text"constant` - - Always `text`. - - - `TEXT("text")` - - - `class RefusalContentBlock:` - - The refusal content generated by the assistant. - - - `String refusal` - - - `JsonValue; type "refusal"constant` - - Always `refusal`. - - - `REFUSAL("refusal")` - - - `long createdAt` - - The Unix timestamp (in seconds) for when the message was created. - - - `Optional incompleteAt` - - The Unix timestamp (in seconds) for when the message was marked as incomplete. - - - `Optional incompleteDetails` - - On an incomplete message, details about why the message is incomplete. - - - `Reason reason` - - The reason the message is incomplete. - - - `CONTENT_FILTER("content_filter")` - - - `MAX_TOKENS("max_tokens")` - - - `RUN_CANCELLED("run_cancelled")` - - - `RUN_EXPIRED("run_expired")` - - - `RUN_FAILED("run_failed")` - - - `Optional 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. - - - `JsonValue; object_ "thread.message"constant` - - The object type, which is always `thread.message`. - - - `THREAD_MESSAGE("thread.message")` - - - `Role role` - - The entity that produced the message. One of `user` or `assistant`. - - - `USER("user")` - - - `ASSISTANT("assistant")` - - - `Optional runId` - - The ID of the [run](https://platform.openai.com/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. - - - `Status status` - - The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. - - - `IN_PROGRESS("in_progress")` - - - `INCOMPLETE("incomplete")` - - - `COMPLETED("completed")` - - - `String threadId` - - The [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to. - -### Example - -```java -package com.openai.example; - -import com.openai.client.OpenAIClient; -import com.openai.client.okhttp.OpenAIOkHttpClient; -import com.openai.models.beta.threads.messages.Message; -import com.openai.models.beta.threads.messages.MessageRetrieveParams; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - OpenAIClient client = OpenAIOkHttpClient.fromEnv(); - - MessageRetrieveParams params = MessageRetrieveParams.builder() - .threadId("thread_id") - .messageId("message_id") - .build(); - Message message = client.beta().threads().messages().retrieve(params); - } -} -``` - -#### Response - -```json -{ - "id": "id", - "assistant_id": "assistant_id", - "attachments": [ - { - "file_id": "file_id", - "tools": [ - { - "type": "code_interpreter" - } - ] - } - ], - "completed_at": 0, - "content": [ - { - "image_file": { - "file_id": "file_id", - "detail": "auto" - }, - "type": "image_file" - } - ], - "created_at": 0, - "incomplete_at": 0, - "incomplete_details": { - "reason": "content_filter" - }, - "metadata": { - "foo": "string" - }, - "object": "thread.message", - "role": "user", - "run_id": "run_id", - "status": "in_progress", - "thread_id": "thread_id" -} -``` - -## Delete message - -`MessageDeleted beta().threads().messages().delete(MessageDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` - -**delete** `/threads/{thread_id}/messages/{message_id}` - -Deletes a message. - -### Parameters - -- `MessageDeleteParams params` - - - `String threadId` - - - `Optional messageId` - -### Returns - -- `class MessageDeleted:` - - - `String id` - - - `boolean deleted` - - - `JsonValue; object_ "thread.message.deleted"constant` - - - `THREAD_MESSAGE_DELETED("thread.message.deleted")` - -### Example - -```java -package com.openai.example; - -import com.openai.client.OpenAIClient; -import com.openai.client.okhttp.OpenAIOkHttpClient; -import com.openai.models.beta.threads.messages.MessageDeleteParams; -import com.openai.models.beta.threads.messages.MessageDeleted; - -public final class Main { - private Main() {} - - public static void main(String[] args) { - OpenAIClient client = OpenAIOkHttpClient.fromEnv(); - - MessageDeleteParams params = MessageDeleteParams.builder() - .threadId("thread_id") - .messageId("message_id") - .build(); - MessageDeleted messageDeleted = client.beta().threads().messages().delete(params); - } -} -``` - -#### Response - -```json -{ - "id": "id", - "deleted": true, - "object": "thread.message.deleted" -} -``` - -## Domain Types - -### Annotation - -- `class Annotation: A class that can be one of several variants.union` - - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - - - `class FileCitationAnnotation:` - - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - - - `long endIndex` - - - `FileCitation fileCitation` - - - `String fileId` - - The ID of the specific File the citation is from. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_citation"constant` - - Always `file_citation`. - - - `FILE_CITATION("file_citation")` - - - `class FilePathAnnotation:` - - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - - `long endIndex` - - - `FilePath filePath` - - - `String fileId` - - The ID of the file that was generated. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_path"constant` - - Always `file_path`. - - - `FILE_PATH("file_path")` - -### Annotation Delta - -- `class AnnotationDelta: A class that can be one of several variants.union` - - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - - - `class FileCitationDeltaAnnotation:` - - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - - - `long index` - - The index of the annotation in the text content part. - - - `JsonValue; type "file_citation"constant` - - Always `file_citation`. - - - `FILE_CITATION("file_citation")` - - - `Optional endIndex` - - - `Optional fileCitation` - - - `Optional fileId` - - The ID of the specific File the citation is from. - - - `Optional quote` - - The specific quote in the file. - - - `Optional startIndex` - - - `Optional text` - - The text in the message content that needs to be replaced. - - - `class FilePathDeltaAnnotation:` - - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - - `long index` - - The index of the annotation in the text content part. - - - `JsonValue; type "file_path"constant` - - Always `file_path`. - - - `FILE_PATH("file_path")` - - - `Optional endIndex` - - - `Optional filePath` - - - `Optional fileId` - - The ID of the file that was generated. - - - `Optional startIndex` - - - `Optional text` - - The text in the message content that needs to be replaced. - -### File Citation Annotation - -- `class FileCitationAnnotation:` - - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - - - `long endIndex` - - - `FileCitation fileCitation` - - - `String fileId` - - The ID of the specific File the citation is from. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_citation"constant` - - Always `file_citation`. - - - `FILE_CITATION("file_citation")` - -### File Citation Delta Annotation - -- `class FileCitationDeltaAnnotation:` - - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - - - `long index` - - The index of the annotation in the text content part. - - - `JsonValue; type "file_citation"constant` - - Always `file_citation`. - - - `FILE_CITATION("file_citation")` - - - `Optional endIndex` - - - `Optional fileCitation` - - - `Optional fileId` - - The ID of the specific File the citation is from. - - - `Optional quote` - - The specific quote in the file. - - - `Optional startIndex` - - - `Optional text` - - The text in the message content that needs to be replaced. - -### File Path Annotation - -- `class FilePathAnnotation:` - - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - - `long endIndex` - - - `FilePath filePath` - - - `String fileId` - - The ID of the file that was generated. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_path"constant` - - Always `file_path`. - - - `FILE_PATH("file_path")` - -### File Path Delta Annotation - -- `class FilePathDeltaAnnotation:` - - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - - `long index` - - The index of the annotation in the text content part. - - - `JsonValue; type "file_path"constant` - - Always `file_path`. - - - `FILE_PATH("file_path")` - - - `Optional endIndex` - - - `Optional filePath` - - - `Optional fileId` - - The ID of the file that was generated. - - - `Optional startIndex` - - - `Optional text` - - The text in the message content that needs to be replaced. - -### Image File - -- `class ImageFile:` - - - `String fileId` - - The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. - - - `Optional detail` - - Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. - - - `AUTO("auto")` - - - `LOW("low")` - - - `HIGH("high")` - -### Image File Content Block - -- `class ImageFileContentBlock:` - - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. - - - `ImageFile imageFile` - - - `String fileId` - - The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. - - - `Optional detail` - - Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. - - - `AUTO("auto")` - - - `LOW("low")` - - - `HIGH("high")` - - - `JsonValue; type "image_file"constant` - - Always `image_file`. - - - `IMAGE_FILE("image_file")` - -### Image File Delta - -- `class ImageFileDelta:` - - - `Optional detail` - - Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. - - - `AUTO("auto")` - - - `LOW("low")` - - - `HIGH("high")` - - - `Optional fileId` - - The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. - -### Image File Delta Block - -- `class ImageFileDeltaBlock:` - - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. - - - `long index` +```json +{ + "data": [ + { + "id": "id", + "assistant_id": "assistant_id", + "attachments": [ + { + "file_id": "file_id", + "tools": [ + { + "type": "code_interpreter" + } + ] + } + ], + "completed_at": 0, + "content": [ + {} + ], + "created_at": 0, + "incomplete_at": 0, + "incomplete_details": { + "reason": "content_filter" + }, + "metadata": { + "foo": "string" + }, + "object": "thread.message", + "role": "user", + "run_id": "run_id", + "status": "in_progress", + "thread_id": "thread_id" + } + ], + "first_id": "msg_abc123", + "has_more": false, + "last_id": "msg_abc123", + "object": "list" +} +``` - The index of the content part in the message. +## Create message - - `JsonValue; type "image_file"constant` +`Message beta().threads().messages().create(MessageCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` - Always `image_file`. +**post** `/threads/{thread_id}/messages` - - `IMAGE_FILE("image_file")` +Create message - - `Optional imageFile` +### Parameters - - `Optional detail` +- `MessageCreateParams params` - Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. + - `Optional threadId` - - `AUTO("auto")` + - `Content content` - - `LOW("low")` + The text contents of the message. - - `HIGH("high")` + - `String` - - `Optional fileId` + - `List` - The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. + - `class ImageFileContentBlock:` -### Image URL + References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. -- `class ImageUrl:` + - `ImageFile imageFile` - - `String url` + - `String fileId` - The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. + The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. - `Optional detail` - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` + Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. - `AUTO("auto")` @@ -9696,9 +5894,13 @@ public final class Main { - `HIGH("high")` -### Image URL Content Block + - `JsonValue; type "image_file"constant` -- `class ImageUrlContentBlock:` + Always `image_file`. + + - `IMAGE_FILE("image_file")` + + - `class ImageUrlContentBlock:` References an image URL in the content of a message. @@ -9724,57 +5926,69 @@ public final class Main { - `IMAGE_URL("image_url")` -### Image URL Delta + - `class TextContentBlockParam:` -- `class ImageUrlDelta:` + The text content that is part of a message. - - `Optional detail` + - `String text` - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. + Text content to be sent to the model - - `AUTO("auto")` + - `JsonValue; type "text"constant` - - `LOW("low")` + Always `text`. - - `HIGH("high")` + - `TEXT("text")` - - `Optional url` + - `Role role` - The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. + The role of the entity that is creating the message. Allowed values include: -### Image URL Delta Block + - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. + - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation. -- `class ImageUrlDeltaBlock:` + - `USER("user")` - References an image URL in the content of a message. + - `ASSISTANT("assistant")` - - `long index` + - `Optional> attachments` - The index of the content part in the message. + A list of files attached to the message, and the tools they should be added to. - - `JsonValue; type "image_url"constant` + - `Optional fileId` - Always `image_url`. + The ID of the file to attach to the message. - - `IMAGE_URL("image_url")` + - `Optional> tools` - - `Optional imageUrl` + The tools to add this file to. - - `Optional detail` + - `class CodeInterpreterTool:` - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. + - `JsonValue; type "code_interpreter"constant` - - `AUTO("auto")` + The type of tool being defined: `code_interpreter` - - `LOW("low")` + - `CODE_INTERPRETER("code_interpreter")` - - `HIGH("high")` + - `JsonValue;` - - `Optional url` + - `JsonValue; type "file_search"constant` - The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. + The type of tool being defined: `file_search` -### Message + - `FILE_SEARCH("file_search")` + + - `Optional 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. + +### Returns - `class Message:` @@ -9820,139 +6034,213 @@ public final class Main { The Unix timestamp (in seconds) for when the message was completed. - - `List content` + - `List content` The content of the message in array of text and/or images. - - `class ImageFileContentBlock:` + - `long createdAt` - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. + The Unix timestamp (in seconds) for when the message was created. - - `ImageFile imageFile` + - `Optional incompleteAt` - - `String fileId` + The Unix timestamp (in seconds) for when the message was marked as incomplete. - The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. + - `Optional incompleteDetails` - - `Optional detail` + On an incomplete message, details about why the message is incomplete. - Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. + - `Reason reason` - - `AUTO("auto")` + The reason the message is incomplete. - - `LOW("low")` + - `CONTENT_FILTER("content_filter")` - - `HIGH("high")` + - `MAX_TOKENS("max_tokens")` - - `JsonValue; type "image_file"constant` + - `RUN_CANCELLED("run_cancelled")` - Always `image_file`. + - `RUN_EXPIRED("run_expired")` - - `IMAGE_FILE("image_file")` + - `RUN_FAILED("run_failed")` - - `class ImageUrlContentBlock:` + - `Optional metadata` - References an image URL in the content of a message. + 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. - - `ImageUrl imageUrl` + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. - - `String url` + - `JsonValue; object_ "thread.message"constant` - The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. + The object type, which is always `thread.message`. - - `Optional detail` + - `THREAD_MESSAGE("thread.message")` - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` + - `Role role` - - `AUTO("auto")` + The entity that produced the message. One of `user` or `assistant`. - - `LOW("low")` + - `USER("user")` - - `HIGH("high")` + - `ASSISTANT("assistant")` - - `JsonValue; type "image_url"constant` + - `Optional runId` - The type of the content part. + The ID of the [run](https://platform.openai.com/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. - - `IMAGE_URL("image_url")` + - `Status status` - - `class TextContentBlock:` + The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. - The text content that is part of a message. + - `IN_PROGRESS("in_progress")` - - `Text text` + - `INCOMPLETE("incomplete")` - - `List annotations` + - `COMPLETED("completed")` - - `class FileCitationAnnotation:` + - `String threadId` - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. + The [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to. - - `long endIndex` +### Example - - `FileCitation fileCitation` +```java +package com.openai.example; - - `String fileId` +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.beta.threads.messages.Message; +import com.openai.models.beta.threads.messages.MessageCreateParams; - The ID of the specific File the citation is from. +public final class Main { + private Main() {} - - `long startIndex` + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); - - `String text` + MessageCreateParams params = MessageCreateParams.builder() + .threadId("thread_id") + .content("string") + .role(MessageCreateParams.Role.USER) + .build(); + Message message = client.beta().threads().messages().create(params); + } +} +``` - The text in the message content that needs to be replaced. +#### Response - - `JsonValue; type "file_citation"constant` +```json +{ + "id": "id", + "assistant_id": "assistant_id", + "attachments": [ + { + "file_id": "file_id", + "tools": [ + { + "type": "code_interpreter" + } + ] + } + ], + "completed_at": 0, + "content": [ + {} + ], + "created_at": 0, + "incomplete_at": 0, + "incomplete_details": { + "reason": "content_filter" + }, + "metadata": { + "foo": "string" + }, + "object": "thread.message", + "role": "user", + "run_id": "run_id", + "status": "in_progress", + "thread_id": "thread_id" +} +``` - Always `file_citation`. +## Modify message - - `FILE_CITATION("file_citation")` +`Message beta().threads().messages().update(MessageUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` - - `class FilePathAnnotation:` +**post** `/threads/{thread_id}/messages/{message_id}` - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. +Modify message - - `long endIndex` +### Parameters - - `FilePath filePath` +- `MessageUpdateParams params` - - `String fileId` + - `String threadId` - The ID of the file that was generated. + - `Optional messageId` - - `long startIndex` + - `Optional metadata` - - `String text` + 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. - The text in the message content that needs to be replaced. + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. + +### Returns + +- `class Message:` + + Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads). + + - `String id` + + The identifier, which can be referenced in API endpoints. + + - `Optional assistantId` + + If applicable, the ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) that authored this message. + + - `Optional> attachments` + + A list of files attached to the message, and the tools they were added to. + + - `Optional fileId` + + The ID of the file to attach to the message. - - `JsonValue; type "file_path"constant` + - `Optional> tools` - Always `file_path`. + The tools to add this file to. - - `FILE_PATH("file_path")` + - `class CodeInterpreterTool:` - - `String value` + - `JsonValue; type "code_interpreter"constant` - The data that makes up the text. + The type of tool being defined: `code_interpreter` - - `JsonValue; type "text"constant` + - `CODE_INTERPRETER("code_interpreter")` - Always `text`. + - `JsonValue;` - - `TEXT("text")` + - `JsonValue; type "file_search"constant` - - `class RefusalContentBlock:` + The type of tool being defined: `file_search` - The refusal content generated by the assistant. + - `FILE_SEARCH("file_search")` - - `String refusal` + - `Optional completedAt` - - `JsonValue; type "refusal"constant` + The Unix timestamp (in seconds) for when the message was completed. - Always `refusal`. + - `List content` - - `REFUSAL("refusal")` + The content of the message in array of text and/or images. - `long createdAt` @@ -10021,197 +6309,363 @@ public final class Main { The [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to. -### Message Content +### Example -- `class MessageContent: A class that can be one of several variants.union` +```java +package com.openai.example; - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.beta.threads.messages.Message; +import com.openai.models.beta.threads.messages.MessageUpdateParams; - - `class ImageFileContentBlock:` +public final class Main { + private Main() {} - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); - - `ImageFile imageFile` + MessageUpdateParams params = MessageUpdateParams.builder() + .threadId("thread_id") + .messageId("message_id") + .build(); + Message message = client.beta().threads().messages().update(params); + } +} +``` - - `String fileId` +#### Response - The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. +```json +{ + "id": "id", + "assistant_id": "assistant_id", + "attachments": [ + { + "file_id": "file_id", + "tools": [ + { + "type": "code_interpreter" + } + ] + } + ], + "completed_at": 0, + "content": [ + {} + ], + "created_at": 0, + "incomplete_at": 0, + "incomplete_details": { + "reason": "content_filter" + }, + "metadata": { + "foo": "string" + }, + "object": "thread.message", + "role": "user", + "run_id": "run_id", + "status": "in_progress", + "thread_id": "thread_id" +} +``` - - `Optional detail` +## Retrieve message - Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. +`Message beta().threads().messages().retrieve(MessageRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` - - `AUTO("auto")` +**get** `/threads/{thread_id}/messages/{message_id}` - - `LOW("low")` +Retrieve message - - `HIGH("high")` +### Parameters - - `JsonValue; type "image_file"constant` +- `MessageRetrieveParams params` - Always `image_file`. + - `String threadId` - - `IMAGE_FILE("image_file")` + - `Optional messageId` - - `class ImageUrlContentBlock:` +### Returns - References an image URL in the content of a message. +- `class Message:` - - `ImageUrl imageUrl` + Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads). - - `String url` + - `String id` - The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. + The identifier, which can be referenced in API endpoints. - - `Optional detail` + - `Optional assistantId` - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` + If applicable, the ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) that authored this message. - - `AUTO("auto")` + - `Optional> attachments` - - `LOW("low")` + A list of files attached to the message, and the tools they were added to. - - `HIGH("high")` + - `Optional fileId` - - `JsonValue; type "image_url"constant` + The ID of the file to attach to the message. - The type of the content part. + - `Optional> tools` - - `IMAGE_URL("image_url")` + The tools to add this file to. + + - `class CodeInterpreterTool:` - - `class TextContentBlock:` + - `JsonValue; type "code_interpreter"constant` - The text content that is part of a message. + The type of tool being defined: `code_interpreter` - - `Text text` + - `CODE_INTERPRETER("code_interpreter")` - - `List annotations` + - `JsonValue;` - - `class FileCitationAnnotation:` + - `JsonValue; type "file_search"constant` - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. + The type of tool being defined: `file_search` - - `long endIndex` + - `FILE_SEARCH("file_search")` - - `FileCitation fileCitation` + - `Optional completedAt` - - `String fileId` + The Unix timestamp (in seconds) for when the message was completed. - The ID of the specific File the citation is from. + - `List content` - - `long startIndex` + The content of the message in array of text and/or images. - - `String text` + - `long createdAt` - The text in the message content that needs to be replaced. + The Unix timestamp (in seconds) for when the message was created. - - `JsonValue; type "file_citation"constant` + - `Optional incompleteAt` - Always `file_citation`. + The Unix timestamp (in seconds) for when the message was marked as incomplete. - - `FILE_CITATION("file_citation")` + - `Optional incompleteDetails` - - `class FilePathAnnotation:` + On an incomplete message, details about why the message is incomplete. - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. + - `Reason reason` - - `long endIndex` + The reason the message is incomplete. - - `FilePath filePath` + - `CONTENT_FILTER("content_filter")` - - `String fileId` + - `MAX_TOKENS("max_tokens")` - The ID of the file that was generated. + - `RUN_CANCELLED("run_cancelled")` - - `long startIndex` + - `RUN_EXPIRED("run_expired")` - - `String text` + - `RUN_FAILED("run_failed")` - The text in the message content that needs to be replaced. + - `Optional 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. + + - `JsonValue; object_ "thread.message"constant` + + The object type, which is always `thread.message`. + + - `THREAD_MESSAGE("thread.message")` + + - `Role role` + + The entity that produced the message. One of `user` or `assistant`. + + - `USER("user")` + + - `ASSISTANT("assistant")` + + - `Optional runId` + + The ID of the [run](https://platform.openai.com/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. + + - `Status status` + + The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. + + - `IN_PROGRESS("in_progress")` + + - `INCOMPLETE("incomplete")` + + - `COMPLETED("completed")` + + - `String threadId` + + The [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to. + +### Example + +```java +package com.openai.example; + +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.beta.threads.messages.Message; +import com.openai.models.beta.threads.messages.MessageRetrieveParams; + +public final class Main { + private Main() {} + + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + + MessageRetrieveParams params = MessageRetrieveParams.builder() + .threadId("thread_id") + .messageId("message_id") + .build(); + Message message = client.beta().threads().messages().retrieve(params); + } +} +``` + +#### Response + +```json +{ + "id": "id", + "assistant_id": "assistant_id", + "attachments": [ + { + "file_id": "file_id", + "tools": [ + { + "type": "code_interpreter" + } + ] + } + ], + "completed_at": 0, + "content": [ + {} + ], + "created_at": 0, + "incomplete_at": 0, + "incomplete_details": { + "reason": "content_filter" + }, + "metadata": { + "foo": "string" + }, + "object": "thread.message", + "role": "user", + "run_id": "run_id", + "status": "in_progress", + "thread_id": "thread_id" +} +``` - - `JsonValue; type "file_path"constant` +## Delete message - Always `file_path`. +`MessageDeleted beta().threads().messages().delete(MessageDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` - - `FILE_PATH("file_path")` +**delete** `/threads/{thread_id}/messages/{message_id}` - - `String value` +Delete message - The data that makes up the text. +### Parameters - - `JsonValue; type "text"constant` +- `MessageDeleteParams params` - Always `text`. + - `String threadId` - - `TEXT("text")` + - `Optional messageId` - - `class RefusalContentBlock:` +### Returns - The refusal content generated by the assistant. +- `class MessageDeleted:` - - `String refusal` + - `String id` - - `JsonValue; type "refusal"constant` + - `boolean deleted` - Always `refusal`. + - `JsonValue; object_ "thread.message.deleted"constant` - - `REFUSAL("refusal")` + - `THREAD_MESSAGE_DELETED("thread.message.deleted")` -### Message Content Delta +### Example -- `class MessageContentDelta: A class that can be one of several variants.union` +```java +package com.openai.example; - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. +import com.openai.client.OpenAIClient; +import com.openai.client.okhttp.OpenAIOkHttpClient; +import com.openai.models.beta.threads.messages.MessageDeleteParams; +import com.openai.models.beta.threads.messages.MessageDeleted; - - `class ImageFileDeltaBlock:` +public final class Main { + private Main() {} - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. + public static void main(String[] args) { + OpenAIClient client = OpenAIOkHttpClient.fromEnv(); - - `long index` + MessageDeleteParams params = MessageDeleteParams.builder() + .threadId("thread_id") + .messageId("message_id") + .build(); + MessageDeleted messageDeleted = client.beta().threads().messages().delete(params); + } +} +``` - The index of the content part in the message. +#### Response - - `JsonValue; type "image_file"constant` +```json +{ + "id": "id", + "deleted": true, + "object": "thread.message.deleted" +} +``` - Always `image_file`. +## Domain Types - - `IMAGE_FILE("image_file")` +### Annotation - - `Optional imageFile` +- `class Annotation:` - - `Optional detail` +### Annotation Delta - Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. +- `class AnnotationDelta:` - - `AUTO("auto")` +### File Citation Annotation - - `LOW("low")` +- `class FileCitationAnnotation:` - - `HIGH("high")` + A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - - `Optional fileId` + - `long endIndex` - The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. + - `FileCitation fileCitation` - - `class TextDeltaBlock:` + - `String fileId` - The text content that is part of a message. + The ID of the specific File the citation is from. - - `long index` + - `long startIndex` - The index of the content part in the message. + - `String text` - - `JsonValue; type "text"constant` + The text in the message content that needs to be replaced. - Always `text`. + - `JsonValue; type "file_citation"constant` - - `TEXT("text")` + Always `file_citation`. - - `Optional text` + - `FILE_CITATION("file_citation")` - - `Optional> annotations` +### File Citation Delta Annotation - - `class FileCitationDeltaAnnotation:` +- `class FileCitationDeltaAnnotation:` A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. @@ -10243,73 +6697,73 @@ public final class Main { The text in the message content that needs to be replaced. - - `class FilePathDeltaAnnotation:` +### File Path Annotation + +- `class FilePathAnnotation:` A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - `long index` - - The index of the annotation in the text content part. + - `long endIndex` - - `JsonValue; type "file_path"constant` + - `FilePath filePath` - Always `file_path`. + - `String fileId` - - `FILE_PATH("file_path")` + The ID of the file that was generated. - - `Optional endIndex` + - `long startIndex` - - `Optional filePath` + - `String text` - - `Optional fileId` + The text in the message content that needs to be replaced. - The ID of the file that was generated. + - `JsonValue; type "file_path"constant` - - `Optional startIndex` + Always `file_path`. - - `Optional text` + - `FILE_PATH("file_path")` - The text in the message content that needs to be replaced. +### File Path Delta Annotation - - `Optional value` +- `class FilePathDeltaAnnotation:` - The data that makes up the text. + A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - `class RefusalDeltaBlock:` + - `long index` - The refusal content that is part of a message. + The index of the annotation in the text content part. - - `long index` + - `JsonValue; type "file_path"constant` - The index of the refusal part in the message. + Always `file_path`. - - `JsonValue; type "refusal"constant` + - `FILE_PATH("file_path")` - Always `refusal`. + - `Optional endIndex` - - `REFUSAL("refusal")` + - `Optional filePath` - - `Optional refusal` + - `Optional fileId` - - `class ImageUrlDeltaBlock:` + The ID of the file that was generated. - References an image URL in the content of a message. + - `Optional startIndex` - - `long index` + - `Optional text` - The index of the content part in the message. + The text in the message content that needs to be replaced. - - `JsonValue; type "image_url"constant` +### Image File - Always `image_url`. +- `class ImageFile:` - - `IMAGE_URL("image_url")` + - `String fileId` - - `Optional imageUrl` + The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. - `Optional detail` - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. + Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. - `AUTO("auto")` @@ -10317,17 +6771,9 @@ public final class Main { - `HIGH("high")` - - `Optional url` - - The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. - -### Message Content Part Param - -- `class MessageContentPartParam: A class that can be one of several variants.union` - - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. +### Image File Content Block - - `class ImageFileContentBlock:` +- `class ImageFileContentBlock:` References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. @@ -10353,19 +6799,13 @@ public final class Main { - `IMAGE_FILE("image_file")` - - `class ImageUrlContentBlock:` - - References an image URL in the content of a message. - - - `ImageUrl imageUrl` - - - `String url` +### Image File Delta - The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. +- `class ImageFileDelta:` - `Optional detail` - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` + Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. - `AUTO("auto")` @@ -10373,67 +6813,53 @@ public final class Main { - `HIGH("high")` - - `JsonValue; type "image_url"constant` - - The type of the content part. - - - `IMAGE_URL("image_url")` - - - `class TextContentBlockParam:` - - The text content that is part of a message. - - - `String text` - - Text content to be sent to the model - - - `JsonValue; type "text"constant` + - `Optional fileId` - Always `text`. + The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. - - `TEXT("text")` +### Image File Delta Block -### Message Deleted +- `class ImageFileDeltaBlock:` -- `class MessageDeleted:` + References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. - - `String id` + - `long index` - - `boolean deleted` + The index of the content part in the message. - - `JsonValue; object_ "thread.message.deleted"constant` + - `JsonValue; type "image_file"constant` - - `THREAD_MESSAGE_DELETED("thread.message.deleted")` + Always `image_file`. -### Message Delta + - `IMAGE_FILE("image_file")` -- `class MessageDelta:` + - `Optional imageFile` - The delta containing the fields that have changed on the Message. + - `Optional detail` - - `Optional> content` + Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. - The content of the message in array of text and/or images. + - `AUTO("auto")` - - `class ImageFileDeltaBlock:` + - `LOW("low")` - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. + - `HIGH("high")` - - `long index` + - `Optional fileId` - The index of the content part in the message. + The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. - - `JsonValue; type "image_file"constant` +### Image URL - Always `image_file`. +- `class ImageUrl:` - - `IMAGE_FILE("image_file")` + - `String url` - - `Optional imageFile` + The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. - `Optional detail` - Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. + Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` - `AUTO("auto")` @@ -10441,321 +6867,328 @@ public final class Main { - `HIGH("high")` - - `Optional fileId` +### Image URL Content Block - The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. +- `class ImageUrlContentBlock:` - - `class TextDeltaBlock:` + References an image URL in the content of a message. - The text content that is part of a message. + - `ImageUrl imageUrl` - - `long index` + - `String url` - The index of the content part in the message. + The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. - - `JsonValue; type "text"constant` + - `Optional detail` - Always `text`. + Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` - - `TEXT("text")` + - `AUTO("auto")` - - `Optional text` + - `LOW("low")` - - `Optional> annotations` + - `HIGH("high")` - - `class FileCitationDeltaAnnotation:` + - `JsonValue; type "image_url"constant` - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. + The type of the content part. - - `long index` + - `IMAGE_URL("image_url")` - The index of the annotation in the text content part. +### Image URL Delta - - `JsonValue; type "file_citation"constant` +- `class ImageUrlDelta:` - Always `file_citation`. + - `Optional detail` - - `FILE_CITATION("file_citation")` + Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. - - `Optional endIndex` + - `AUTO("auto")` - - `Optional fileCitation` + - `LOW("low")` - - `Optional fileId` + - `HIGH("high")` - The ID of the specific File the citation is from. + - `Optional url` - - `Optional quote` + The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. - The specific quote in the file. +### Image URL Delta Block - - `Optional startIndex` +- `class ImageUrlDeltaBlock:` - - `Optional text` + References an image URL in the content of a message. - The text in the message content that needs to be replaced. + - `long index` - - `class FilePathDeltaAnnotation:` + The index of the content part in the message. - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. + - `JsonValue; type "image_url"constant` - - `long index` + Always `image_url`. - The index of the annotation in the text content part. + - `IMAGE_URL("image_url")` - - `JsonValue; type "file_path"constant` + - `Optional imageUrl` - Always `file_path`. + - `Optional detail` - - `FILE_PATH("file_path")` + Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. - - `Optional endIndex` + - `AUTO("auto")` - - `Optional filePath` + - `LOW("low")` - - `Optional fileId` + - `HIGH("high")` - The ID of the file that was generated. + - `Optional url` - - `Optional startIndex` + The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. - - `Optional text` +### Message - The text in the message content that needs to be replaced. +- `class Message:` - - `Optional value` + Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads). - The data that makes up the text. + - `String id` - - `class RefusalDeltaBlock:` + The identifier, which can be referenced in API endpoints. - The refusal content that is part of a message. + - `Optional assistantId` - - `long index` + If applicable, the ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) that authored this message. - The index of the refusal part in the message. + - `Optional> attachments` - - `JsonValue; type "refusal"constant` + A list of files attached to the message, and the tools they were added to. - Always `refusal`. + - `Optional fileId` - - `REFUSAL("refusal")` + The ID of the file to attach to the message. - - `Optional refusal` + - `Optional> tools` - - `class ImageUrlDeltaBlock:` + The tools to add this file to. - References an image URL in the content of a message. + - `class CodeInterpreterTool:` - - `long index` + - `JsonValue; type "code_interpreter"constant` - The index of the content part in the message. + The type of tool being defined: `code_interpreter` - - `JsonValue; type "image_url"constant` + - `CODE_INTERPRETER("code_interpreter")` - Always `image_url`. + - `JsonValue;` - - `IMAGE_URL("image_url")` + - `JsonValue; type "file_search"constant` - - `Optional imageUrl` + The type of tool being defined: `file_search` - - `Optional detail` + - `FILE_SEARCH("file_search")` - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. + - `Optional completedAt` - - `AUTO("auto")` + The Unix timestamp (in seconds) for when the message was completed. - - `LOW("low")` + - `List content` - - `HIGH("high")` + The content of the message in array of text and/or images. - - `Optional url` + - `long createdAt` - The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. + The Unix timestamp (in seconds) for when the message was created. - - `Optional role` + - `Optional incompleteAt` - The entity that produced the message. One of `user` or `assistant`. + The Unix timestamp (in seconds) for when the message was marked as incomplete. - - `USER("user")` + - `Optional incompleteDetails` - - `ASSISTANT("assistant")` + On an incomplete message, details about why the message is incomplete. -### Message Delta Event + - `Reason reason` -- `class MessageDeltaEvent:` + The reason the message is incomplete. - Represents a message delta i.e. any changed fields on a message during streaming. + - `CONTENT_FILTER("content_filter")` - - `String id` + - `MAX_TOKENS("max_tokens")` - The identifier of the message, which can be referenced in API endpoints. + - `RUN_CANCELLED("run_cancelled")` - - `MessageDelta delta` + - `RUN_EXPIRED("run_expired")` - The delta containing the fields that have changed on the Message. + - `RUN_FAILED("run_failed")` - - `Optional> content` + - `Optional metadata` - The content of the message in array of text and/or images. + 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. - - `class ImageFileDeltaBlock:` + Keys are strings with a maximum length of 64 characters. Values are strings + with a maximum length of 512 characters. - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. + - `JsonValue; object_ "thread.message"constant` - - `long index` + The object type, which is always `thread.message`. - The index of the content part in the message. + - `THREAD_MESSAGE("thread.message")` - - `JsonValue; type "image_file"constant` + - `Role role` - Always `image_file`. + The entity that produced the message. One of `user` or `assistant`. - - `IMAGE_FILE("image_file")` + - `USER("user")` - - `Optional imageFile` + - `ASSISTANT("assistant")` - - `Optional detail` + - `Optional runId` - Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. + The ID of the [run](https://platform.openai.com/docs/api-reference/runs) associated with the creation of this message. Value is `null` when messages are created manually using the create message or create thread endpoints. - - `AUTO("auto")` + - `Status status` - - `LOW("low")` + The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. - - `HIGH("high")` + - `IN_PROGRESS("in_progress")` - - `Optional fileId` + - `INCOMPLETE("incomplete")` - The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. + - `COMPLETED("completed")` - - `class TextDeltaBlock:` + - `String threadId` - The text content that is part of a message. + The [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to. - - `long index` +### Message Content - The index of the content part in the message. +- `class MessageContent:` - - `JsonValue; type "text"constant` +### Message Content Delta - Always `text`. +- `class MessageContentDelta:` - - `TEXT("text")` +### Message Content Part Param - - `Optional text` +- `class MessageContentPartParam: A class that can be one of several variants.union` - - `Optional> annotations` + References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. - - `class FileCitationDeltaAnnotation:` + - `class ImageFileContentBlock:` - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. + References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. - - `long index` + - `ImageFile imageFile` - The index of the annotation in the text content part. + - `String fileId` - - `JsonValue; type "file_citation"constant` + The [File](https://platform.openai.com/docs/api-reference/files) ID of the image in the message content. Set `purpose="vision"` when uploading the File if you need to later display the file content. - Always `file_citation`. + - `Optional detail` - - `FILE_CITATION("file_citation")` + Specifies the detail level of the image if specified by the user. `low` uses fewer tokens, you can opt in to high resolution using `high`. - - `Optional endIndex` + - `AUTO("auto")` - - `Optional fileCitation` + - `LOW("low")` - - `Optional fileId` + - `HIGH("high")` - The ID of the specific File the citation is from. + - `JsonValue; type "image_file"constant` - - `Optional quote` + Always `image_file`. - The specific quote in the file. + - `IMAGE_FILE("image_file")` - - `Optional startIndex` + - `class ImageUrlContentBlock:` - - `Optional text` + References an image URL in the content of a message. - The text in the message content that needs to be replaced. + - `ImageUrl imageUrl` - - `class FilePathDeltaAnnotation:` + - `String url` - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. + The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. - - `long index` + - `Optional detail` - The index of the annotation in the text content part. + Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` - - `JsonValue; type "file_path"constant` + - `AUTO("auto")` - Always `file_path`. + - `LOW("low")` - - `FILE_PATH("file_path")` + - `HIGH("high")` - - `Optional endIndex` + - `JsonValue; type "image_url"constant` - - `Optional filePath` + The type of the content part. - - `Optional fileId` + - `IMAGE_URL("image_url")` - The ID of the file that was generated. + - `class TextContentBlockParam:` - - `Optional startIndex` + The text content that is part of a message. - - `Optional text` + - `String text` + + Text content to be sent to the model + + - `JsonValue; type "text"constant` - The text in the message content that needs to be replaced. + Always `text`. - - `Optional value` + - `TEXT("text")` - The data that makes up the text. +### Message Deleted - - `class RefusalDeltaBlock:` +- `class MessageDeleted:` - The refusal content that is part of a message. + - `String id` - - `long index` + - `boolean deleted` - The index of the refusal part in the message. + - `JsonValue; object_ "thread.message.deleted"constant` - - `JsonValue; type "refusal"constant` + - `THREAD_MESSAGE_DELETED("thread.message.deleted")` - Always `refusal`. +### Message Delta - - `REFUSAL("refusal")` +- `class MessageDelta:` - - `Optional refusal` + The delta containing the fields that have changed on the Message. - - `class ImageUrlDeltaBlock:` + - `Optional> content` - References an image URL in the content of a message. + The content of the message in array of text and/or images. - - `long index` + - `Optional role` - The index of the content part in the message. + The entity that produced the message. One of `user` or `assistant`. - - `JsonValue; type "image_url"constant` + - `USER("user")` - Always `image_url`. + - `ASSISTANT("assistant")` - - `IMAGE_URL("image_url")` +### Message Delta Event - - `Optional imageUrl` +- `class MessageDeltaEvent:` - - `Optional detail` + Represents a message delta i.e. any changed fields on a message during streaming. - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. + - `String id` - - `AUTO("auto")` + The identifier of the message, which can be referenced in API endpoints. - - `LOW("low")` + - `MessageDelta delta` - - `HIGH("high")` + The delta containing the fields that have changed on the Message. - - `Optional url` + - `Optional> content` - The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. + The content of the message in array of text and/or images. - `Optional role` @@ -10807,55 +7240,7 @@ public final class Main { - `class Text:` - - `List annotations` - - - `class FileCitationAnnotation:` - - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - - - `long endIndex` - - - `FileCitation fileCitation` - - - `String fileId` - - The ID of the specific File the citation is from. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_citation"constant` - - Always `file_citation`. - - - `FILE_CITATION("file_citation")` - - - `class FilePathAnnotation:` - - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - - `long endIndex` - - - `FilePath filePath` - - - `String fileId` - - The ID of the file that was generated. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_path"constant` - - Always `file_path`. - - - `FILE_PATH("file_path")` + - `List annotations` - `String value` @@ -10869,55 +7254,7 @@ public final class Main { - `Text text` - - `List annotations` - - - `class FileCitationAnnotation:` - - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - - - `long endIndex` - - - `FileCitation fileCitation` - - - `String fileId` - - The ID of the specific File the citation is from. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_citation"constant` - - Always `file_citation`. - - - `FILE_CITATION("file_citation")` - - - `class FilePathAnnotation:` - - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - - `long endIndex` - - - `FilePath filePath` - - - `String fileId` - - The ID of the file that was generated. - - - `long startIndex` - - - `String text` - - The text in the message content that needs to be replaced. - - - `JsonValue; type "file_path"constant` - - Always `file_path`. - - - `FILE_PATH("file_path")` + - `List annotations` - `String value` @@ -10949,67 +7286,7 @@ public final class Main { - `class TextDelta:` - - `Optional> annotations` - - - `class FileCitationDeltaAnnotation:` - - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - - - `long index` - - The index of the annotation in the text content part. - - - `JsonValue; type "file_citation"constant` - - Always `file_citation`. - - - `FILE_CITATION("file_citation")` - - - `Optional endIndex` - - - `Optional fileCitation` - - - `Optional fileId` - - The ID of the specific File the citation is from. - - - `Optional quote` - - The specific quote in the file. - - - `Optional startIndex` - - - `Optional text` - - The text in the message content that needs to be replaced. - - - `class FilePathDeltaAnnotation:` - - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - - `long index` - - The index of the annotation in the text content part. - - - `JsonValue; type "file_path"constant` - - Always `file_path`. - - - `FILE_PATH("file_path")` - - - `Optional endIndex` - - - `Optional filePath` - - - `Optional fileId` - - The ID of the file that was generated. - - - `Optional startIndex` - - - `Optional text` - - The text in the message content that needs to be replaced. + - `Optional> annotations` - `Optional value` @@ -11033,67 +7310,7 @@ public final class Main { - `Optional text` - - `Optional> annotations` - - - `class FileCitationDeltaAnnotation:` - - A citation within the message that points to a specific quote from a specific File associated with the assistant or the message. Generated when the assistant uses the "file_search" tool to search files. - - - `long index` - - The index of the annotation in the text content part. - - - `JsonValue; type "file_citation"constant` - - Always `file_citation`. - - - `FILE_CITATION("file_citation")` - - - `Optional endIndex` - - - `Optional fileCitation` - - - `Optional fileId` - - The ID of the specific File the citation is from. - - - `Optional quote` - - The specific quote in the file. - - - `Optional startIndex` - - - `Optional text` - - The text in the message content that needs to be replaced. - - - `class FilePathDeltaAnnotation:` - - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - - `long index` - - The index of the annotation in the text content part. - - - `JsonValue; type "file_path"constant` - - Always `file_path`. - - - `FILE_PATH("file_path")` - - - `Optional endIndex` - - - `Optional filePath` - - - `Optional fileId` - - The ID of the file that was generated. - - - `Optional startIndex` - - - `Optional text` - - The text in the message content that needs to be replaced. + - `Optional> annotations` - `Optional value`