diff --git a/en/java/resources/beta/subresources/threads/index.md b/en/java/resources/beta/subresources/threads/index.md index e852d83f..46febaaa 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 thread +Create a thread. ### Parameters @@ -309,7 +309,7 @@ public final class Main { **post** `/threads/runs` -Create thread and run +Create a thread and run it in one request. ### Parameters @@ -591,10 +591,76 @@ Create thread and run 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. @@ -835,7 +901,27 @@ Create thread and run The Unix timestamp (in seconds) for when the run was started. - - `JsonValue status` + - `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")` - `String threadId` @@ -877,10 +963,82 @@ Create thread and 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. @@ -989,11 +1147,13 @@ public final class Main { }, "response_format": "auto", "started_at": 0, - "status": {}, + "status": "queued", "thread_id": "thread_id", "tool_choice": "none", "tools": [ - {} + { + "type": "code_interpreter" + } ], "truncation_strategy": { "type": "auto", @@ -1015,7 +1175,7 @@ public final class Main { **get** `/threads/{thread_id}` -Retrieve thread +Retrieves a thread. ### Parameters @@ -1120,7 +1280,7 @@ public final class Main { **post** `/threads/{thread_id}` -Modify thread +Modifies a thread. ### Parameters @@ -1250,7 +1410,7 @@ public final class Main { **delete** `/threads/{thread_id}` -Delete thread +Delete a thread. ### Parameters @@ -1513,7 +1673,7 @@ public final class Main { **get** `/threads/{thread_id}/runs` -List runs +Returns a list of runs belonging to a thread. ### Parameters @@ -1759,7 +1919,27 @@ List runs The Unix timestamp (in seconds) for when the run was started. - - `JsonValue status` + - `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")` - `String threadId` @@ -1801,10 +1981,82 @@ List runs 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. @@ -1912,11 +2164,13 @@ public final class Main { }, "response_format": "auto", "started_at": 0, - "status": {}, + "status": "queued", "thread_id": "thread_id", "tool_choice": "none", "tools": [ - {} + { + "type": "code_interpreter" + } ], "truncation_strategy": { "type": "auto", @@ -1944,7 +2198,7 @@ public final class Main { **post** `/threads/{thread_id}/runs` -Create run +Create a run. ### Parameters @@ -2155,10 +2409,76 @@ Create 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. @@ -2399,16 +2719,36 @@ Create run The Unix timestamp (in seconds) for when the run was started. - - `JsonValue status` + - `RunStatus status` - - `String threadId` + The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, `incomplete`, or `expired`. - The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was executed on as a part of this run. + - `QUEUED("queued")` - - `Optional toolChoice` + - `IN_PROGRESS("in_progress")` - Controls which (if any) tool is called by the model. - `none` means the model will not call any tools and instead generates a message. + - `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` + + Controls which (if any) tool is called by the model. + `none` means the model will not call any tools and instead generates a message. `auto` is the default value and means the model can pick between generating a message or calling one or more tools. `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. @@ -2441,10 +2781,82 @@ Create 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. @@ -2554,11 +2966,13 @@ public final class Main { }, "response_format": "auto", "started_at": 0, - "status": {}, + "status": "queued", "thread_id": "thread_id", "tool_choice": "none", "tools": [ - {} + { + "type": "code_interpreter" + } ], "truncation_strategy": { "type": "auto", @@ -2580,7 +2994,7 @@ public final class Main { **get** `/threads/{thread_id}/runs/{run_id}` -Retrieve run +Retrieves a run. ### Parameters @@ -2808,7 +3222,27 @@ Retrieve run The Unix timestamp (in seconds) for when the run was started. - - `JsonValue status` + - `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")` - `String threadId` @@ -2850,10 +3284,82 @@ Retrieve 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. @@ -2963,11 +3469,13 @@ public final class Main { }, "response_format": "auto", "started_at": 0, - "status": {}, + "status": "queued", "thread_id": "thread_id", "tool_choice": "none", "tools": [ - {} + { + "type": "code_interpreter" + } ], "truncation_strategy": { "type": "auto", @@ -2989,7 +3497,7 @@ public final class Main { **post** `/threads/{thread_id}/runs/{run_id}` -Modify run +Modifies a run. ### Parameters @@ -3226,7 +3734,27 @@ Modify run The Unix timestamp (in seconds) for when the run was started. - - `JsonValue status` + - `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")` - `String threadId` @@ -3268,10 +3796,82 @@ Modify 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. @@ -3381,11 +3981,13 @@ public final class Main { }, "response_format": "auto", "started_at": 0, - "status": {}, + "status": "queued", "thread_id": "thread_id", "tool_choice": "none", "tools": [ - {} + { + "type": "code_interpreter" + } ], "truncation_strategy": { "type": "auto", @@ -3407,7 +4009,7 @@ public final class Main { **post** `/threads/{thread_id}/runs/{run_id}/submit_tool_outputs` -Submit tool outputs to run +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. ### Parameters @@ -3647,7 +4249,27 @@ Submit tool outputs to run The Unix timestamp (in seconds) for when the run was started. - - `JsonValue status` + - `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")` - `String threadId` @@ -3689,21 +4311,93 @@ Submit tool outputs to 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. - - `Optional truncationStrategy` + - `class CodeInterpreterTool:` - Controls for how a thread will be truncated prior to the run. Use this to control the initial context window of the run. + - `JsonValue; type "code_interpreter"constant` - - `Type type` + The type of tool being defined: `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`. + - `CODE_INTERPRETER("code_interpreter")` - - `AUTO("auto")` + - `class FileSearchTool:` - - `LAST_MESSAGES("last_messages")` + - `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. + + - `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` @@ -3803,11 +4497,13 @@ public final class Main { }, "response_format": "auto", "started_at": 0, - "status": {}, + "status": "queued", "thread_id": "thread_id", "tool_choice": "none", "tools": [ - {} + { + "type": "code_interpreter" + } ], "truncation_strategy": { "type": "auto", @@ -3829,7 +4525,7 @@ public final class Main { **post** `/threads/{thread_id}/runs/{run_id}/cancel` -Cancel a run +Cancels a run that is `in_progress`. ### Parameters @@ -4057,7 +4753,27 @@ Cancel a run The Unix timestamp (in seconds) for when the run was started. - - `JsonValue status` + - `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")` - `String threadId` @@ -4099,10 +4815,82 @@ Cancel 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. @@ -4212,11 +5000,13 @@ public final class Main { }, "response_format": "auto", "started_at": 0, - "status": {}, + "status": "queued", "thread_id": "thread_id", "tool_choice": "none", "tools": [ - {} + { + "type": "code_interpreter" + } ], "truncation_strategy": { "type": "auto", @@ -4480,7 +5270,27 @@ public final class Main { The Unix timestamp (in seconds) for when the run was started. - - `JsonValue status` + - `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")` - `String threadId` @@ -4522,10 +5332,82 @@ 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. @@ -4568,7 +5450,27 @@ public final class Main { ### Run Status -- `class RunStatus:` +- `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")` # Steps @@ -4578,7 +5480,7 @@ public final class Main { **get** `/threads/{thread_id}/runs/{run_id}/steps` -List run steps +Returns a list of run steps belonging to a run. ### Parameters @@ -4723,43 +5625,187 @@ List run steps 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`. - - `JsonValue; type "tool_calls"constant` + - `class CodeInterpreterToolCall:` - Always `tool_calls`. + Details of the Code Interpreter tool call the run step was involved in. - - `TOOL_CALLS("tool_calls")` + - `String id` - - `String threadId` + The ID of the tool call. - The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was run. + - `CodeInterpreter codeInterpreter` - - `Type type` + The Code Interpreter tool call definition. - The type of run step, which can be either `message_creation` or `tool_calls`. + - `String input` - - `MESSAGE_CREATION("message_creation")` + The input to the Code Interpreter tool call. - - `TOOL_CALLS("tool_calls")` + - `List outputs` - - `Optional usage` + 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. - Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. + - `class LogsOutput:` - - `long completionTokens` + Text output from the Code Interpreter tool call as part of a run step. - Number of completion tokens used over the course of the run step. + - `String logs` - - `long promptTokens` + The text output from the Code Interpreter tool call. - Number of prompt tokens used over the course of the run step. + - `JsonValue; type "logs"constant` - - `long totalTokens` + Always `logs`. - Total number of tokens used (prompt + completion). + - `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). ### Example @@ -4837,7 +5883,7 @@ public final class Main { **get** `/threads/{thread_id}/runs/{run_id}/steps/{step_id}` -Retrieve run step +Retrieves a run step. ### Parameters @@ -4964,126 +6010,270 @@ Retrieve 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`. - - `JsonValue; type "tool_calls"constant` + - `class CodeInterpreterToolCall:` - Always `tool_calls`. + Details of the Code Interpreter tool call the run step was involved in. - - `TOOL_CALLS("tool_calls")` + - `String id` - - `String threadId` + The ID of the tool call. - The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was run. + - `CodeInterpreter codeInterpreter` - - `Type type` + The Code Interpreter tool call definition. - The type of run step, which can be either `message_creation` or `tool_calls`. + - `String input` - - `MESSAGE_CREATION("message_creation")` + The input to the Code Interpreter tool call. - - `TOOL_CALLS("tool_calls")` + - `List outputs` - - `Optional usage` + 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. - Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. + - `class LogsOutput:` - - `long completionTokens` + Text output from the Code Interpreter tool call as part of a run step. - Number of completion tokens used over the course of the run step. + - `String logs` - - `long promptTokens` + The text output from the Code Interpreter tool call. - Number of prompt tokens used over the course of the run step. + - `JsonValue; type "logs"constant` - - `long totalTokens` + Always `logs`. - Total number of tokens used (prompt + completion). + - `LOGS("logs")` -### Example + - `class ImageOutput:` -```java -package com.openai.example; + - `Image image` -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; + - `String fileId` -public final class Main { - private Main() {} + The [file](https://platform.openai.com/docs/api-reference/files) ID of the image. - public static void main(String[] args) { - OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + - `JsonValue; type "image"constant` - StepRetrieveParams params = StepRetrieveParams.builder() - .threadId("thread_id") - .runId("run_id") - .stepId("step_id") - .build(); - RunStep runStep = client.beta().threads().runs().steps().retrieve(params); - } -} -``` + Always `image`. -#### Response + - `IMAGE("image")` -```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 - } -} -``` + - `JsonValue; type "code_interpreter"constant` -## Domain Types + The type of tool call. This is always going to be `code_interpreter` for this type of tool call. -### Code Interpreter Logs + - `CODE_INTERPRETER("code_interpreter")` -- `class CodeInterpreterLogs:` + - `class FileSearchToolCall:` - Text output from the Code Interpreter tool call as part of a run step. + - `String id` - - `long index` + The ID of the tool call object. - The index of the output in the outputs array. + - `FileSearch fileSearch` - - `JsonValue; type "logs"constant` + For now, this is always going to be an empty object. - Always `logs`. + - `Optional rankingOptions` - - `LOGS("logs")` + The ranking options for the file search. - - `Optional 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` The text output from the Code Interpreter tool call. @@ -5506,123 +6696,153 @@ 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`. - - `JsonValue; type "tool_calls"constant` + - `class CodeInterpreterToolCall:` - Always `tool_calls`. + Details of the Code Interpreter tool call the run step was involved in. - - `TOOL_CALLS("tool_calls")` + - `String id` - - `String threadId` + The ID of the tool call. - The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was run. + - `CodeInterpreter codeInterpreter` - - `Type type` + The Code Interpreter tool call definition. - The type of run step, which can be either `message_creation` or `tool_calls`. + - `String input` - - `MESSAGE_CREATION("message_creation")` + The input to the Code Interpreter tool call. - - `TOOL_CALLS("tool_calls")` + - `List outputs` - - `Optional usage` + 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. - Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. + - `class LogsOutput:` - - `long completionTokens` + Text output from the Code Interpreter tool call as part of a run step. - Number of completion tokens used over the course of the run step. + - `String logs` - - `long promptTokens` + The text output from the Code Interpreter tool call. - Number of prompt tokens used over the course of the run step. + - `JsonValue; type "logs"constant` - - `long totalTokens` + Always `logs`. - Total number of tokens used (prompt + completion). + - `LOGS("logs")` -### Run Step Delta + - `class ImageOutput:` -- `class RunStepDelta:` + - `Image image` -### Run Step Delta Event + - `String fileId` -- `class RunStepDeltaEvent:` + The [file](https://platform.openai.com/docs/api-reference/files) ID of the image. - Represents a run step delta i.e. any changed fields on a run step during streaming. + - `JsonValue; type "image"constant` - - `String id` + Always `image`. - The identifier of the run step, which can be referenced in API endpoints. + - `IMAGE("image")` - - `JsonValue delta` + - `JsonValue; type "code_interpreter"constant` - - `JsonValue; object_ "thread.run.step.delta"constant` + The type of tool call. This is always going to be `code_interpreter` for this type of tool call. - The object type, which is always `thread.run.step.delta`. + - `CODE_INTERPRETER("code_interpreter")` - - `THREAD_RUN_STEP_DELTA("thread.run.step.delta")` + - `class FileSearchToolCall:` -### Run Step Delta Message Delta + - `String id` -- `class RunStepDeltaMessageDelta:` + The ID of the tool call object. - Details of the message creation by the run step. + - `FileSearch fileSearch` - - `JsonValue; type "message_creation"constant` + For now, this is always going to be an empty object. - Always `message_creation`. + - `Optional rankingOptions` - - `MESSAGE_CREATION("message_creation")` + The ranking options for the file search. - - `Optional messageCreation` + - `Ranker ranker` - - `Optional messageId` + The ranker to use for the file search. If not specified will use the `auto` ranker. - The ID of the message that was created by this run step. + - `AUTO("auto")` -### Run Step Include + - `DEFAULT_2024_08_21("default_2024_08_21")` -- `enum RunStepInclude:` + - `double scoreThreshold` - - `STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT("step_details.tool_calls[*].file_search.results[*].content")` + The score threshold for the file search. All values must be a floating point number between 0 and 1. -### Tool Call + - `Optional> results` -- `class ToolCall:` + The results of the file search. -### Tool Call Delta + - `String fileId` -- `class ToolCallDelta:` + The ID of the file that result was found in. -### Tool Call Delta Object + - `String fileName` -- `class ToolCallDeltaObject:` + The name of the file that result was found in. - Details of the tool call. + - `double score` - - `JsonValue; type "tool_calls"constant` + The score of the result. All values must be a floating point number between 0 and 1. - Always `tool_calls`. + - `Optional> content` - - `TOOL_CALLS("tool_calls")` + The content of the result that was found. The content is only included if requested via the include query parameter. - - `Optional> toolCalls` + - `Optional text` - 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`. + The text content of the file. -### Tool Calls Step Details + - `Optional type` -- `class ToolCallsStepDetails:` + The type of the content. - Details of the tool call. + - `TEXT("text")` + + - `JsonValue; type "file_search"constant` - - `List toolCalls` + The type of tool call. This is always going to be `file_search` for this type of tool call. - 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`. + - `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` @@ -5630,735 +6850,2423 @@ public final class Main { - `TOOL_CALLS("tool_calls")` -# Messages + - `String threadId` -## List messages + The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) that was run. -`MessageListPage beta().threads().messages().list(MessageListParamsparams = MessageListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())` + - `Type type` -**get** `/threads/{thread_id}/messages` + The type of run step, which can be either `message_creation` or `tool_calls`. -List messages + - `MESSAGE_CREATION("message_creation")` -### Parameters + - `TOOL_CALLS("tool_calls")` -- `MessageListParams params` + - `Optional usage` - - `Optional threadId` + Usage statistics related to the run step. This value will be `null` while the run step's status is `in_progress`. - - `Optional after` + - `long completionTokens` - 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. + Number of completion tokens used over the course of the run step. - - `Optional before` + - `long promptTokens` - 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. + Number of prompt tokens used over the course of the run step. - - `Optional limit` + - `long totalTokens` - A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + Total number of tokens used (prompt + completion). - - `Optional order` +### Run Step Delta - Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. +- `class RunStepDelta:` - - `ASC("asc")` + The delta containing the fields that have changed on the run step. - - `DESC("desc")` + - `Optional stepDetails` - - `Optional runId` + The details of the run step. - Filter messages by the run ID that generated them. + - `class RunStepDeltaMessageDelta:` -### Returns + Details of the message creation by the run step. -- `class Message:` + - `JsonValue; type "message_creation"constant` - Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads). + Always `message_creation`. - - `String id` + - `MESSAGE_CREATION("message_creation")` - The identifier, which can be referenced in API endpoints. + - `Optional messageCreation` - - `Optional assistantId` + - `Optional messageId` - If applicable, the ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) that authored this message. + The ID of the message that was created by this run step. - - `Optional> attachments` + - `class ToolCallDeltaObject:` - A list of files attached to the message, and the tools they were added to. + Details of the tool call. - - `Optional fileId` + - `JsonValue; type "tool_calls"constant` - The ID of the file to attach to the message. + Always `tool_calls`. - - `Optional> tools` + - `TOOL_CALLS("tool_calls")` - The tools to add this file to. + - `Optional> toolCalls` - - `class CodeInterpreterTool:` + 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 being defined: `code_interpreter` + The type of tool call. This is always going to be `code_interpreter` for this type of tool call. - `CODE_INTERPRETER("code_interpreter")` - - `JsonValue;` + - `Optional id` - - `JsonValue; type "file_search"constant` + The ID of the tool call. - The type of tool being defined: `file_search` + - `Optional codeInterpreter` - - `FILE_SEARCH("file_search")` + The Code Interpreter tool call definition. - - `Optional completedAt` + - `Optional input` - The Unix timestamp (in seconds) for when the message was completed. + The input to the Code Interpreter tool call. - - `List content` + - `Optional> outputs` - The content of the message in array of text and/or images. + 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. - - `long createdAt` + - `class CodeInterpreterLogs:` - The Unix timestamp (in seconds) for when the message was created. + Text output from the Code Interpreter tool call as part of a run step. - - `Optional incompleteAt` + - `long index` - The Unix timestamp (in seconds) for when the message was marked as incomplete. + The index of the output in the outputs array. - - `Optional incompleteDetails` + - `JsonValue; type "logs"constant` - On an incomplete message, details about why the message is incomplete. + Always `logs`. - - `Reason reason` + - `LOGS("logs")` - The reason the message is incomplete. + - `Optional logs` - - `CONTENT_FILTER("content_filter")` + The text output from the Code Interpreter tool call. - - `MAX_TOKENS("max_tokens")` + - `class CodeInterpreterOutputImage:` - - `RUN_CANCELLED("run_cancelled")` + - `long index` - - `RUN_EXPIRED("run_expired")` + The index of the output in the outputs array. - - `RUN_FAILED("run_failed")` + - `JsonValue; type "image"constant` - - `Optional metadata` + Always `image`. - 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. + - `IMAGE("image")` - Keys are strings with a maximum length of 64 characters. Values are strings - with a maximum length of 512 characters. + - `Optional image` - - `JsonValue; object_ "thread.message"constant` + - `Optional fileId` - The object type, which is always `thread.message`. + The [file](https://platform.openai.com/docs/api-reference/files) ID of the image. - - `THREAD_MESSAGE("thread.message")` + - `class FileSearchToolCallDelta:` - - `Role role` + - `JsonValue fileSearch` - The entity that produced the message. One of `user` or `assistant`. + For now, this is always going to be an empty object. - - `USER("user")` + - `long index` - - `ASSISTANT("assistant")` + The index of the tool call in the tool calls array. - - `Optional runId` + - `JsonValue; type "file_search"constant` - 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. + The type of tool call. This is always going to be `file_search` for this type of tool call. - - `Status status` + - `FILE_SEARCH("file_search")` - The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. + - `Optional id` - - `IN_PROGRESS("in_progress")` + The ID of the tool call object. - - `INCOMPLETE("incomplete")` + - `class FunctionToolCallDelta:` - - `COMPLETED("completed")` + - `long index` - - `String threadId` + The index of the tool call in the tool calls array. - The [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to. + - `JsonValue; type "function"constant` -### Example + The type of tool call. This is always going to be `function` for this type of tool call. -```java -package com.openai.example; + - `FUNCTION("function")` -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; + - `Optional id` -public final class Main { - private Main() {} + The ID of the tool call object. - public static void main(String[] args) { - OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + - `Optional function` - MessageListPage page = client.beta().threads().messages().list("thread_id"); - } -} -``` + The definition of the function that was called. -#### Response + - `Optional arguments` -```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 arguments passed to the function. -## Create message + - `Optional name` -`Message beta().threads().messages().create(MessageCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + The name of the function. -**post** `/threads/{thread_id}/messages` + - `Optional output` -Create message + 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. -### Parameters +### Run Step Delta Event -- `MessageCreateParams params` +- `class RunStepDeltaEvent:` - - `Optional threadId` + Represents a run step delta i.e. any changed fields on a run step during streaming. - - `Content content` + - `String id` - The text contents of the message. + The identifier of the run step, which can be referenced in API endpoints. - - `String` + - `RunStepDelta delta` - - `List` + The delta containing the fields that have changed on the run step. - - `class ImageFileContentBlock:` + - `Optional stepDetails` - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. + The details of the run step. - - `ImageFile imageFile` + - `class RunStepDeltaMessageDelta:` - - `String fileId` + Details of the message creation by the run step. - 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 "message_creation"constant` - - `Optional detail` + Always `message_creation`. - 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_CREATION("message_creation")` - - `AUTO("auto")` + - `Optional messageCreation` - - `LOW("low")` + - `Optional messageId` - - `HIGH("high")` + The ID of the message that was created by this run step. - - `JsonValue; type "image_file"constant` + - `class ToolCallDeltaObject:` - Always `image_file`. + Details of the tool call. - - `IMAGE_FILE("image_file")` + - `JsonValue; type "tool_calls"constant` - - `class ImageUrlContentBlock:` + Always `tool_calls`. - References an image URL in the content of a message. + - `TOOL_CALLS("tool_calls")` - - `ImageUrl imageUrl` + - `Optional> toolCalls` - - `String url` + 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`. - The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. + - `class CodeInterpreterToolCallDelta:` - - `Optional detail` + Details of the Code Interpreter tool call the run step was involved in. - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` + - `long index` - - `AUTO("auto")` + The index of the tool call in the tool calls array. - - `LOW("low")` + - `JsonValue; type "code_interpreter"constant` - - `HIGH("high")` + The type of tool call. This is always going to be `code_interpreter` for this type of tool call. - - `JsonValue; type "image_url"constant` + - `CODE_INTERPRETER("code_interpreter")` - The type of the content part. + - `Optional id` - - `IMAGE_URL("image_url")` + The ID of the tool call. - - `class TextContentBlockParam:` + - `Optional codeInterpreter` - The text content that is part of a message. + The Code Interpreter tool call definition. - - `String text` + - `Optional input` - Text content to be sent to the model + The input to the Code Interpreter tool call. - - `JsonValue; type "text"constant` + - `Optional> outputs` - Always `text`. + 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. - - `TEXT("text")` + - `class CodeInterpreterLogs:` - - `Role role` + Text output from the Code Interpreter tool call as part of a run step. - The role of the entity that is creating the message. Allowed values include: + - `long index` - - `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. + The index of the output in the outputs array. - - `USER("user")` + - `JsonValue; type "logs"constant` - - `ASSISTANT("assistant")` + Always `logs`. - - `Optional> attachments` + - `LOGS("logs")` - A list of files attached to the message, and the tools they should be added to. + - `Optional logs` - - `Optional fileId` + The text output from the Code Interpreter tool call. - The ID of the file to attach to the message. + - `class CodeInterpreterOutputImage:` - - `Optional> tools` + - `long index` - The tools to add this file to. + The index of the output in the outputs array. - - `class CodeInterpreterTool:` + - `JsonValue; type "image"constant` - - `JsonValue; type "code_interpreter"constant` + Always `image`. - The type of tool being defined: `code_interpreter` + - `IMAGE("image")` - - `CODE_INTERPRETER("code_interpreter")` + - `Optional image` - - `JsonValue;` + - `Optional fileId` - - `JsonValue; type "file_search"constant` + The [file](https://platform.openai.com/docs/api-reference/files) ID of the image. - The type of tool being defined: `file_search` + - `class FileSearchToolCallDelta:` - - `FILE_SEARCH("file_search")` + - `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. -### Returns + - `JsonValue; type "file_search"constant` -- `class Message:` + The type of tool call. This is always going to be `file_search` for this type of tool call. - Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads). + - `FILE_SEARCH("file_search")` - - `String id` + - `Optional id` - The identifier, which can be referenced in API endpoints. + The ID of the tool call object. - - `Optional assistantId` + - `class FunctionToolCallDelta:` - If applicable, the ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) that authored this message. + - `long index` - - `Optional> attachments` + The index of the tool call in the tool calls array. - A list of files attached to the message, and the tools they were added to. + - `JsonValue; type "function"constant` - - `Optional fileId` + The type of tool call. This is always going to be `function` for this type of tool call. - The ID of the file to attach to the message. + - `FUNCTION("function")` - - `Optional> tools` + - `Optional id` - The tools to add this file to. + The ID of the tool call object. - - `class CodeInterpreterTool:` + - `Optional function` - - `JsonValue; type "code_interpreter"constant` + The definition of the function that was called. - The type of tool being defined: `code_interpreter` + - `Optional arguments` - - `CODE_INTERPRETER("code_interpreter")` + The arguments passed to the function. - - `JsonValue;` + - `Optional name` - - `JsonValue; type "file_search"constant` + The name of the function. - The type of tool being defined: `file_search` + - `Optional output` - - `FILE_SEARCH("file_search")` + 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. - - `Optional completedAt` + - `JsonValue; object_ "thread.run.step.delta"constant` - The Unix timestamp (in seconds) for when the message was completed. + The object type, which is always `thread.run.step.delta`. - - `List content` + - `THREAD_RUN_STEP_DELTA("thread.run.step.delta")` - The content of the message in array of text and/or images. +### Run Step Delta Message Delta - - `long createdAt` +- `class RunStepDeltaMessageDelta:` - The Unix timestamp (in seconds) for when the message was created. + Details of the message creation by the run step. - - `Optional incompleteAt` + - `JsonValue; type "message_creation"constant` - The Unix timestamp (in seconds) for when the message was marked as incomplete. + Always `message_creation`. - - `Optional incompleteDetails` + - `MESSAGE_CREATION("message_creation")` - On an incomplete message, details about why the message is incomplete. + - `Optional messageCreation` - - `Reason reason` + - `Optional messageId` - The reason the message is incomplete. + The ID of the message that was created by this run step. - - `CONTENT_FILTER("content_filter")` +### Run Step Include - - `MAX_TOKENS("max_tokens")` +- `enum RunStepInclude:` - - `RUN_CANCELLED("run_cancelled")` + - `STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT("step_details.tool_calls[*].file_search.results[*].content")` - - `RUN_EXPIRED("run_expired")` +### Tool Call - - `RUN_FAILED("run_failed")` +- `class ToolCall: A class that can be one of several variants.union` - - `Optional metadata` + Details of the Code Interpreter tool call the run step was involved in. - 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 CodeInterpreterToolCall:` - Keys are strings with a maximum length of 64 characters. Values are strings - with a maximum length of 512 characters. + Details of the Code Interpreter tool call the run step was involved in. - - `JsonValue; object_ "thread.message"constant` + - `String id` - The object type, which is always `thread.message`. + The ID of the tool call. - - `THREAD_MESSAGE("thread.message")` + - `CodeInterpreter codeInterpreter` - - `Role role` + The Code Interpreter tool call definition. - The entity that produced the message. One of `user` or `assistant`. + - `String input` - - `USER("user")` + The input to the Code Interpreter tool call. - - `ASSISTANT("assistant")` + - `List outputs` - - `Optional runId` + 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. - 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. + - `class LogsOutput:` - - `Status status` + Text output from the Code Interpreter tool call as part of a run step. - The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. + - `String logs` - - `IN_PROGRESS("in_progress")` + The text output from the Code Interpreter tool call. - - `INCOMPLETE("incomplete")` + - `JsonValue; type "logs"constant` - - `COMPLETED("completed")` + Always `logs`. - - `String threadId` + - `LOGS("logs")` - The [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to. + - `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.messages.Message; -import com.openai.models.beta.threads.messages.MessageCreateParams; + 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`. - MessageCreateParams params = MessageCreateParams.builder() - .threadId("thread_id") - .content("string") - .role(MessageCreateParams.Role.USER) - .build(); - Message message = client.beta().threads().messages().create(params); - } -} -``` + - `IMAGE("image")` -#### Response + - `JsonValue; type "code_interpreter"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" -} -``` + The type of tool call. This is always going to be `code_interpreter` for this type of tool call. -## Modify message + - `CODE_INTERPRETER("code_interpreter")` -`Message beta().threads().messages().update(MessageUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + - `class FileSearchToolCall:` -**post** `/threads/{thread_id}/messages/{message_id}` + - `String id` -Modify message + The ID of the tool call object. -### Parameters + - `FileSearch fileSearch` -- `MessageUpdateParams params` + For now, this is always going to be an empty object. - - `String threadId` + - `Optional rankingOptions` - - `Optional messageId` + The ranking options for the file search. - - `Optional metadata` + - `Ranker ranker` - 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 ranker to use for the file search. If not specified will use the `auto` ranker. - Keys are strings with a maximum length of 64 characters. Values are strings - with a maximum length of 512 characters. + - `AUTO("auto")` -### Returns + - `DEFAULT_2024_08_21("default_2024_08_21")` -- `class Message:` + - `double scoreThreshold` - Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads). + The score threshold for the file search. All values must be a floating point number between 0 and 1. - - `String id` + - `Optional> results` - The identifier, which can be referenced in API endpoints. + The results of the file search. - - `Optional assistantId` + - `String fileId` - If applicable, the ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) that authored this message. + The ID of the file that result was found in. - - `Optional> attachments` + - `String fileName` - A list of files attached to the message, and the tools they were added to. + The name of the file that result was found in. - - `Optional fileId` + - `double score` - The ID of the file to attach to the message. + The score of the result. All values must be a floating point number between 0 and 1. - - `Optional> tools` + - `Optional> content` - The tools to add this file to. + The content of the result that was found. The content is only included if requested via the include query parameter. - - `class CodeInterpreterTool:` + - `Optional text` - - `JsonValue; type "code_interpreter"constant` + The text content of the file. - The type of tool being defined: `code_interpreter` + - `Optional type` - - `CODE_INTERPRETER("code_interpreter")` + The type of the content. - - `JsonValue;` + - `TEXT("text")` - `JsonValue; type "file_search"constant` - The type of tool being defined: `file_search` + The type of tool call. This is always going to be `file_search` for this type of tool call. - `FILE_SEARCH("file_search")` - - `Optional completedAt` + - `class FunctionToolCall:` - The Unix timestamp (in seconds) for when the message was completed. + - `String id` - - `List content` + The ID of the tool call object. - The content of the message in array of text and/or images. + - `Function function` - - `long createdAt` + The definition of the function that was called. - The Unix timestamp (in seconds) for when the message was created. + - `String arguments` - - `Optional incompleteAt` + The arguments passed to the function. - The Unix timestamp (in seconds) for when the message was marked as incomplete. + - `String name` - - `Optional incompleteDetails` + The name of the function. - On an incomplete message, details about why the message is incomplete. + - `Optional output` - - `Reason reason` + 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. - The reason the message is incomplete. + - `JsonValue; type "function"constant` - - `CONTENT_FILTER("content_filter")` + The type of tool call. This is always going to be `function` for this type of tool call. - - `MAX_TOKENS("max_tokens")` + - `FUNCTION("function")` - - `RUN_CANCELLED("run_cancelled")` +### Tool Call Delta - - `RUN_EXPIRED("run_expired")` +- `class ToolCallDelta: A class that can be one of several variants.union` - - `RUN_FAILED("run_failed")` + Details of the Code Interpreter tool call the run step was involved in. - - `Optional metadata` + - `class CodeInterpreterToolCallDelta:` - 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. + Details of the Code Interpreter tool call the run step was involved in. - Keys are strings with a maximum length of 64 characters. Values are strings - with a maximum length of 512 characters. + - `long index` - - `JsonValue; object_ "thread.message"constant` + The index of the tool call in the tool calls array. - The object type, which is always `thread.message`. + - `JsonValue; type "code_interpreter"constant` - - `THREAD_MESSAGE("thread.message")` + The type of tool call. This is always going to be `code_interpreter` for this type of tool call. - - `Role role` + - `CODE_INTERPRETER("code_interpreter")` - The entity that produced the message. One of `user` or `assistant`. + - `Optional id` - - `USER("user")` + The ID of the tool call. - - `ASSISTANT("assistant")` + - `Optional codeInterpreter` - - `Optional runId` + The Code Interpreter tool call definition. - 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. + - `Optional input` - - `Status status` + The input to the Code Interpreter tool call. - The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. + - `Optional> outputs` - - `IN_PROGRESS("in_progress")` + 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. - - `INCOMPLETE("incomplete")` + - `class CodeInterpreterLogs:` - - `COMPLETED("completed")` + Text output from the Code Interpreter tool call as part of a run step. - - `String threadId` + - `long index` - The [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to. + The index of the output in the outputs array. -### Example + - `JsonValue; type "logs"constant` -```java -package com.openai.example; + Always `logs`. -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; + - `LOGS("logs")` -public final class Main { - private Main() {} + - `Optional logs` - public static void main(String[] args) { - OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + The text output from the Code Interpreter tool call. - MessageUpdateParams params = MessageUpdateParams.builder() - .threadId("thread_id") - .messageId("message_id") - .build(); - Message message = client.beta().threads().messages().update(params); - } -} -``` + - `class CodeInterpreterOutputImage:` -#### Response + - `long index` -```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" - }, + 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" }, @@ -6370,23 +9278,500 @@ public final class Main { } ``` -## Retrieve message +## 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. -`Message beta().threads().messages().retrieve(MessageRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + - `Optional startIndex` -**get** `/threads/{thread_id}/messages/{message_id}` + - `Optional text` -Retrieve message + The text in the message content that needs to be replaced. -### Parameters +### File Path Annotation -- `MessageRetrieveParams params` +- `class FilePathAnnotation:` - - `String threadId` + A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - `Optional messageId` + - `long endIndex` -### Returns + - `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` + + The index of the content part in the message. + + - `JsonValue; type "image_file"constant` + + Always `image_file`. + + - `IMAGE_FILE("image_file")` + + - `Optional imageFile` + + - `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 URL + +- `class 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")` + +### Image URL Content Block + +- `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")` + +### Image URL Delta + +- `class ImageUrlDelta:` + + - `Optional detail` + + Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. + + - `AUTO("auto")` + + - `LOW("low")` + + - `HIGH("high")` + + - `Optional url` + + The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. + +### Image URL Delta Block + +- `class ImageUrlDeltaBlock:` + + References an image URL in the content of a message. + + - `long index` + + The index of the content part in the message. + + - `JsonValue; type "image_url"constant` + + Always `image_url`. + + - `IMAGE_URL("image_url")` + + - `Optional imageUrl` + + - `Optional detail` + + Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. + + - `AUTO("auto")` + + - `LOW("low")` + + - `HIGH("high")` + + - `Optional url` + + The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. + +### Message - `class Message:` @@ -6432,10 +9817,140 @@ Retrieve message 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:` + + 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. @@ -6503,169 +10018,197 @@ Retrieve message The [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to. -### Example +### Message Content -```java -package com.openai.example; +- `class MessageContent: A class that can be one of several variants.union` -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; + References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. -public final class Main { - private Main() {} + - `class ImageFileContentBlock:` - public static void main(String[] args) { - OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. - MessageRetrieveParams params = MessageRetrieveParams.builder() - .threadId("thread_id") - .messageId("message_id") - .build(); - Message message = client.beta().threads().messages().retrieve(params); - } -} -``` + - `ImageFile imageFile` -#### Response + - `String fileId` -```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" -} -``` + 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")` -## Delete message + - `class FilePathAnnotation:` -`MessageDeleted beta().threads().messages().delete(MessageDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())` + A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. -**delete** `/threads/{thread_id}/messages/{message_id}` + - `long endIndex` -Delete message + - `FilePath filePath` -### Parameters + - `String fileId` -- `MessageDeleteParams params` + The ID of the file that was generated. - - `String threadId` + - `long startIndex` - - `Optional messageId` + - `String text` -### Returns + The text in the message content that needs to be replaced. -- `class MessageDeleted:` + - `JsonValue; type "file_path"constant` - - `String id` + Always `file_path`. - - `boolean deleted` + - `FILE_PATH("file_path")` - - `JsonValue; object_ "thread.message.deleted"constant` + - `String value` - - `THREAD_MESSAGE_DELETED("thread.message.deleted")` + The data that makes up the text. -### Example + - `JsonValue; type "text"constant` -```java -package com.openai.example; + Always `text`. -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; + - `TEXT("text")` -public final class Main { - private Main() {} + - `class RefusalContentBlock:` - public static void main(String[] args) { - OpenAIClient client = OpenAIOkHttpClient.fromEnv(); + The refusal content generated by the assistant. - MessageDeleteParams params = MessageDeleteParams.builder() - .threadId("thread_id") - .messageId("message_id") - .build(); - MessageDeleted messageDeleted = client.beta().threads().messages().delete(params); - } -} -``` + - `String refusal` -#### Response + - `JsonValue; type "refusal"constant` -```json -{ - "id": "id", - "deleted": true, - "object": "thread.message.deleted" -} -``` + Always `refusal`. -## Domain Types + - `REFUSAL("refusal")` -### Annotation +### Message Content Delta -- `class Annotation:` +- `class MessageContentDelta: A class that can be one of several variants.union` -### Annotation Delta + References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. -- `class AnnotationDelta:` + - `class ImageFileDeltaBlock:` -### File Citation Annotation + References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. -- `class FileCitationAnnotation:` + - `long index` - 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 index of the content part in the message. - - `long endIndex` + - `JsonValue; type "image_file"constant` - - `FileCitation fileCitation` + Always `image_file`. - - `String fileId` + - `IMAGE_FILE("image_file")` - The ID of the specific File the citation is from. + - `Optional imageFile` - - `long startIndex` + - `Optional detail` - - `String text` + 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 text in the message content that needs to be replaced. + - `AUTO("auto")` - - `JsonValue; type "file_citation"constant` + - `LOW("low")` - Always `file_citation`. + - `HIGH("high")` - - `FILE_CITATION("file_citation")` + - `Optional fileId` -### File Citation Delta Annotation + 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 FileCitationDeltaAnnotation:` + - `class TextDeltaBlock:` + + The text content that is part of a message. + + - `long index` + + The index of the content part in the message. + + - `JsonValue; type "text"constant` + + Always `text`. + + - `TEXT("text")` + + - `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. @@ -6697,73 +10240,73 @@ public final class Main { The text in the message content that needs to be replaced. -### File Path Annotation - -- `class FilePathAnnotation:` + - `class FilePathDeltaAnnotation:` A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - `long endIndex` + - `long index` - - `FilePath filePath` + The index of the annotation in the text content part. - - `String fileId` + - `JsonValue; type "file_path"constant` - The ID of the file that was generated. + Always `file_path`. - - `long startIndex` + - `FILE_PATH("file_path")` - - `String text` + - `Optional endIndex` - The text in the message content that needs to be replaced. + - `Optional filePath` - - `JsonValue; type "file_path"constant` + - `Optional fileId` - Always `file_path`. + The ID of the file that was generated. - - `FILE_PATH("file_path")` + - `Optional startIndex` -### File Path Delta Annotation + - `Optional text` -- `class FilePathDeltaAnnotation:` + The text in the message content that needs to be replaced. - A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. + - `Optional value` - - `long index` + The data that makes up the text. - The index of the annotation in the text content part. + - `class RefusalDeltaBlock:` - - `JsonValue; type "file_path"constant` + The refusal content that is part of a message. - Always `file_path`. + - `long index` - - `FILE_PATH("file_path")` + The index of the refusal part in the message. - - `Optional endIndex` + - `JsonValue; type "refusal"constant` - - `Optional filePath` + Always `refusal`. - - `Optional fileId` + - `REFUSAL("refusal")` - The ID of the file that was generated. + - `Optional refusal` - - `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` -### Image File + The index of the content part in the message. -- `class ImageFile:` + - `JsonValue; type "image_url"constant` - - `String fileId` + Always `image_url`. - 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_URL("image_url")` + + - `Optional imageUrl` - `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`. - `AUTO("auto")` @@ -6771,9 +10314,17 @@ public final class Main { - `HIGH("high")` -### Image File Content Block + - `Optional url` -- `class ImageFileContentBlock:` + 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. + + - `class ImageFileContentBlock:` References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. @@ -6799,13 +10350,19 @@ public final class Main { - `IMAGE_FILE("image_file")` -### Image File Delta + - `class ImageUrlContentBlock:` -- `class ImageFileDelta:` + 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 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")` @@ -6813,53 +10370,67 @@ public final class Main { - `HIGH("high")` - - `Optional fileId` + - `JsonValue; type "image_url"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. + The type of the content part. -### Image File Delta Block + - `IMAGE_URL("image_url")` -- `class ImageFileDeltaBlock:` + - `class TextContentBlockParam:` - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. + The text content that is part of a message. - - `long index` + - `String text` - The index of the content part in the message. + Text content to be sent to the model - - `JsonValue; type "image_file"constant` + - `JsonValue; type "text"constant` - Always `image_file`. + Always `text`. - - `IMAGE_FILE("image_file")` + - `TEXT("text")` - - `Optional imageFile` +### Message Deleted - - `Optional detail` +- `class MessageDeleted:` - 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`. + - `String id` - - `AUTO("auto")` + - `boolean deleted` - - `LOW("low")` + - `JsonValue; object_ "thread.message.deleted"constant` - - `HIGH("high")` + - `THREAD_MESSAGE_DELETED("thread.message.deleted")` - - `Optional fileId` +### Message Delta - 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 MessageDelta:` -### Image URL + The delta containing the fields that have changed on the Message. -- `class ImageUrl:` + - `Optional> content` - - `String url` + The content of the message in array of text and/or images. - The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. + - `class ImageFileDeltaBlock:` + + References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. + + - `long index` + + The index of the content part in the message. + + - `JsonValue; type "image_file"constant` + + Always `image_file`. + + - `IMAGE_FILE("image_file")` + + - `Optional imageFile` - `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")` @@ -6867,328 +10438,321 @@ public final class Main { - `HIGH("high")` -### Image URL Content Block - -- `class ImageUrlContentBlock:` - - References an image URL in the content of a message. + - `Optional fileId` - - `ImageUrl 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. - - `String url` + - `class TextDeltaBlock:` - The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. + The text content that is part of a message. - - `Optional detail` + - `long index` - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` + The index of the content part in the message. - - `AUTO("auto")` + - `JsonValue; type "text"constant` - - `LOW("low")` + Always `text`. - - `HIGH("high")` + - `TEXT("text")` - - `JsonValue; type "image_url"constant` + - `Optional text` - The type of the content part. + - `Optional> annotations` - - `IMAGE_URL("image_url")` + - `class FileCitationDeltaAnnotation:` -### Image URL Delta + 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 ImageUrlDelta:` + - `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`. + - `JsonValue; type "file_citation"constant` - - `AUTO("auto")` + Always `file_citation`. - - `LOW("low")` + - `FILE_CITATION("file_citation")` - - `HIGH("high")` + - `Optional endIndex` - - `Optional url` + - `Optional fileCitation` - The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. + - `Optional fileId` -### Image URL Delta Block + The ID of the specific File the citation is from. -- `class ImageUrlDeltaBlock:` + - `Optional quote` - References an image URL in the content of a message. + The specific quote in the file. - - `long index` + - `Optional startIndex` - The index of the content part in the message. + - `Optional text` - - `JsonValue; type "image_url"constant` + The text in the message content that needs to be replaced. - Always `image_url`. + - `class FilePathDeltaAnnotation:` - - `IMAGE_URL("image_url")` + A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - `Optional imageUrl` + - `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`. + - `JsonValue; type "file_path"constant` - - `AUTO("auto")` + Always `file_path`. - - `LOW("low")` + - `FILE_PATH("file_path")` - - `HIGH("high")` + - `Optional endIndex` - - `Optional url` + - `Optional filePath` - The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. + - `Optional fileId` -### Message + The ID of the file that was generated. -- `class Message:` + - `Optional startIndex` - Represents a message within a [thread](https://platform.openai.com/docs/api-reference/threads). + - `Optional text` - - `String id` + The text in the message content that needs to be replaced. - The identifier, which can be referenced in API endpoints. + - `Optional value` - - `Optional assistantId` + The data that makes up the text. - If applicable, the ID of the [assistant](https://platform.openai.com/docs/api-reference/assistants) that authored this message. + - `class RefusalDeltaBlock:` - - `Optional> attachments` + The refusal content that is part of a message. - A list of files attached to the message, and the tools they were added to. + - `long index` - - `Optional fileId` + The index of the refusal part in the message. - The ID of the file to attach to the message. + - `JsonValue; type "refusal"constant` - - `Optional> tools` + Always `refusal`. - The tools to add this file to. + - `REFUSAL("refusal")` - - `class CodeInterpreterTool:` + - `Optional refusal` - - `JsonValue; type "code_interpreter"constant` + - `class ImageUrlDeltaBlock:` - The type of tool being defined: `code_interpreter` + References an image URL in the content of a message. - - `CODE_INTERPRETER("code_interpreter")` + - `long index` - - `JsonValue;` + The index of the content part in the message. - - `JsonValue; type "file_search"constant` + - `JsonValue; type "image_url"constant` - The type of tool being defined: `file_search` + Always `image_url`. - - `FILE_SEARCH("file_search")` + - `IMAGE_URL("image_url")` - - `Optional completedAt` + - `Optional imageUrl` - The Unix timestamp (in seconds) for when the message was completed. + - `Optional detail` - - `List content` + Specifies the detail level of the image. `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")` - - `long createdAt` + - `LOW("low")` - The Unix timestamp (in seconds) for when the message was created. + - `HIGH("high")` - - `Optional incompleteAt` + - `Optional url` - The Unix timestamp (in seconds) for when the message was marked as incomplete. + The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. - - `Optional incompleteDetails` + - `Optional role` - On an incomplete message, details about why the message is incomplete. + The entity that produced the message. One of `user` or `assistant`. - - `Reason reason` + - `USER("user")` - The reason the message is incomplete. + - `ASSISTANT("assistant")` - - `CONTENT_FILTER("content_filter")` +### Message Delta Event - - `MAX_TOKENS("max_tokens")` +- `class MessageDeltaEvent:` - - `RUN_CANCELLED("run_cancelled")` + Represents a message delta i.e. any changed fields on a message during streaming. - - `RUN_EXPIRED("run_expired")` + - `String id` - - `RUN_FAILED("run_failed")` + The identifier of the message, which can be referenced in API endpoints. - - `Optional metadata` + - `MessageDelta delta` - 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 delta containing the fields that have changed on the Message. - Keys are strings with a maximum length of 64 characters. Values are strings - with a maximum length of 512 characters. + - `Optional> content` - - `JsonValue; object_ "thread.message"constant` + The content of the message in array of text and/or images. - The object type, which is always `thread.message`. + - `class ImageFileDeltaBlock:` - - `THREAD_MESSAGE("thread.message")` + References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. - - `Role role` + - `long index` - The entity that produced the message. One of `user` or `assistant`. + The index of the content part in the message. - - `USER("user")` + - `JsonValue; type "image_file"constant` - - `ASSISTANT("assistant")` + Always `image_file`. - - `Optional runId` + - `IMAGE_FILE("image_file")` - 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. + - `Optional imageFile` - - `Status status` + - `Optional detail` - The status of the message, which can be either `in_progress`, `incomplete`, or `completed`. + 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`. - - `IN_PROGRESS("in_progress")` + - `AUTO("auto")` - - `INCOMPLETE("incomplete")` + - `LOW("low")` - - `COMPLETED("completed")` + - `HIGH("high")` - - `String threadId` + - `Optional fileId` - The [thread](https://platform.openai.com/docs/api-reference/threads) ID that this message belongs to. + 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. -### Message Content + - `class TextDeltaBlock:` -- `class MessageContent:` + The text content that is part of a message. -### Message Content Delta + - `long index` -- `class MessageContentDelta:` + The index of the content part in the message. -### Message Content Part Param + - `JsonValue; type "text"constant` -- `class MessageContentPartParam: A class that can be one of several variants.union` + Always `text`. - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. + - `TEXT("text")` - - `class ImageFileContentBlock:` + - `Optional text` - References an image [File](https://platform.openai.com/docs/api-reference/files) in the content of a message. + - `Optional> annotations` - - `ImageFile imageFile` + - `class FileCitationDeltaAnnotation:` - - `String fileId` + 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 [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. + - `long index` - - `Optional detail` + The index of the annotation in the text content part. - 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`. + - `JsonValue; type "file_citation"constant` - - `AUTO("auto")` + Always `file_citation`. - - `LOW("low")` + - `FILE_CITATION("file_citation")` - - `HIGH("high")` + - `Optional endIndex` - - `JsonValue; type "image_file"constant` + - `Optional fileCitation` - Always `image_file`. + - `Optional fileId` - - `IMAGE_FILE("image_file")` + The ID of the specific File the citation is from. - - `class ImageUrlContentBlock:` + - `Optional quote` - References an image URL in the content of a message. + The specific quote in the file. - - `ImageUrl imageUrl` + - `Optional startIndex` - - `String url` + - `Optional text` - The external URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. + The text in the message content that needs to be replaced. - - `Optional detail` + - `class FilePathDeltaAnnotation:` - Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. Default value is `auto` + A URL for the file that's generated when the assistant used the `code_interpreter` tool to generate a file. - - `AUTO("auto")` + - `long index` - - `LOW("low")` + The index of the annotation in the text content part. - - `HIGH("high")` + - `JsonValue; type "file_path"constant` - - `JsonValue; type "image_url"constant` + Always `file_path`. - The type of the content part. + - `FILE_PATH("file_path")` - - `IMAGE_URL("image_url")` + - `Optional endIndex` - - `class TextContentBlockParam:` + - `Optional filePath` - The text content that is part of a message. + - `Optional fileId` - - `String text` + The ID of the file that was generated. - Text content to be sent to the model + - `Optional startIndex` - - `JsonValue; type "text"constant` + - `Optional text` - Always `text`. + The text in the message content that needs to be replaced. - - `TEXT("text")` + - `Optional value` -### Message Deleted + The data that makes up the text. -- `class MessageDeleted:` + - `class RefusalDeltaBlock:` - - `String id` + The refusal content that is part of a message. - - `boolean deleted` + - `long index` - - `JsonValue; object_ "thread.message.deleted"constant` + The index of the refusal part in the message. - - `THREAD_MESSAGE_DELETED("thread.message.deleted")` + - `JsonValue; type "refusal"constant` -### Message Delta + Always `refusal`. -- `class MessageDelta:` + - `REFUSAL("refusal")` - The delta containing the fields that have changed on the Message. + - `Optional refusal` - - `Optional> content` + - `class ImageUrlDeltaBlock:` - The content of the message in array of text and/or images. + References an image URL in the content of a message. - - `Optional role` + - `long index` - The entity that produced the message. One of `user` or `assistant`. + The index of the content part in the message. - - `USER("user")` + - `JsonValue; type "image_url"constant` - - `ASSISTANT("assistant")` + Always `image_url`. -### Message Delta Event + - `IMAGE_URL("image_url")` -- `class MessageDeltaEvent:` + - `Optional imageUrl` - Represents a message delta i.e. any changed fields on a message during streaming. + - `Optional detail` - - `String id` + Specifies the detail level of the image. `low` uses fewer tokens, you can opt in to high resolution using `high`. - The identifier of the message, which can be referenced in API endpoints. + - `AUTO("auto")` - - `MessageDelta delta` + - `LOW("low")` - The delta containing the fields that have changed on the Message. + - `HIGH("high")` - - `Optional> content` + - `Optional url` - The content of the message in array of text and/or images. + The URL of the image, must be a supported image types: jpeg, jpg, png, gif, webp. - `Optional role` @@ -7240,7 +10804,55 @@ public final class Main { - `class Text:` - - `List annotations` + - `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` @@ -7254,7 +10866,55 @@ public final class Main { - `Text text` - - `List annotations` + - `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` @@ -7286,7 +10946,67 @@ public final class Main { - `class TextDelta:` - - `Optional> annotations` + - `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 value` @@ -7310,7 +11030,67 @@ public final class Main { - `Optional text` - - `Optional> annotations` + - `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 value`