inference ts snippets

This commit is contained in:
Ivan Pleshkov
2025-11-13 17:16:14 +01:00
parent 3f6b2694a9
commit fdef153f12
9 changed files with 174 additions and 0 deletions
@@ -0,0 +1,16 @@
```typescript
import { QdrantClient } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 });
client.query("{collection_name}", {
query: {
text: 'a green square',
model: 'cohere/embed-v4.0',
options: {
'cohere-api-key': '<your_cohere_api_key>',
output_dimension: 512,
},
},
});
```
@@ -0,0 +1,21 @@
```typescript
import { QdrantClient } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 });
client.upsert("{collection_name}", {
points: [
{
id: 1,
vector: {
text: 'a green square',
model: 'cohere/embed-v4.0',
options: {
'cohere-api-key': '<your_cohere_api_key>',
output_dimension: 512,
},
},
},
],
});
```
@@ -0,0 +1,19 @@
```typescript
import { QdrantClient } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 });
client.upsert("{collection_name}", {
points: [
{
id: 1,
vector: {
'my-bm25-vector': {
text: 'Recipe for baking chocolate chip cookies',
model: 'Qdrant/bm25',
},
},
},
],
});
```
@@ -0,0 +1,16 @@
```typescript
import { QdrantClient } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 });
client.query("{collection_name}", {
query: {
text: 'Mission to Mars',
model: 'jinaai/jina-clip-v2',
options: {
'jina-api-key': '<your_jinaai_api_key>',
dimensions: 512,
},
},
});
```
@@ -0,0 +1,21 @@
```typescript
import { QdrantClient } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 });
client.upsert("{collection_name}", {
points: [
{
id: 1,
vector: {
image: 'https://qdrant.tech/example.png',
model: 'jinaai/jina-clip-v2',
options: {
'jina-api-key': '<your_jinaai_api_key>',
dimensions: 512,
},
},
},
],
});
```
@@ -0,0 +1,31 @@
```typescript
import { QdrantClient } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 });
client.upsert("{collection_name}", {
points: [
{
id: 1,
vector: {
image: {
image: 'https://qdrant.tech/example.png',
model: 'jinaai/jina-clip-v2',
options: {
'jina-api-key': '<your_jinaai_api_key>',
dimensions: 512,
},
},
text: {
text: 'Mars, the red planet',
model: 'sentence-transformers/all-minilm-l6-v2',
},
bm25: {
text: 'Mars, the red planet',
model: 'Qdrant/bm25',
},
},
},
],
});
```
@@ -0,0 +1,16 @@
```typescript
import { QdrantClient } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 });
client.query("{collection_name}", {
query: {
text: 'How to bake cookies?',
model: 'openai/text-embedding-3-large',
options: {
'openai-api-key': '<your_openai_api_key>',
dimensions: 512,
},
},
});
```
@@ -0,0 +1,21 @@
```typescript
import { QdrantClient } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 });
client.upsert("{collection_name}", {
points: [
{
id: 1,
vector: {
text: 'Recipe for baking chocolate chip cookies',
model: 'openai/text-embedding-3-large',
options: {
'openai-api-key': '<your_openai_api_key>',
dimensions: 512,
},
},
},
],
});
```
@@ -0,0 +1,13 @@
```typescript
import { QdrantClient } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 });
client.query("{collection_name}", {
query: {
text: 'How to bake cookies?',
model: 'qdrant/bm25',
},
using: 'my-bm25-vector',
});
```