pub struct JinaLateChunkingClient { /* private fields */ }Expand description
Jina AI embeddings client with native late chunking support
Calls the Jina embeddings API with late_chunking=true. The API encodes
the concatenated inputs as a single sequence and returns per-input embeddings
where each embedding reflects the full-document context.
For fully local operation (no API key), configure Ollama with
rjmalagon/gte-qwen2-7b-instruct — it provides excellent 32k-context
embeddings without native late chunking but with a far larger context window.
§Examples
use graphrag_core::text::late_chunking::JinaLateChunkingClient;
let client = JinaLateChunkingClient::new("jina_xxxx".to_string());
let embeddings = client.embed_with_late_chunking(chunks).await?;
assert_eq!(embeddings.len(), chunks.len());Implementations§
Source§impl JinaLateChunkingClient
impl JinaLateChunkingClient
Sourcepub fn with_model(self, model: impl Into<String>) -> Self
pub fn with_model(self, model: impl Into<String>) -> Self
Override the embedding model
Sourcepub async fn embed_with_late_chunking(
&self,
chunks: &[TextChunk],
) -> Result<Vec<Vec<f32>>>
pub async fn embed_with_late_chunking( &self, chunks: &[TextChunk], ) -> Result<Vec<Vec<f32>>>
Embed chunks using Jina’s late chunking API
Sends all chunk contents in a single request with late_chunking: true.
The Jina API encodes them as one sequence so each chunk’s embedding
incorporates the full document context.
Returns one embedding vector per chunk, in the same order as the input.
Trait Implementations§
Source§impl Clone for JinaLateChunkingClient
impl Clone for JinaLateChunkingClient
Source§fn clone(&self) -> JinaLateChunkingClient
fn clone(&self) -> JinaLateChunkingClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for JinaLateChunkingClient
impl RefUnwindSafe for JinaLateChunkingClient
impl Send for JinaLateChunkingClient
impl Sync for JinaLateChunkingClient
impl Unpin for JinaLateChunkingClient
impl UnsafeUnpin for JinaLateChunkingClient
impl UnwindSafe for JinaLateChunkingClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more