-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: Mastra integration Signed-off-by: Anush008 <[email protected]> * chore: _index.md Signed-off-by: Anush008 <[email protected]> * fix: distance Signed-off-by: Anush008 <[email protected]> --------- Signed-off-by: Anush008 <[email protected]>
- Loading branch information
Showing
2 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
qdrant-landing/content/documentation/frameworks/mastra.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
--- | ||
title: Mastra | ||
--- | ||
|
||
# Mastra | ||
|
||
[Mastra](https://mastra.ai/) is a Typescript framework to build AI applications and features quickly. It gives you the set of primitives you need: workflows, agents, RAG, integrations, syncs and evals. You can run Mastra on your local machine, or deploy to a serverless cloud. | ||
|
||
Qdrant is available as a vector store in Mastra node to augment application with retrieval capabilities. | ||
|
||
## Setup | ||
|
||
```bash | ||
npm install @mastra/core | ||
``` | ||
|
||
## Usage | ||
|
||
```typescript | ||
import { QdrantVector } from "@mastra/rag"; | ||
|
||
const qdrant = new QdrantVector({ | ||
url: "https://xyz-example.eu-central.aws.cloud.qdrant.io:6333" | ||
apiKey: "<YOUR_API_KEY>", | ||
https: true | ||
}); | ||
``` | ||
|
||
## Constructor Options | ||
|
||
| Name | Type | Description | | ||
|--------|-----------|-------------------------------------------------------------------------------------------------------| | ||
| `url` | `string` | REST URL of the Qdrant instance. Eg. <https://xyz-example.eu-central.aws.cloud.qdrant.io:6333> | | ||
| `apiKey` | `string` | Optional Qdrant API key | | ||
| `https` | `boolean` | Whether to use TLS when setting up the connection. Recommended. | | ||
|
||
## Methods | ||
|
||
### `createIndex()` | ||
|
||
| Name | Type | Description | Default Value | | ||
|------------|------------------------------------------|-------------------------------------------------|--------------| | ||
| `indexName` | `string` | Name of the index to create | | | ||
| `dimension` | `number` | Vector dimension size | | | ||
| `metric` | `string` | Distance metric for similarity search | `cosine` | | ||
|
||
### `upsert()` | ||
|
||
| Name | Type | Description | Default Value | | ||
|-------------|---------------------------|-----------------------------------------|--------------| | ||
| `vectors` | `number[][]` | Array of embedding vectors | | | ||
| `metadata` | `Record<string, any>[]` | Metadata for each vector (optional) | | | ||
| `namespace` | `string` | Optional namespace for organization | | | ||
|
||
### `query()` | ||
|
||
| Name | Type | Description | Default Value | | ||
|------------|-------------------------|---------------------------------------------|--------------| | ||
| `vector` | `number[]` | Query vector to find similar vectors | | | ||
| `topK` | `number` | Number of results to return (optional) | `10` | | ||
| `filter` | `Record<string, any>` | Metadata filters for the query (optional) | | | ||
|
||
### `listIndexes()` | ||
|
||
Returns an array of index names as strings. | ||
|
||
### `describeIndex()` | ||
|
||
| Name | Type | Description | | ||
|-------------|----------|----------------------------------| | ||
| `indexName` | `string` | Name of the index to describe | | ||
|
||
#### Returns | ||
|
||
```typescript | ||
interface IndexStats { | ||
dimension: number; | ||
count: number; | ||
metric: "cosine" | "euclidean" | "dotproduct"; | ||
} | ||
``` | ||
|
||
### `deleteIndex()` | ||
|
||
| Name | Type | Description | | ||
|-------------|----------|----------------------------------| | ||
| `indexName` | `string` | Name of the index to delete | | ||
|
||
## Response Types | ||
|
||
Query results are returned in this format: | ||
|
||
```typescript | ||
interface QueryResult { | ||
id: string; | ||
score: number; | ||
metadata: Record<string, any>; | ||
} | ||
``` | ||
|
||
## Further Reading | ||
|
||
- [Mastra Examples](https://github.com/mastra-ai/mastra/tree/main/examples) | ||
- [Mastra Documentation](http://mastra.ai/docs/) |