Polish
This commit is contained in:
committed by
Christian Tzolov
parent
87dc3be739
commit
7c26c7bcdf
@@ -200,7 +200,7 @@ public class TransformersEmbeddingModel extends AbstractEmbeddingModel implement
|
||||
logger.info("Model output names: " + onnxModelOutputs.stream().collect(Collectors.joining(", ")));
|
||||
|
||||
Assert.isTrue(onnxModelOutputs.contains(this.modelOutputName),
|
||||
"The generative output names doesn't contain expected: " + this.modelOutputName
|
||||
"The generative output names don't contain expected: " + this.modelOutputName
|
||||
+ ". Consider one of the available model outputs: "
|
||||
+ onnxModelOutputs.stream().collect(Collectors.joining(", ")));
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* [Usage examples](https://github.com/spring-projects/spring-ai/blob/main/models/spring-ai-openai/src/test/java/org/springframework/ai/openai/chat/OpenAiChatModelIT.java)
|
||||
|
||||
The output of AI models traditionally arrives as a text, even if you ask for the reply to be in JSON.
|
||||
It may be the correct JSON, but it isn’t a JSON data structure.
|
||||
It may be a correct JSON, but it isn’t a JSON data structure.
|
||||
It is just a string.
|
||||
Also, asking "for JSON" as part of the prompt isn’t 100% accurate.
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ Deprecated! uset the Structured output instead.
|
||||
|
||||
* [Documentation](https://docs.spring.io/spring-ai/reference/concepts.html#_output_parsing)
|
||||
|
||||
The output of AI models traditionally arrives as a java.util.String, even if you ask for the reply to be in JSON. It may be the correct JSON, but it isn’t a JSON data structure. It is just a string. Also, asking "for JSON" as part of the prompt isn’t 100% accurate.
|
||||
The output of AI models traditionally arrives as a java.util.String, even if you ask for the reply to be in JSON. It may be a correct JSON, but it isn’t a JSON data structure. It is just a string. Also, asking "for JSON" as part of the prompt isn’t 100% accurate.
|
||||
|
||||
This intricacy has led to the emergence of a specialized field involving the creation of prompts to yield the intended output, followed by parsing the resulting simple string into a usable data structure for application integration.
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ Initially starting as simple strings, prompts have evolved to include multiple m
|
||||
Tokens serve as the building blocks of how an AI model works.
|
||||
On input, Models convert words to tokens, and on output, they convert tokens back to words.
|
||||
|
||||
In English, one token roughly corresponds to 75% of a word. For reference, Shakespeare's complete works, totaling around 900,000 words, translates to approximately 1.2 million tokens.
|
||||
In English, one token roughly corresponds to 75% of a word. For reference, Shakespeare's complete works, totaling around 900,000 words, translate to approximately 1.2 million tokens.
|
||||
|
||||
Perhaps more important is that Tokens = *`$`*.
|
||||
|
||||
@@ -47,7 +47,7 @@ This is an area that the Spring AI project helps you with.
|
||||
== Output Parsing
|
||||
|
||||
The output of AI models traditionally arrives as a `java.util.String`, even if you ask for the reply to be in JSON.
|
||||
It may be the correct JSON, but it isn't a JSON data structure. It is just a string.
|
||||
It may be a correct JSON, but it isn't a JSON data structure. It is just a string.
|
||||
Also, asking "for JSON" as part of the prompt isn't 100% accurate.
|
||||
|
||||
This intricacy has led to the emergence of a specialized field involving the creation of prompts to yield the intended output, followed by parsing the resulting simple string into a usable data structure for application integration.
|
||||
|
||||
@@ -12,7 +12,7 @@ Spring AI provides flexible and user-friendly ways to register and call custom f
|
||||
In general, the custom functions need to provide a function `name`, `description`, and the function call `signature` (as JSON schema) to let the model know what arguments the function expects.
|
||||
The `description` helps the model to understand when to call the function.
|
||||
|
||||
As a developer, you need to implement a function that takes the function call arguments sent from the AI model, and respond with the result back to the model.
|
||||
As a developer, you need to implement a function that takes the function call arguments sent from the AI model, and responds with the result back to the model.
|
||||
Your function can in turn invoke other 3rd party services to provide the results.
|
||||
|
||||
Spring AI makes this as easy as defining a `@Bean` definition that returns a `java.util.Function` and supplying the bean name as an option when invoking the `ChatModel`.
|
||||
|
||||
@@ -13,7 +13,7 @@ The Azure OpenAI API does not call the function directly; instead, the model gen
|
||||
Spring AI provides flexible and user-friendly ways to register and call custom functions.
|
||||
In general, the custom functions need to provide a function `name`, `description`, and the function call `signature` (as JSON schema) to let the model know what arguments the function expects. The `description` helps the model to understand when to call the function.
|
||||
|
||||
As a developer, you need to implement a function that takes the function call arguments sent from the AI model, and respond with the result back to the model.
|
||||
As a developer, you need to implement a function that takes the function call arguments sent from the AI model, and responds with the result back to the model.
|
||||
Your function can in turn invoke other 3rd party services to provide the results.
|
||||
|
||||
Spring AI makes this as easy as defining a `@Bean` definition that returns a `java.util.Function` and supplying the bean name as an option when invoking the `ChatModel`.
|
||||
|
||||
@@ -9,7 +9,7 @@ The MiniMax API does not call the function directly; instead, the model generate
|
||||
Spring AI provides flexible and user-friendly ways to register and call custom functions.
|
||||
In general, the custom functions need to provide a function `name`, `description`, and the function call `signature` (as JSON schema) to let the model know what arguments the function expects. The `description` helps the model to understand when to call the function.
|
||||
|
||||
As a developer, you need to implement a functions that takes the function call arguments sent from the AI model, and respond with the result back to the model. Your function can in turn invoke other 3rd party services to provide the results.
|
||||
As a developer, you need to implement a function that takes the function call arguments sent from the AI model, and responds with the result back to the model. Your function can in turn invoke other 3rd party services to provide the results.
|
||||
|
||||
Spring AI makes this as easy as defining a `@Bean` definition that returns a `java.util.Function` and supplying the bean name as an option when invoking the `ChatModel`.
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ Spring AI provides flexible and user-friendly ways to register and call custom f
|
||||
In general, the custom functions need to provide a function `name`, `description`, and the function call `signature` (as JSON schema) to let the model know what arguments the function expects.
|
||||
The `description` helps the model to understand when to call the function.
|
||||
|
||||
As a developer, you need to implement a function that takes the function call arguments sent from the AI model, and respond with the result back to the model.
|
||||
As a developer, you need to implement a function that takes the function call arguments sent from the AI model, and responds with the result back to the model.
|
||||
Your function can in turn invoke other 3rd party services to provide the results.
|
||||
|
||||
Spring AI makes this as easy as defining a `@Bean` definition that returns a `java.util.Function` and supplying the bean name as an option when invoking the `ChatModel`.
|
||||
|
||||
@@ -9,7 +9,7 @@ The Moonshot API does not call the function directly; instead, the model generat
|
||||
Spring AI provides flexible and user-friendly ways to register and call custom functions.
|
||||
In general, the custom functions need to provide a function `name`, `description`, and the function call `signature` (as JSON schema) to let the model know what arguments the function expects. The `description` helps the model to understand when to call the function.
|
||||
|
||||
As a developer, you need to implement a functions that takes the function call arguments sent from the AI model, and respond with the result back to the model. Your function can in turn invoke other 3rd party services to provide the results.
|
||||
As a developer, you need to implement a function that takes the function call arguments sent from the AI model, and responds with the result back to the model. Your function can in turn invoke other 3rd party services to provide the results.
|
||||
|
||||
Spring AI makes this as easy as defining a `@Bean` definition that returns a `java.util.Function` and supplying the bean name as an option when invoking the `ChatModel`.
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ The OpenAI API does not call the function directly; instead, the model generates
|
||||
Spring AI provides flexible and user-friendly ways to register and call custom functions.
|
||||
In general, the custom functions need to provide a function `name`, `description`, and the function call `signature` (as JSON schema) to let the model know what arguments the function expects. The `description` helps the model to understand when to call the function.
|
||||
|
||||
As a developer, you need to implement a function that takes the function call arguments sent from the AI model, and respond with the result back to the model. Your function can in turn invoke other 3rd party services to provide the results.
|
||||
As a developer, you need to implement a function that takes the function call arguments sent from the AI model, and responds with the result back to the model. Your function can in turn invoke other 3rd party services to provide the results.
|
||||
|
||||
Spring AI makes this as easy as defining a `@Bean` definition that returns a `java.util.Function` and supplying the bean name as an option when invoking the `ChatModel`.
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ The VertexAI Gemini API does not call the function directly; instead, the model
|
||||
Spring AI provides flexible and user-friendly ways to register and call custom functions.
|
||||
In general, the custom functions need to provide a function `name`, `description`, and the function call `signature` (as Open API schema) to let the model know what arguments the function expects. The `description` helps the model to understand when to call the function.
|
||||
|
||||
As a developer, you need to implement a function that takes the function call arguments sent from the AI model, and respond with the result back to the model.
|
||||
As a developer, you need to implement a function that takes the function call arguments sent from the AI model, and responds with the result back to the model.
|
||||
Your function can in turn invoke other 3rd party services to provide the results.
|
||||
|
||||
Spring AI makes this as easy as defining a `@Bean` definition that returns a `java.util.Function` and supplying the bean name as an option when invoking the `ChatModel`.
|
||||
|
||||
@@ -9,7 +9,7 @@ The ZhiPuAI API does not call the function directly; instead, the model generate
|
||||
Spring AI provides flexible and user-friendly ways to register and call custom functions.
|
||||
In general, the custom functions need to provide a function `name`, `description`, and the function call `signature` (as JSON schema) to let the model know what arguments the function expects. The `description` helps the model to understand when to call the function.
|
||||
|
||||
As a developer, you need to implement a functions that takes the function call arguments sent from the AI model, and respond with the result back to the model. Your function can in turn invoke other 3rd party services to provide the results.
|
||||
As a developer, you need to implement a function that takes the function call arguments sent from the AI model, and responds with the result back to the model. Your function can in turn invoke other 3rd party services to provide the results.
|
||||
|
||||
Spring AI makes this as easy as defining a `@Bean` definition that returns a `java.util.Function` and supplying the bean name as an option when invoking the `ChatModel`.
|
||||
|
||||
|
||||
@@ -95,8 +95,8 @@ spring.ai.embedding.transformer.tokenizer.options.padding=true
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
If you get an error like `The generative output names doesn't contain expected: last_hidden_state. Consider one of the available model outputs: token_embeddings, ....`, you need to set the model output name to a correct value per your models.
|
||||
Cosider the names listed in the error message.
|
||||
If you get an error like `The generative output names don't contain expected: last_hidden_state. Consider one of the available model outputs: token_embeddings, ....`, you need to set the model output name to a correct value per your models.
|
||||
Consider the names listed in the error message.
|
||||
For example:
|
||||
|
||||
----
|
||||
|
||||
@@ -96,7 +96,7 @@ You can think of this semantic space as a vector.
|
||||
Tokens serve as the building blocks of how an AI model works.
|
||||
On input, models convert words to tokens. On output, they convert tokens back to words.
|
||||
|
||||
In English, one token roughly corresponds to 75% of a word. For reference, Shakespeare's complete works, totaling around 900,000 words, translates to approximately 1.2 million tokens.
|
||||
In English, one token roughly corresponds to 75% of a word. For reference, Shakespeare's complete works, totaling around 900,000 words, translate to approximately 1.2 million tokens.
|
||||
|
||||
image::spring-ai-concepts-tokens.png[Tokens, width=600, align="center"]
|
||||
|
||||
@@ -115,7 +115,7 @@ The Spring AI project helps you with this task.
|
||||
== Structured Output
|
||||
|
||||
The output of AI models traditionally arrives as a `java.lang.String`, even if you ask for the reply to be in JSON.
|
||||
It may be the correct JSON, but it is not a JSON data structure. It is just a string.
|
||||
It may be a correct JSON, but it is not a JSON data structure. It is just a string.
|
||||
Also, asking "`for JSON`" as part of the prompt is not 100% accurate.
|
||||
|
||||
This intricacy has led to the emergence of a specialized field involving the creation of prompts to yield the intended output, followed by converting the resulting simple string into a usable data structure for application integration.
|
||||
|
||||
Reference in New Issue
Block a user