minor doc improvements
This commit is contained in:
@@ -42,7 +42,7 @@ class MyService {
|
||||
|
||||
Prompt prompt = createPrompt(request);
|
||||
|
||||
ChatResponse response = chatClient.generate(prompt);
|
||||
ChatResponse response = chatClient.call(prompt);
|
||||
|
||||
// Process the chat response
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ OpenAiChatClient chatClient = ...
|
||||
UserMessage userMessage = new UserMessage("What's the weather like in San Francisco, Tokyo, and Paris?");
|
||||
|
||||
ChatResponse response = chatClient.call(new Prompt(List.of(userMessage),
|
||||
OpenAiChatOptions.builder().withEnabledFunction("CurrentWeather").build())); // (1) Enable the function
|
||||
OpenAiChatOptions.builder().withFunction("CurrentWeather").build())); // (1) Enable the function
|
||||
|
||||
logger.info("Response: {}", response);
|
||||
----
|
||||
@@ -218,7 +218,7 @@ The https://github.com/spring-projects/spring-ai/blob/main/spring-ai-spring-boot
|
||||
// UserMessage userMessage = new UserMessage("What's the weather like in San Francisco, Tokyo, and Paris?");
|
||||
//
|
||||
// ChatResponse response = chatClient.call(new Prompt(List.of(userMessage),
|
||||
// OpenAiChatOptions.builder().withEnabledFunction("CurrentWeather").build())); // Enable the function
|
||||
// OpenAiChatOptions.builder().withFunction("CurrentWeather").build())); // Enable the function
|
||||
// ----
|
||||
//
|
||||
// NOTE: Functions are registered when OpenAiChatClient is created, by you must enable in the Prompt the functions to be used in the request.
|
||||
|
||||
@@ -37,7 +37,7 @@ You can find this on the Inference Endpoint's UI link:https://ui.endpoints.huggi
|
||||
----
|
||||
HuggingfaceChatClient client = new HuggingfaceChatClient(apiKey, basePath);
|
||||
Prompt prompt = new Prompt("Your text here...");
|
||||
ChatResponse response = client.generate(prompt);
|
||||
ChatResponse response = client.call(prompt);
|
||||
System.out.println(response.getGeneration().getText());
|
||||
----
|
||||
|
||||
@@ -55,7 +55,7 @@ String mistral7bInstruct = """
|
||||
Just generate the JSON object without explanations:
|
||||
[/INST]""";
|
||||
Prompt prompt = new Prompt(mistral7bInstruct);
|
||||
ChatResponse aiResponse = huggingfaceChatClient.generate(prompt);
|
||||
ChatResponse aiResponse = huggingfaceChatClient.call(prompt);
|
||||
System.out.println(response.getGeneration().getText());
|
||||
----
|
||||
Will produce the output
|
||||
|
||||
Reference in New Issue
Block a user