Struct Phind

Source
pub struct Phind {
    pub model: String,
    pub max_tokens: Option<u32>,
    pub temperature: Option<f32>,
    pub system: Option<String>,
    pub timeout_seconds: Option<u64>,
    pub stream: Option<bool>,
    pub top_p: Option<f32>,
    pub top_k: Option<u32>,
    pub api_base_url: String,
    /* private fields */
}
Expand description

Represents a Phind LLM client with configuration options.

Fields§

§model: String

The model identifier to use (e.g. “Phind-70B”)

§max_tokens: Option<u32>

Maximum number of tokens to generate

§temperature: Option<f32>

Temperature for controlling randomness (0.0-1.0)

§system: Option<String>

System prompt to prepend to conversations

§timeout_seconds: Option<u64>

Request timeout in seconds

§stream: Option<bool>

Whether to stream responses

§top_p: Option<f32>

Top-p sampling parameter

§top_k: Option<u32>

Top-k sampling parameter

§api_base_url: String

Base URL for the Phind API

Implementations§

Source§

impl Phind

Source

pub fn new( model: Option<String>, max_tokens: Option<u32>, temperature: Option<f32>, timeout_seconds: Option<u64>, system: Option<String>, stream: Option<bool>, top_p: Option<f32>, top_k: Option<u32>, ) -> Self

Creates a new Phind client with the specified configuration.

Trait Implementations§

Source§

impl ChatProvider for Phind

Implementation of chat functionality for Phind.

Source§

fn chat<'life0, 'life1, 'async_trait>( &'life0 self, messages: &'life1 [ChatMessage], ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ChatResponse>, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sends a chat request to Phind’s API.

§Arguments
  • messages - The conversation history as a slice of chat messages
§Returns

The provider’s response text or an error

Source§

fn chat_with_tools<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _messages: &'life1 [ChatMessage], _tools: Option<&'life2 [Tool]>, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ChatResponse>, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Sends a chat request to Phind’s API with tools.

§Arguments
  • messages - The conversation history as a slice of chat messages
  • tools - Optional slice of tools to use in the chat
§Returns

The provider’s response text or an error

Source§

fn chat_stream<'life0, 'life1, 'async_trait>( &'life0 self, _messages: &'life1 [ChatMessage], ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<String, LLMError>> + Send>>, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sends a streaming chat request to the provider with a sequence of messages. Read more
Source§

fn memory_contents<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Option<Vec<ChatMessage>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get current memory contents if provider supports memory
Source§

fn summarize_history<'life0, 'life1, 'async_trait>( &'life0 self, msgs: &'life1 [ChatMessage], ) -> Pin<Box<dyn Future<Output = Result<String, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Summarizes a conversation history into a concise 2-3 sentence summary Read more
Source§

impl CompletionProvider for Phind

Implementation of completion functionality for Phind.

Source§

fn complete<'life0, 'life1, 'async_trait>( &'life0 self, _req: &'life1 CompletionRequest, ) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sends a completion request to generate text. Read more
Source§

impl EmbeddingProvider for Phind

Implementation of embedding functionality for Phind.

Source§

fn embed<'life0, 'async_trait>( &'life0 self, _input: Vec<String>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl LLMProvider for Phind

Source§

fn tools(&self) -> Option<&[Tool]>

Source§

impl SpeechToTextProvider for Phind

Source§

fn transcribe<'life0, 'async_trait>( &'life0 self, _audio: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<String, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Transcribe the given audio bytes into text Read more
Source§

fn transcribe_file<'life0, 'life1, 'async_trait>( &'life0 self, file_path: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl TextToSpeechProvider for Phind

Implementation of the LLMProvider trait for Phind.

Source§

fn speech<'life0, 'life1, 'async_trait>( &'life0 self, text: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, LLMError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Convert the given text into speech audio Read more

Auto Trait Implementations§

§

impl Freeze for Phind

§

impl !RefUnwindSafe for Phind

§

impl Send for Phind

§

impl Sync for Phind

§

impl Unpin for Phind

§

impl !UnwindSafe for Phind

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> MaybeSendSync for T