Skip to content

Commit 902125d

Browse files
committed
[CHORE] integrations: core: update readme, make clippy happy
1 parent 94c47c1 commit 902125d

File tree

4 files changed

+52
-8
lines changed

4 files changed

+52
-8
lines changed

README.md

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,13 @@ async fn main() -> Result<()> {
8383
```rust
8484
use seedframe::prelude::*;
8585
use seedframe::providers::{completions::OpenAI, embeddings::OpenAIEmbedding};
86+
use seedframe::vector_store::InMemoryVectorStore;
8687

8788
// Declare file loader that doesnt check for updates, loading files that match the glob pattern
8889
#[loader(kind = "FileOnceLoader", path = "/tmp/data/**/*.txt")]
8990
pub struct MyLoader;
9091

91-
#[vector_store(kind = "InMemoryVectorStore")]
92+
#[vector_store(store = "InMemoryVectorStore")]
9293
pub struct MyVectorStore;
9394

9495
#[embedder(provider = "OpenAIEmbedding")]
@@ -115,11 +116,47 @@ async fn main() {
115116
let response = client.prompt("Explain quantum computing").send().await.unwrap();
116117
}
117118
```
119+
## Built-in Components
118120

121+
**Loaders**
122+
- [`FileOnceLoader`](https://github.com/Shifta-Robel/SeedFrame/blob/main/core/src/loader/builtins/file_loaders/file_once_loader.rs) - Load files once using glob patterns
123+
- [`FileUpdatingLoader`](https://github.com/Shifta-Robel/SeedFrame/blob/main/core/src/loader/builtins/file_loaders/file_updating_loader.rs) - Load files and watch for changes
124+
125+
**Vector Stores**
126+
- [`InMemoryVectorStore`](https://github.com/Shifta-Robel/SeedFrame/blob/main/core/src/vector_store/in_memory_vec_store.rs) - Simple in-memory vector storage implementation
127+
128+
**Completion Providers**
129+
- [`OpenAI`](https://github.com/Shifta-Robel/SeedFrame/blob/main/core/src/providers/completions/openai.rs) - [OpenAI](https://openai.com)) API integration
130+
- [`Deepseek`](https://github.com/Shifta-Robel/SeedFrame/blob/main/core/src/providers/completions/deepseek.rs) - (Deepseek](https://deepseek.com) API integration
131+
- [`Xai`](https://github.com/Shifta-Robel/SeedFrame/blob/main/core/src/providers/completions/xai.rs) - [Xai](https://x.ai)'s API integration
132+
133+
**Embeddings**
134+
- [`OpenAI`](https://github.com/Shifta-Robel/SeedFrame/blob/main/core/src/providers/embeddings/openai.rs) - [OpenAI](https://openai.com) embeddings API integration
135+
136+
---
137+
138+
## Integrations
139+
140+
SeedFrame supports extending functionality through external crates. To create an integration all thats needed is to provide a type that implements the relevant trait from seedframe (`Loader`, `CompletionModel`, etc.). You can use the following crates as inspiration if you want to write an integration crate of your own.
141+
142+
**Completion Providers**
143+
- [`seedframe_anthropic`](https://github.com/Shifta-Robel/SeedFrame/tree/main/integrations/completion_providers/seedframe_anthropic) - [Anthropic](https://anthropic.com) API integration
144+
145+
**Embedding Providers**
146+
- [`seedframe_voyageai`](https://github.com/Shifta-Robel/SeedFrame/tree/main/integrations/embedding_providers/seedframe_voyageai) - [VoyageAI](https://voyageai.com) embeddings
147+
148+
**Vector Stores**
149+
- [`seedframe_pinecone`](https://github.com/Shifta-Robel/SeedFrame/tree/main/integrations/vector_stores/seedframe_pinecone) - [Pinecone](https://pinecone.io) vector database integration
150+
151+
**Loaders**
152+
- [`seedframe_webscraper`](https://github.com/Shifta-Robel/SeedFrame/tree/main/integrations/seedframe_webscraper) - Web scraping using [scraper-rs](https://docs.rs/scraper)
153+
154+
---
155+
156+
If you wrote an integration crate, please update this list and [submit a PR](https://github.com/Shifta-Robel/SeedFrame/compare).
119157
## Contributing
120158

121-
All contributions as welcome! Writing integrations for LLM providers and Embedders is some what trivial, use the implementations for the already supported providers as inspiration.
122-
This library could use support for more loaders, vector stores... so don't shy away from helping!
159+
All contributions as welcome! This library could use support for more loaders, vector stores, providers ... so don't shy away from helping!
123160

124161

125162
#### ⭐ Leave a Star!

core/src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
//!
2020
//! ### Building a simple RAG
2121
//!
22-
//! ```rust,no_run
22+
//! ```rust,ignore
2323
//! use seedframe::prelude::*;
2424
//! use seedframe::providers::{completions::OpenAI, embeddings::OpenAIEmbedding};
25+
//! use seedframe::vector_store::InMemoryVectorStore;
2526
//!
2627
//! // Declare file loader that doesnt check for updates, loading files that match the glob pattern
2728
//! #[loader(kind = "FileOnceLoader", path = "/tmp/data/**/*.txt")]
2829
//! pub struct MyLoader;
2930
//!
30-
//! #[vector_store(kind = "InMemoryVectorStore")]
31+
//! #[vector_store(store = "InMemoryVectorStore")]
3132
//! pub struct MyVectorStore;
3233
//!
3334
//! #[embedder(provider = "OpenAIEmbedding")]
@@ -57,7 +58,7 @@
5758
//!
5859
//! ### Tool calls and Extractors
5960
//!
60-
//! ```rust,no_run
61+
//! ```rust,ignore
6162
//! use seedframe::{providers::completions::OpenAI, prelude::*};
6263
//!
6364
//! #[client(provider = "OpenAI", tools("analyze"))]
@@ -88,6 +89,8 @@
8889
//!
8990
//! // Tool call
9091
//! client.prompt("Analyze this: 'I love Rust!' (en)")
92+
//! .append_tool_response(true) // append result of tool execution to the message history
93+
//! // more prompt modifiers if you want
9194
//! .send()
9295
//! .await?;
9396
//!
@@ -102,7 +105,7 @@
102105
//!
103106
//! You can pass state to tools by adding arguments of type `State<_>` to them, the only catch is that there can only be one type of State\<T\> attached to the client.
104107
//!
105-
//! ```rust,no_run
108+
//! ```rust,ignore
106109
//! use seedframe::{providers::completions::OpenAI, prelude::*};
107110
//!
108111
//! #[client(provider = "OpenAI", tools("greet"))]
@@ -135,7 +138,7 @@
135138
//!
136139
//! To share mutable state you can use types with interior mutablity, eg `Mutex`s
137140
//!
138-
//! ```rust,no_run
141+
//! ```rust,ignore
139142
//! /// Greets a user
140143
//! /// # Arguments
141144
//! /// * `name`: name of the user

integrations/seedframe_webscraper/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ pub struct WebScraper {
6363
}
6464

6565
impl WebScraper {
66+
#[allow(clippy::missing_panics_doc)]
6667
/// Creates a new `WebScraper` from a JSON configuration string
6768
///
6869
/// # Errors

integrations/vector_stores/seedframe_pinecone/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ impl VectorStore for PineconeVectorStore {
127127
}
128128
Ok(())
129129
}
130+
#[allow(clippy::cast_possible_truncation)]
130131
async fn top_n(&self, query: &[f64], n: usize) -> Result<Vec<Embedding>, VectorStoreError> {
131132
let mut index_guard = self.index.lock().await;
132133
let resp = index_guard
@@ -149,6 +150,7 @@ fn value_from_str(value: String) -> Value {
149150
Value { kind }
150151
}
151152

153+
#[allow(clippy::cast_possible_truncation)]
152154
fn vector_from_embedding(embedding: Embedding) -> Vector {
153155
let id = embedding.id;
154156
let values = embedding.embedded_data.iter().map(|&v| v as f32).collect();
@@ -189,6 +191,7 @@ impl TryFrom<QueryResponse> for Embeddings {
189191
}
190192
}
191193

194+
#[allow(clippy::needless_pass_by_value)]
192195
fn into_vec_store_error(e: PineconeError) -> VectorStoreError {
193196
VectorStoreError::Provider(e.to_string())
194197
}

0 commit comments

Comments
 (0)