mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-05 19:08:32 +02:00
TS snippets
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
||||
```typescript
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
|
||||
client.query("{collection_name}", {
|
||||
prefetch: {
|
||||
query: {
|
||||
text: "How to bake cookies?",
|
||||
model: "openai/text-embedding-3-small",
|
||||
options: {
|
||||
"openai-api-key": "<YOUR_OPENAI_API_KEY>",
|
||||
mrl: 64,
|
||||
}
|
||||
},
|
||||
using: 'small',
|
||||
limit: 1000,
|
||||
},
|
||||
query: {
|
||||
text: "How to bake cookies?",
|
||||
model: "openai/text-embedding-3-small",
|
||||
options: {
|
||||
"openai-api-key": "<YOUR_OPENAI_API_KEY>"
|
||||
}
|
||||
},
|
||||
using: 'large',
|
||||
limit: 10,
|
||||
});
|
||||
```
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
|
||||
client.query("{collection_name}", {
|
||||
prefetch: {
|
||||
query: {
|
||||
text: "How to bake cookies?",
|
||||
model: "openai/text-embedding-3-small",
|
||||
options: {
|
||||
"openai-api-key": "<YOUR_OPENAI_API_KEY>",
|
||||
mrl: 64,
|
||||
}
|
||||
},
|
||||
using: 'small',
|
||||
limit: 1000,
|
||||
},
|
||||
query: {
|
||||
text: "How to bake cookies?",
|
||||
model: "openai/text-embedding-3-small",
|
||||
options: {
|
||||
"openai-api-key": "<YOUR_OPENAI_API_KEY>"
|
||||
}
|
||||
},
|
||||
using: 'large',
|
||||
limit: 10,
|
||||
});
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
```typescript
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
|
||||
client.upsert("{collection_name}", {
|
||||
points: [
|
||||
{
|
||||
id: 1,
|
||||
vector: {
|
||||
large: {
|
||||
text: 'Recipe for baking chocolate chip cookies',
|
||||
model: 'openai/text-embedding-3-small',
|
||||
options: {
|
||||
'openai-api-key': '<YOUR_OPENAI_API_KEY>',
|
||||
},
|
||||
},
|
||||
small: {
|
||||
text: 'Recipe for baking chocolate chip cookies',
|
||||
model: 'openai/text-embedding-3-small',
|
||||
options: {
|
||||
'openai-api-key': '<YOUR_OPENAI_API_KEY>',
|
||||
mrl: 64,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
```
|
||||
@@ -0,0 +1,28 @@
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
|
||||
client.upsert("{collection_name}", {
|
||||
points: [
|
||||
{
|
||||
id: 1,
|
||||
vector: {
|
||||
large: {
|
||||
text: 'Recipe for baking chocolate chip cookies',
|
||||
model: 'openai/text-embedding-3-small',
|
||||
options: {
|
||||
'openai-api-key': '<YOUR_OPENAI_API_KEY>',
|
||||
},
|
||||
},
|
||||
small: {
|
||||
text: 'Recipe for baking chocolate chip cookies',
|
||||
model: 'openai/text-embedding-3-small',
|
||||
options: {
|
||||
'openai-api-key': '<YOUR_OPENAI_API_KEY>',
|
||||
mrl: 64,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
Reference in New Issue
Block a user