Csi

Trait Csi 

Source
pub trait Csi {
Show 14 methods // Required methods fn chunk_concurrently( &self, requests: Vec<ChunkRequest>, ) -> Vec<Vec<String>>; fn search_concurrently( &self, requests: Vec<SearchRequest>, ) -> Vec<Vec<SearchResult>>; fn documents<'m, Metadata>( &self, paths: Vec<DocumentPath>, ) -> Result<Vec<Document<Metadata>>> where Metadata: for<'a> Deserialize<'a> + Serialize; fn documents_metadata<Metadata>( &self, paths: Vec<DocumentPath>, ) -> Result<Vec<Option<Metadata>>> where Metadata: for<'a> Deserialize<'a> + Serialize; fn chat_concurrently(&self, requests: Vec<ChatRequest>) -> Vec<ChatResponse>; fn complete_concurrently( &self, requests: Vec<CompletionRequest>, ) -> Vec<Completion>; fn select_language_concurrently( &self, requests: Vec<SelectLanguageRequest>, ) -> Vec<Option<LanguageCode>>; // Provided methods fn chunk(&self, request: ChunkRequest) -> Vec<String> { ... } fn search(&self, request: SearchRequest) -> Vec<SearchResult> { ... } fn document<Metadata>( &self, path: DocumentPath, ) -> Result<Document<Metadata>> where Metadata: for<'a> Deserialize<'a> + Serialize { ... } fn document_metadata<Metadata>( &self, path: DocumentPath, ) -> Result<Option<Metadata>> where Metadata: for<'a> Deserialize<'a> + Serialize { ... } fn chat(&self, request: ChatRequest) -> ChatResponse { ... } fn complete(&self, request: CompletionRequest) -> Completion { ... } fn select_language( &self, request: SelectLanguageRequest, ) -> Option<LanguageCode> { ... }
}
Expand description

Cognitive System Interface

Required Methods§

Source

fn chunk_concurrently(&self, requests: Vec<ChunkRequest>) -> Vec<Vec<String>>

Process multiple chunking requests at once

Source

fn search_concurrently( &self, requests: Vec<SearchRequest>, ) -> Vec<Vec<SearchResult>>

Process multiple search requests at once

Source

fn documents<'m, Metadata>( &self, paths: Vec<DocumentPath>, ) -> Result<Vec<Document<Metadata>>>
where Metadata: for<'a> Deserialize<'a> + Serialize,

Retrieve multiple documents from the Document Index by their paths.

§Errors

Will return an error if document metadata cannot be deserialized.

Source

fn documents_metadata<Metadata>( &self, paths: Vec<DocumentPath>, ) -> Result<Vec<Option<Metadata>>>
where Metadata: for<'a> Deserialize<'a> + Serialize,

Retrieve multiple documents’ metadata from the Document Index by their paths.

§Errors

Will return an error if metadata cannot be deserialized.

Source

fn chat_concurrently(&self, requests: Vec<ChatRequest>) -> Vec<ChatResponse>

Process multiple chat requests at once

Source

fn complete_concurrently( &self, requests: Vec<CompletionRequest>, ) -> Vec<Completion>

Process multiple completion requests at once

Source

fn select_language_concurrently( &self, requests: Vec<SelectLanguageRequest>, ) -> Vec<Option<LanguageCode>>

Process multiple select language requests at once

Provided Methods§

Source

fn chunk(&self, request: ChunkRequest) -> Vec<String>

Chunk the given text into smaller pieces that fit within the maximum token amount for a given model.

Source

fn search(&self, request: SearchRequest) -> Vec<SearchResult>

Search for documents in a given index.

Source

fn document<Metadata>(&self, path: DocumentPath) -> Result<Document<Metadata>>
where Metadata: for<'a> Deserialize<'a> + Serialize,

Retrieve a document from the Document Index by its path.

§Errors

Will return an error if document metadata cannot be deserialized.

Source

fn document_metadata<Metadata>( &self, path: DocumentPath, ) -> Result<Option<Metadata>>
where Metadata: for<'a> Deserialize<'a> + Serialize,

Retrieve a document’s metadata from the Document Index by its path.

§Errors

Will return an error if metadata cannot be deserialized.

Source

fn chat(&self, request: ChatRequest) -> ChatResponse

Send messages with a particular role to a model and receive a response. Provides a higher level interface than completion for chat scenarios.

Source

fn complete(&self, request: CompletionRequest) -> Completion

Generate a completion for a given prompt using a specific model.

Source

fn select_language( &self, request: SelectLanguageRequest, ) -> Option<LanguageCode>

Select the detected language for the provided input based on the list of possible languages. If no language matches, None is returned.

text: Text input languages: All languages that should be considered during detection.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§