From 39bd735edabababafc1257b9dd1cab6ce888669c Mon Sep 17 00:00:00 2001 From: Choi ByungHyeon Date: Thu, 25 Jan 2024 23:13:36 +0900 Subject: [PATCH] Fix a typo in openai.adoc (#252) --- .../modules/ROOT/pages/api/clients/openai.adoc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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`.