|
1 | 1 | --- |
2 | 2 | title: "Generating Embeddings - Overview" |
3 | 3 | hide_table_of_contents: true |
4 | | -sidebar_label: Overview |
| 4 | +sidebar_label: "Overview" |
5 | 5 | sidebar_position: 0 |
6 | 6 | --- |
7 | 7 |
|
8 | | -import Admonition from '@theme/Admonition'; |
9 | | -import Tabs from '@theme/Tabs'; |
10 | | -import TabItem from '@theme/TabItem'; |
11 | | -import CodeBlock from '@theme/CodeBlock'; |
12 | 8 | import LanguageSwitcher from "@site/src/components/LanguageSwitcher"; |
13 | 9 | import LanguageContent from "@site/src/components/LanguageContent"; |
14 | 10 |
|
15 | | -# Generating Embeddings - Overview |
16 | | -<Admonition type="note" title=""> |
| 11 | +import OverviewCsharp from './content/_overview-csharp.mdx'; |
17 | 12 |
|
18 | | -* RavenDB can serve as a vector database, see [Why choose RavenDB as your vector database](../../ai-integration/vector-search/ravendb-as-vector-database.mdx#why-choose-ravendb-as-your-vector-database). |
| 13 | +export const supportedLanguages = ["csharp"]; |
19 | 14 |
|
20 | | -* Vector search can be performed on: |
21 | | - * Raw text stored in your documents. |
22 | | - * Pre-made embeddings that you created yourself and stored using these [Data types](../../ai-integration/vector-search/data-types-for-vector-search.mdx#numerical-data). |
23 | | - * Pre-made embeddings that are automatically generated from your document content by RavenDB's tasks |
24 | | - using external service providers, as explained below. |
25 | | -* In this article: |
26 | | - * [Embeddings generation - overview](../../ai-integration/generating-embeddings/overview.mdx#embeddings-generation---overview) |
27 | | - * [Embeddings generation - process flow](../../ai-integration/generating-embeddings/overview.mdx#embeddings-generation---process-flow) |
28 | | - * [Supported providers](../../ai-integration/generating-embeddings/overview.mdx#supported-providers) |
29 | | - * [Creating an embeddings generation task](../../ai-integration/generating-embeddings/overview.mdx#creating-an-embeddings-generation-task) |
30 | | - * [Monitoring the tasks](../../ai-integration/generating-embeddings/overview.mdx#monitoring-the-tasks) |
| 15 | +<LanguageSwitcher supportedLanguages={supportedLanguages} /> |
31 | 16 |
|
32 | | -</Admonition> |
33 | | -## Embeddings generation - overview |
34 | | - |
35 | | -<Admonition type="note" title=""> |
36 | | - |
37 | | -#### Embeddings generation - process flow |
38 | | -* **Define an Embeddings Generation Task**: |
39 | | - Specify a [connection string](../../ai-integration/connection-strings/connection-strings-overview.mdx) that defines the AI provider and model for generating embeddings. |
40 | | - Define the source content - what parts of the documents will be used to create the embeddings. |
41 | | - |
42 | | -* **Source content is processed**: |
43 | | - 1. The task extracts the specified content from the documents. |
44 | | - 2. If a processing script is defined, it transforms the content before further processing. |
45 | | - 3. The text is split according to the defined chunking method; a separate embedding will be created for each chunk. |
46 | | - 4. Before contacting the provider, RavenDB checks the [embeddings cache](../../ai-integration/generating-embeddings/embedding-collections.mdx#the-embeddings-cache-collection) |
47 | | - to determine whether an embedding already exists for the given content from that provider. |
48 | | - 5. If a matching embedding is found, it is reused, avoiding unnecessary requests. |
49 | | - If no cached embedding is found, the transformed and chunked content is sent to the configured AI provider. |
50 | | - |
51 | | -* **Embeddings are generated by the AI provider**: |
52 | | - The provider generates embeddings and sends them back to RavenDB. |
53 | | - If quantization was defined in the task, RavenDB applies it to the embeddings before storing them. |
54 | | - |
55 | | -* **Embeddings are stored in your database**: |
56 | | - * Each embedding is stored as an attachment in a [dedicated collection](../../ai-integration/generating-embeddings/embedding-collections.mdx#the-embeddings-collection). |
57 | | - * RavenDB maintains an [embeddings cache](../../ai-integration/generating-embeddings/embedding-collections.mdx#the-embeddings-cache-collection), |
58 | | - allowing reuse of embeddings for the same source content and reducing provider calls. |
59 | | - Cached embeddings expire after a configurable duration. |
60 | | - |
61 | | -* **Perform vector search:** |
62 | | - Once the embeddings are stored, you can perform vector searches on your document content by: |
63 | | - * Running a [dynamic query](../../ai-integration/vector-search/vector-search-using-dynamic-query.mdx#querying-pre-made-embeddings-generated-by-tasks), which automatically creates an auto-index for the search. |
64 | | - * Defining a [static index](../../ai-integration/vector-search/vector-search-using-static-index.mdx#indexing-pre-made-text-embeddings) to store and query embeddings efficiently. |
65 | | - |
66 | | - The query search term is split into chunks, and each chunk is looked up in the cache. |
67 | | - If not found, RavenDB requests an embedding from the provider and caches it. |
68 | | - The embedding (cached or newly created) is then used to compare against stored vectors. |
69 | | - |
70 | | -* **Continuous processing**: |
71 | | - * Embeddings generation tasks are [Ongoing Tasks](../../studio/database/tasks/ongoing-tasks/general-info.mdx) that process documents as they change. |
72 | | - Before contacting the provider after a document change, the task first checks the cache to see if a matching embedding already exists, avoiding unnecessary requests. |
73 | | - * The requests to generate embeddings from the source text are sent to the provider in batches. |
74 | | - The batch size is configurable, see the [Ai.Embeddings.MaxBatchSize](../../server/configuration/ai-integration-configuration.mdx#aiembeddingsmaxbatchsize) configuration key. |
75 | | - * A failed embeddings generation task will retry after the duration set in the |
76 | | - [Ai.Embeddings.MaxFallbackTimeInSec](../../server/configuration/ai-integration-configuration.mdx#aiembeddingsmaxfallbacktimeinsec) configuration key. |
77 | | - |
78 | | -</Admonition> |
79 | | -<Admonition type="note" title=""> |
80 | | - |
81 | | -#### Supported providers |
82 | | -* The following service providers are supported for auto-generating embeddings using tasks: |
83 | | - |
84 | | - * [OpenAI & OpenAI-compatible providers](../../ai-integration/connection-strings/open-ai.mdx) |
85 | | - * [Azure Open AI](../../ai-integration/connection-strings/azure-open-ai.mdx) |
86 | | - * [Google AI](../../ai-integration/connection-strings/google-ai.mdx) |
87 | | - * [Hugging Face](../../ai-integration/connection-strings/hugging-face.mdx) |
88 | | - * [Ollama](../../ai-integration/connection-strings/ollama.mdx) |
89 | | - * [Mistral AI](../../ai-integration/connection-strings/mistral-ai.mdx) |
90 | | - * [bge-micro-v2](../../ai-integration/connection-strings/embedded.mdx) (a local embedded model within RavenDB) |
91 | | - |
92 | | -</Admonition> |
93 | | - |
94 | | - |
95 | | - |
96 | | - |
97 | | - |
98 | | - |
99 | | - |
100 | | -## Creating an embeddings generation task |
101 | | - |
102 | | -* An embeddings generation tasks can be created from: |
103 | | - * The **AI Tasks view in the Studio**, where you can create, edit, and delete tasks. Learn more in [AI Tasks - list view](../../ai-integration/ai-tasks-list-view.mdx). |
104 | | - * The **Client API** - see [Configuring an embeddings generation task - from the Client API](../../ai-integration/generating-embeddings/embeddings-generation-task.mdx#configuring-an-embeddings-generation-task---from-the-client-api) |
105 | | -* From the Studio: |
106 | | - |
107 | | -  |
108 | | - |
109 | | - 1. Go to the **AI Hub** menu. |
110 | | - 2. Open the **AI Tasks** view. |
111 | | - 3. Click **Add AI Task** to add a new task. |
112 | | - |
113 | | -  |
114 | | - |
115 | | -* See the complete details of the task configuration in the [Embeddings generation task](../../ai-integration/generating-embeddings/embeddings-generation-task.mdx) article. |
116 | | - |
117 | | - |
118 | | - |
119 | | -## Monitoring the tasks |
120 | | - |
121 | | -* The status and state of each embeddings generation task are visible in the [AI Tasks - list view](../../ai-integration/ai-tasks-list-view.mdx). |
122 | | - |
123 | | -* Task performance and activity over time can be analyzed in the _AI Tasks Stats_ view, |
124 | | - where you can track processing duration, batch sizes, and overall progress. |
125 | | - Learn more about the functionality of the stats view in the [Ongoing Tasks Stats](../../studio/database/stats/ongoing-tasks-stats/overview.mdx) article. |
126 | | - |
127 | | -* The number of embeddings generation tasks across all databases can also be monitored using [SNMP](../../server/administration/snmp/snmp-overview.mdx). |
128 | | - The following SNMP OIDs provide relevant metrics: |
129 | | - * [5.1.11.25](../../server/administration/snmp/snmp-overview.mdx#511125) – Total number of enabled embeddings generation tasks. |
130 | | - * [5.1.11.26](../../server/administration/snmp/snmp-overview.mdx#511126) – Total number of active embeddings generation tasks. |
| 17 | +<LanguageContent language="csharp"> |
| 18 | + <OverviewCsharp /> |
| 19 | +</LanguageContent> |
131 | 20 |
|
| 21 | +<!--- |
| 22 | +### Vector Search |
| 23 | +- [RavenDB as a vector database](../../ai-integration/vector-search/ravendb-as-vector-database) |
| 24 | +- [Vector search using a static index](../../ai-integration/vector-search/vector-search-using-static-index) |
| 25 | +- [Vector search using a dynamic query](../../ai-integration/vector-search/vector-search-using-dynamic-query) |
132 | 26 |
|
| 27 | +### Embeddings Generation |
| 28 | +- [The Embedding Collections](../../ai-integration/generating-embeddings/embedding-collections) |
| 29 | +- [The Embedding generation task](../../ai-integration/generating-embeddings/embeddings-generation-task) |
133 | 30 |
|
| 31 | +### AI Connection Strings |
| 32 | +- [Connection strings - overview](../../ai-integration/connection-strings/connection-strings-overview) |
| 33 | +- [Azure Open AI](../../ai-integration/connection-strings/azure-open-ai) |
| 34 | +- [Google AI](../../ai-integration/connection-strings/google-ai) |
| 35 | +- [Hugging Face](../../ai-integration/connection-strings/hugging-face) |
| 36 | +- [Ollama](../../ai-integration/connection-strings/ollama) |
| 37 | +- [OpenAI](../../ai-integration/connection-strings/open-ai) |
| 38 | +- [Mistral AI](../../ai-integration/connection-strings/mistral-ai) |
| 39 | +- [Embedded model](../../ai-integration/connection-strings/embedded) |
| 40 | +--> |
0 commit comments