mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-09 21:08:31 +02:00
Add OpenRouter to inference docs
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
```csharp
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
var client = new QdrantClient(
|
||||
host: "xyz-example.qdrant.io",
|
||||
port: 6334,
|
||||
https: true,
|
||||
apiKey: "<your-openrouter-key>"
|
||||
);
|
||||
|
||||
await client.QueryAsync(
|
||||
collectionName: "{collection_name}",
|
||||
query: new Document()
|
||||
{
|
||||
Model = "openrouter/mistralai/mistral-embed-2312",
|
||||
Text = "How to bake cookies?",
|
||||
Options = { ["openrouter-api-key"] = "<YOUR_OPENROUTER_API_KEY>" },
|
||||
}
|
||||
);
|
||||
```
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
```go
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "xyz-example.qdrant.io",
|
||||
Port: 6334,
|
||||
APIKey: "<paste-your-openrouter-key-here>",
|
||||
UseTLS: true,
|
||||
})
|
||||
|
||||
client.Query(context.Background(), &qdrant.QueryPoints{
|
||||
CollectionName: "{collection_name}",
|
||||
Query: qdrant.NewQueryNearest(
|
||||
qdrant.NewVectorInputDocument(&qdrant.Document{
|
||||
Model: "openrouter/mistralai/mistral-embed-2312",
|
||||
Text: "How to bake cookies?",
|
||||
Options: qdrant.NewValueMap(map[string]any{
|
||||
"openrouter-api-key": "<YOUR_OPENROUTER_API_KEY>",
|
||||
}),
|
||||
}),
|
||||
),
|
||||
})
|
||||
```
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
```java
|
||||
import static io.qdrant.client.QueryFactory.nearest;
|
||||
import static io.qdrant.client.ValueFactory.value;
|
||||
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Points.Document;
|
||||
import io.qdrant.client.grpc.Points.QueryPoints;
|
||||
import java.util.Map;
|
||||
|
||||
QdrantClient client =
|
||||
new QdrantClient(
|
||||
QdrantGrpcClient.newBuilder("xyz-example.qdrant.io", 6334, true)
|
||||
.withApiKey("<your-openrouter-key>")
|
||||
.build());
|
||||
client
|
||||
.queryAsync(
|
||||
QueryPoints.newBuilder()
|
||||
.setCollectionName("{collection_name}")
|
||||
.setQuery(
|
||||
nearest(
|
||||
Document.newBuilder()
|
||||
.setModel("openrouter/mistralai/mistral-embed-2312")
|
||||
.setText("How to bake cookies?")
|
||||
.putAllOptions(
|
||||
Map.of(
|
||||
"openrouter-api-key",
|
||||
value("<YOUR_OPENROUTER_API_KEY>")
|
||||
.build()))
|
||||
.build())
|
||||
.get();
|
||||
```
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
```python
|
||||
from qdrant_client import QdrantClient, models
|
||||
|
||||
client = QdrantClient(
|
||||
url="https://xyz-example.qdrant.io:6333",
|
||||
api_key="<your-api-key>",
|
||||
cloud_inference=True
|
||||
)
|
||||
|
||||
client.query_points(
|
||||
collection_name="{collection_name}",
|
||||
query=models.Document(
|
||||
text="How to bake cookies?",
|
||||
model="openrouter/mistralai/mistral-embed-2312",
|
||||
options={
|
||||
"openrouter-api-key": "<your_openrouter_api_key>"
|
||||
}
|
||||
)
|
||||
)
|
||||
```
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
```rust
|
||||
use qdrant_client::{
|
||||
Qdrant,
|
||||
qdrant::{Document, Query, QueryPointsBuilder, Value},
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
|
||||
let client = Qdrant::from_url("<your-qdrant-url>").build().unwrap();
|
||||
|
||||
let mut options = HashMap::<String, Value>::new();
|
||||
options.insert("openrouter-api-key".to_string(), "<YOUR_OPENROUTER_API_KEY>".into());
|
||||
|
||||
client
|
||||
.query(
|
||||
QueryPointsBuilder::new("{collection_name}")
|
||||
.query(Query::new_nearest(Document {
|
||||
text: "How to bake cookies?".into(),
|
||||
model: "openrouter/mistralai/mistral-embed-2312".into(),
|
||||
options,
|
||||
}))
|
||||
.build(),
|
||||
)
|
||||
.await?;
|
||||
```
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
```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: 'openrouter/mistralai/mistral-embed-2312',
|
||||
options: {
|
||||
'openrouter-api-key': '<your_openrouter_api_key>'
|
||||
},
|
||||
},
|
||||
});
|
||||
```
|
||||
Reference in New Issue
Block a user