mirror of
https://github.com/qdrant/landing_page.git
synced 2026-09-28 23:48:31 +02:00
docs: Rig-rs integration
Signed-off-by: Anush008 <anushshetty90@gmail.com>
This commit is contained in:
@@ -5,8 +5,8 @@ weight: 20
|
|||||||
|
|
||||||
## Framework Integrations
|
## Framework Integrations
|
||||||
|
|
||||||
| Framework | Description |
|
| Framework | Description |
|
||||||
| ------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
| ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
||||||
| [AutoGen](/documentation/frameworks/autogen/) | Framework from Microsoft building LLM applications using multiple conversational agents. |
|
| [AutoGen](/documentation/frameworks/autogen/) | Framework from Microsoft building LLM applications using multiple conversational agents. |
|
||||||
| [Canopy](/documentation/frameworks/canopy/) | Framework from Pinecone for building RAG applications using LLMs and knowledge bases. |
|
| [Canopy](/documentation/frameworks/canopy/) | Framework from Pinecone for building RAG applications using LLMs and knowledge bases. |
|
||||||
| [Cheshire Cat](/documentation/frameworks/cheshire-cat/) | Framework to create personalized AI assistants using custom data. |
|
| [Cheshire Cat](/documentation/frameworks/cheshire-cat/) | Framework to create personalized AI assistants using custom data. |
|
||||||
@@ -23,8 +23,9 @@ weight: 20
|
|||||||
| [Mem0](/documentation/frameworks/mem0/) | Self-improving memory layer for LLM applications, enabling personalized AI experiences. |
|
| [Mem0](/documentation/frameworks/mem0/) | Self-improving memory layer for LLM applications, enabling personalized AI experiences. |
|
||||||
| [MemGPT](/documentation/frameworks/memgpt/) | System to build LLM agents with long term memory & custom tools |
|
| [MemGPT](/documentation/frameworks/memgpt/) | System to build LLM agents with long term memory & custom tools |
|
||||||
| [Pandas-AI](/documentation/frameworks/pandas-ai/) | Python library to query/visualize your data (CSV, XLSX, PostgreSQL, etc.) in natural language |
|
| [Pandas-AI](/documentation/frameworks/pandas-ai/) | Python library to query/visualize your data (CSV, XLSX, PostgreSQL, etc.) in natural language |
|
||||||
|
| [Rig-rs](/documentation/frameworks/rig-rs/) | Rust library for building scalable, modular, and ergonomic LLM-powered applications. |
|
||||||
| [Semantic Router](/documentation/frameworks/semantic-router/) | Python library to build a decision-making layer for AI applications using vector search. |
|
| [Semantic Router](/documentation/frameworks/semantic-router/) | Python library to build a decision-making layer for AI applications using vector search. |
|
||||||
| [Spring AI](/documentation/frameworks/spring-ai/) | Java AI framework for building with Spring design principles such as portability and modular design. |
|
| [Spring AI](/documentation/frameworks/spring-ai/) | Java AI framework for building with Spring design principles such as portability and modular design. |
|
||||||
| [Sycamore](/documentation/frameworks/sycamore/) | Document processing engine for ETL, RAG, LLM-based applications, and analytics on unstructured data. |
|
| [Sycamore](/documentation/frameworks/sycamore/) | Document processing engine for ETL, RAG, LLM-based applications, and analytics on unstructured data. |
|
||||||
| [txtai](/documentation/frameworks/txtai/) | Python library for semantic search, LLM orchestration and language model workflows. |
|
| [txtai](/documentation/frameworks/txtai/) | Python library for semantic search, LLM orchestration and language model workflows. |
|
||||||
| [Vanna AI](/documentation/frameworks/vanna-ai/) | Python RAG framework for SQL generation and querying. |
|
| [Vanna AI](/documentation/frameworks/vanna-ai/) | Python RAG framework for SQL generation and querying. |
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
---
|
||||||
|
title: Rig-rs
|
||||||
|
---
|
||||||
|
|
||||||
|
# Rig-rs
|
||||||
|
|
||||||
|
[Rig](http://rig.rs) is a Rust library for building scalable, modular, and ergonomic LLM-powered applications. It has full support for LLM completion and embedding workflows with minimal boiler plate.
|
||||||
|
|
||||||
|
Rig supports Qdrant as a vectorstore to ingest and search for documents semantically.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```console
|
||||||
|
cargo add rig-core rig-qdrant qdrant-client
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Here's an example ingest and retrieve flow using Rig and Qdrant.
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use qdrant_client::{
|
||||||
|
qdrant::{PointStruct, QueryPointsBuilder, UpsertPointsBuilder},
|
||||||
|
Payload, Qdrant,
|
||||||
|
};
|
||||||
|
use rig::{
|
||||||
|
embeddings::EmbeddingsBuilder,
|
||||||
|
providers::openai::{Client, TEXT_EMBEDDING_3_SMALL},
|
||||||
|
vector_store::VectorStoreIndex,
|
||||||
|
};
|
||||||
|
use rig_qdrant::QdrantVectorStore;
|
||||||
|
use serde_json::json;
|
||||||
|
|
||||||
|
const COLLECTION_NAME: &str = "rig-collection";
|
||||||
|
|
||||||
|
// Initialize Qdrant client.
|
||||||
|
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||||
|
// Initialize OpenAI client.
|
||||||
|
let openai_client = Client::new("<OPENAI_API_KEY>");
|
||||||
|
let model = openai_client.embedding_model(TEXT_EMBEDDING_3_SMALL);
|
||||||
|
|
||||||
|
let documents = EmbeddingsBuilder::new(model.clone())
|
||||||
|
.simple_document("0981d983-a5f8-49eb-89ea-f7d3b2196d2e", "Definition of a *flurbo*: A flurbo is a green alien that lives on cold planets")
|
||||||
|
.simple_document("62a36d43-80b6-4fd6-990c-f75bb02287d1", "Definition of a *glarb-glarb*: A glarb-glarb is a ancient tool used by the ancestors of the inhabitants of planet Jiro to farm the land.")
|
||||||
|
.simple_document("f9e17d59-32e5-440c-be02-b2759a654824", "Definition of a *linglingdong*: A term used by inhabitants of the far side of the moon to describe humans.")
|
||||||
|
.build()
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let points: Vec<PointStruct> = documents
|
||||||
|
.into_iter()
|
||||||
|
.map(|d| {
|
||||||
|
let vec: Vec<f32> = d.embeddings[0].vec.iter().map(|&x| x as f32).collect();
|
||||||
|
PointStruct::new(
|
||||||
|
d.id,
|
||||||
|
vec,
|
||||||
|
Payload::try_from(json!({
|
||||||
|
"document": d.document,
|
||||||
|
}))
|
||||||
|
.unwrap(),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
client
|
||||||
|
.upsert_points(UpsertPointsBuilder::new(COLLECTION_NAME, points))
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let query_params = QueryPointsBuilder::new(COLLECTION_NAME).with_payload(true);
|
||||||
|
let vector_store = QdrantVectorStore::new(client, model, query_params.build());
|
||||||
|
|
||||||
|
let results = vector_store
|
||||||
|
.top_n::<serde_json::Value>("Define a glarb-glarb?", 1)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
println!("Results: {:?}", results);
|
||||||
|
```
|
||||||
|
|
||||||
|
## Further reading
|
||||||
|
|
||||||
|
- [Rig-rs Documentation](https://rig.rs)
|
||||||
|
- [Source Code](https://github.com/0xPlaygrounds/rig)
|
||||||
Reference in New Issue
Block a user