Skip to content

Commit 541913d

Browse files
authored
[Doc] Docs update for OpenAI responses API (#582)
* Update completions API naming and add responses API docs * Remove repeated set-up instructions * Add two sections in OpenAI
1 parent be6783a commit 541913d

1 file changed

Lines changed: 91 additions & 6 deletions

File tree

docs/content/docs/development/chat_models.md

Lines changed: 91 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,11 @@ OpenAI provides cloud-based chat models with state-of-the-art performance for a
648648
1. Create an account at [OpenAI Platform](https://platform.openai.com/)
649649
2. Navigate to [API Keys](https://platform.openai.com/api-keys) and create a new secret key
650650

651-
#### OpenAIChatModelConnection Parameters
651+
#### Completions API
652652

653-
{{< tabs "OpenAIChatModelConnection Parameters" >}}
653+
##### OpenAICompletionsConnection Parameters
654+
655+
{{< tabs "OpenAICompletionsConnection Parameters" >}}
654656

655657
{{< tab "Python" >}}
656658

@@ -680,9 +682,9 @@ OpenAI provides cloud-based chat models with state-of-the-art performance for a
680682

681683
{{< /tabs >}}
682684

683-
#### OpenAIChatModelSetup Parameters
685+
##### OpenAICompletionsSetup Parameters
684686

685-
{{< tabs "OpenAIChatModelSetup Parameters" >}}
687+
{{< tabs "OpenAICompletionsSetup Parameters" >}}
686688

687689
{{< tab "Python" >}}
688690

@@ -722,9 +724,9 @@ OpenAI provides cloud-based chat models with state-of-the-art performance for a
722724

723725
{{< /tabs >}}
724726

725-
#### Usage Example
727+
##### Usage Example
726728

727-
{{< tabs "OpenAI Usage Example" >}}
729+
{{< tabs "OpenAI Chat Completions Usage Example" >}}
728730

729731
{{< tab "Python" >}}
730732
```python
@@ -786,6 +788,89 @@ public class MyAgent extends Agent {
786788

787789
{{< /tabs >}}
788790

791+
#### Responses API
792+
793+
{{< hint info >}}
794+
Responses API is only supported in Java currently. To use OpenAI Responses API from Python agents, see [Using Cross-Language Providers](#using-cross-language-providers).
795+
{{< /hint >}}
796+
797+
##### OpenAIResponsesModelConnection Parameters
798+
799+
{{< tabs "OpenAIResponsesModelConnection Parameters" >}}
800+
801+
{{< tab "Java" >}}
802+
803+
| Parameter | Type | Default | Description |
804+
|-----------|------|---------|-------------|
805+
| `api_key` | String | Required | OpenAI API key for authentication |
806+
| `api_base_url` | String | None | Base URL for OpenAI API (useful for proxies) |
807+
| `max_retries` | int | `2` | Maximum number of API retry attempts |
808+
| `timeout` | int | None | Timeout in seconds for API requests |
809+
| `default_headers` | Map<String, String> | None | Default headers for API requests |
810+
| `model` | String | None | Default model to use if not specified in setup |
811+
812+
{{< /tab >}}
813+
814+
{{< /tabs >}}
815+
816+
##### OpenAIResponsesModelSetup Parameters
817+
818+
{{< tabs "OpenAIResponsesModelSetup Parameters" >}}
819+
820+
{{< tab "Java" >}}
821+
822+
| Parameter | Type | Default | Description |
823+
|-----------|------|---------|-------------|
824+
| `connection` | String | Required | Reference to connection method name |
825+
| `model` | String | `"gpt-4o"` | Name of the chat model to use |
826+
| `prompt` | Prompt \| String | None | Prompt template or reference to prompt resource |
827+
| `tools` | List<String> | None | List of tool names available to the model |
828+
| `temperature` | double | `0.1` | Sampling temperature (0.0 to 2.0) |
829+
| `max_tokens` | int | None | Maximum number of tokens to generate |
830+
| `strict` | boolean | `false` | Enable strict mode for tool calling schemas |
831+
| `reasoning_effort` | String | None | Reasoning effort level for reasoning models ("low", "medium", "high") |
832+
| `store` | boolean | `false` | Whether to store the response for later retrieval |
833+
| `instructions` | String | None | System-level instructions for the model |
834+
| `additional_kwargs` | Map<String, Object> | `{}` | Additional Responses API parameters |
835+
836+
{{< /tab >}}
837+
838+
{{< /tabs >}}
839+
840+
##### Usage Example
841+
842+
{{< tabs "OpenAI Responses API Usage Example" >}}
843+
844+
{{< tab "Java" >}}
845+
```java
846+
public class MyAgent extends Agent {
847+
@ChatModelConnection
848+
public static ResourceDescriptor openaiResponsesConnection() {
849+
return ResourceDescriptor.Builder.newBuilder(ResourceName.ChatModel.OPENAI_RESPONSES_CONNECTION)
850+
.addInitialArgument("api_key", "<your-api-key>")
851+
.addInitialArgument("timeout", 120)
852+
.addInitialArgument("max_retries", 3)
853+
.build();
854+
}
855+
856+
@ChatModelSetup
857+
public static ResourceDescriptor openaiResponsesChatModel() {
858+
return ResourceDescriptor.Builder.newBuilder(ResourceName.ChatModel.OPENAI_RESPONSES_SETUP)
859+
.addInitialArgument("connection", "openaiResponsesConnection")
860+
.addInitialArgument("model", "gpt-4o")
861+
.addInitialArgument("temperature", 0.3d)
862+
.addInitialArgument("max_tokens", 2048)
863+
.addInitialArgument("store", true)
864+
.build();
865+
}
866+
867+
...
868+
}
869+
```
870+
{{< /tab >}}
871+
872+
{{< /tabs >}}
873+
789874
#### Available Models
790875

791876
Visit the [OpenAI Models documentation](https://platform.openai.com/docs/models) for the complete and up-to-date list of available chat models.

0 commit comments

Comments
 (0)