Skip to content

Commit

Permalink
Add doc concepts diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
tzolov committed Jun 3, 2024
1 parent 20c6a1a commit 19f3930
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,11 @@ 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.

image::structured-output-architecture.jpg[Structured Output Converter Architecture, width=900, align="center"]

The xref:api/structured-output-converter.adoc#_structuredoutputconverter[Structured output conversion] employs meticulously crafted prompts, often necessitating multiple interactions with the model to achieve the desired formatting.

== Bringing Your Data to the AI model
== Bringing Your Data & APIs to the AI Model

How can you equip the AI model with information on which it has not been trained?

Expand Down Expand Up @@ -187,6 +189,8 @@ The next phase in RAG is processing user input.
When a user's question is to be answered by an AI model, the question and all the "`similar`" document pieces are placed into the prompt that is sent to the AI model.
This is the reason to use a vector database. It is very good at finding similar content.

image::spring-ai-rag.jpg[Spring AI RAG, width=1000, align="center"]

There are several concepts that are used in implementing RAG.
The concepts map onto classes in Spring AI:

Expand All @@ -196,10 +200,13 @@ The concepts map onto classes in Spring AI:
* `DocumentWriter`: Lets you persist the Documents into a database (most commonly in the AI stack, a vector database).
* `Embedding`: A representation of your data as a `List<Double>` that is used by the vector database to compute the "`similarity`" of a user's query to relevant documents.


== Function Calling

Large Language Models (LLMs) are frozen after training, leading to stale knowledge and they are unable to access or modify external data.

image::function-calling-basic-flow.jpg[Function calling, width=800, align="center"]

The `Function Calling` mechanism addresses these shortcomings.
It allows you to register your own functions to connect the large language models to the APIs of external systems.
These systems can provide LLMs with real-time data and perform data processing actions on their behalf.
Expand Down

0 comments on commit 19f3930

Please sign in to comment.