Fix a typo in openai.adoc (#252)
This commit is contained in:
@@ -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<ChatResponse> generateStream(P@RequestParam(value = "message", defaultValue = "Tell me a joke") String message) {
|
||||
@GetMapping("/open-ai/generateStream")
|
||||
public Flux<ChatResponse> 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`.
|
||||
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`.
|
||||
|
||||
Reference in New Issue
Block a user