MockCsi

Struct MockCsi 

Source
pub struct MockCsi { /* private fields */ }

Implementations§

Source§

impl MockCsi

Source

pub fn new(response: impl Into<String>) -> Self

Trait Implementations§

Source§

impl Csi for MockCsi

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 chunk_concurrently(&self, requests: Vec<ChunkRequest>) -> Vec<Vec<String>>

Process multiple chunking requests at once
Source§

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

Process multiple select language requests at once
Source§

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

Process multiple search requests at once
Source§

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

Retrieve multiple documents from the Document Index by their paths. Read more
Source§

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

Retrieve multiple documents’ metadata from the Document Index by their paths. Read more
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>, Error>
where Metadata: for<'a> Deserialize<'a> + Serialize,

Retrieve a document from the Document Index by its path. Read more
Source§

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

Retrieve a document’s metadata from the Document Index by its path. Read more
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. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.