DevCsi

Struct DevCsi 

Source
pub struct DevCsi { /* private fields */ }
Expand description

A Csi implementation that can be used for testing within normal Rust targets.

Implementations§

Source§

impl DevCsi

Source

pub fn new(address: impl Into<String>, token: impl Into<String>) -> Self

Source

pub fn aleph_alpha(token: impl Into<String>) -> Self

Construct a new DevCsi that points to the Aleph Alpha hosted Kernel

Trait Implementations§

Source§

impl Csi for DevCsi

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> + Serialize,

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> + Serialize,

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§

§

impl Freeze for DevCsi

§

impl !RefUnwindSafe for DevCsi

§

impl Send for DevCsi

§

impl Sync for DevCsi

§

impl Unpin for DevCsi

§

impl !UnwindSafe for DevCsi

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.