Skip to content

Commit 2830c36

Browse files
committed
RDoc-3468 add section: "Get embeddings generation task details"
1 parent 27fc493 commit 2830c36

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

docs/ai-integration/generating-embeddings/content/_overview-csharp.mdx

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import CodeBlock from '@theme/CodeBlock';
1818
* [Supported providers](../../../ai-integration/generating-embeddings/overview.mdx#supported-providers)
1919
* [Creating an embeddings generation task](../../../ai-integration/generating-embeddings/overview.mdx#creating-an-embeddings-generation-task)
2020
* [Monitoring the tasks](../../../ai-integration/generating-embeddings/overview.mdx#monitoring-the-tasks)
21+
* [Get embeddings generation task details](../../../ai-integration/generating-embeddings/overview.mdx#get-embeddings-generation-task-details)
2122

2223
</Admonition>
2324

@@ -118,3 +119,66 @@ import CodeBlock from '@theme/CodeBlock';
118119
The following SNMP OIDs provide relevant metrics:
119120
* [5.1.11.25](../../../server/administration/snmp/snmp-overview.mdx#511125) – Total number of enabled embeddings generation tasks.
120121
* [5.1.11.26](../../../server/administration/snmp/snmp-overview.mdx#511126) – Total number of active embeddings generation tasks.
122+
123+
## Get embeddings generation task details
124+
125+
* Besides viewing the list of tasks in the [AI Tasks - list view](../../../ai-integration/ai-tasks-list-view.mdx) in the Studio,
126+
you can also retrieve embeddings generation task details programmatically.
127+
128+
* This is useful when issuing a vector search query that references an embeddings generation task,
129+
where it's important to verify that the task exists beforehand. For example:
130+
* when [Querying pre-made embeddings generated by tasks](../../../ai-integration/vector-search/vector-search-using-dynamic-query#querying-pre-made-embeddings-generated-by-tasks)
131+
* or when [Indexing numerical data and querying using text input](../../../ai-integration/vector-search/vector-search-using-static-index#indexing-numerical-data-and-querying-using-text-input)
132+
133+
* There are two ways to check if an embeddings generation task exists:
134+
* Using `GetOngoingTaskInfoOperation`.
135+
* Accessing the full list of embeddings generation tasks from the database record.
136+
137+
138+
<Tabs groupId='languageSyntax'>
139+
<TabItem value="Get_task_info_via_operataion" label="Get_task_info_via_operataion">
140+
```csharp
141+
// Define the get task operation, pass the task NAME
142+
var getOngoingTaskOp =
143+
new GetOngoingTaskInfoOperation("theEmbeddingsGenerationTaskName", OngoingTaskType.EmbeddingsGeneration);
144+
145+
// Execute the operation by by passing it to Maintenance.Send
146+
// Explicitly cast the result to the "EmbeddingsGeneration" type
147+
var task = (EmbeddingsGeneration)store.Maintenance.Send(getOngoingTaskOp);
148+
149+
// Verify the task exists
150+
if (task != null)
151+
{
152+
// Access any of the task details
153+
var taskStatus = task.TaskState;
154+
155+
// Access the task identifier
156+
var taskIdentifier = task.Configuration.Identifier;
157+
}
158+
```
159+
</TabItem>
160+
<TabItem value="Get_task_info_via_database_record" label="Get_task_info_via_database_record">
161+
```csharp
162+
// Define the get database record operation, pass your database name
163+
var getDatabaseRecordOp = new GetDatabaseRecordOperation("yourDatabaseName");
164+
165+
// Execute the operation by passing it to Maintenance.Send
166+
var dbRecord = store.Maintenance.Server.Send(getDatabaseRecordOp);
167+
168+
// Access the list of embeddings generation tasks
169+
var tasks = dbRecord.EmbeddingsGenerations;
170+
171+
if (tasks.Count > 0)
172+
{
173+
// Access the first task
174+
var task = tasks[0];
175+
176+
// Access any of the task details
177+
var isTaskDisabled = task.Disabled;
178+
179+
// Access the task identifier
180+
var taskIdentifier = task.Identifier;
181+
}
182+
```
183+
</TabItem>
184+
</Tabs>

0 commit comments

Comments
 (0)