diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/clients/openai.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/clients/openai.adoc index 7c12a1593..64ccac77a 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/clients/openai.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/clients/openai.adoc @@ -53,21 +53,23 @@ Here is an example of a simple `@Controller` class that uses the `ChatClient` im public class ChatController { private final ChatClient chatClient; + private final StreamingChatClient streamingChatClient; @Autowired - public ChatController(ChatClient chatClient) { + public ChatController(ChatClient chatClient, StreamingChatClient streamingChatClient) { this.chatClient = chatClient; + this.streamingChatClient = streamingChatClient; } - @GetMapping("/ai/generate") + @GetMapping("/open-ai/generate") public Map generate(@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) { return Map.of("generation", chatClient.generate(message)); } - @GetMapping("/ai/generateStream") - public Flux generateStream(P@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) { + @GetMapping("/open-ai/generateStream") + public Flux generateStream(@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) { Prompt prompt = new Prompt(new UserMessage(message)); - return chatClient.generateStream(prompt); + return streamingChatClient.generate(prompt); } } ---- @@ -111,4 +113,4 @@ The `spring.ai.openai.chat.base-url` and `spring.ai.openai.chat.api-key` propert Similarly, the `spring.ai.openai.embedding.base-url` and `spring.ai.openai.embedding.api-key` properties if set take precedence over the common properties. This is useful if you want to use different OpenAI accounts for different models and different model endpoints. -Also by default, the `spring.ai.openai.chat.model` is set to `gpt-35-turbo` and the `spring.ai.openai.embedding.model` is set to `text-embedding-ada-002`. \ No newline at end of file +Also by default, the `spring.ai.openai.chat.model` is set to `gpt-35-turbo` and the `spring.ai.openai.embedding.model` is set to `text-embedding-ada-002`.