pub struct RagAiGenerator { /* private fields */ }
Expand description
RAG-based AI generator that uses the mockforge-data RAG engine
Implementations§
Source§impl RagAiGenerator
impl RagAiGenerator
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Create a RAG AI generator from environment variables
Reads configuration from:
MOCKFORGE_AI_PROVIDER
: LLM provider (openai, anthropic, ollama, etc.)MOCKFORGE_AI_API_KEY
: API key for the LLM providerMOCKFORGE_AI_MODEL
: Model name (e.g., gpt-4, claude-3-opus)MOCKFORGE_AI_ENDPOINT
: API endpoint (optional, uses provider default)MOCKFORGE_AI_TEMPERATURE
: Temperature for generation (optional, default: 0.7)MOCKFORGE_AI_MAX_TOKENS
: Max tokens for generation (optional, default: 1024)
Trait Implementations§
Source§impl AiGenerator for RagAiGenerator
impl AiGenerator for RagAiGenerator
Source§fn generate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
config: &'life2 AiResponseConfig,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn generate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
prompt: &'life1 str,
config: &'life2 AiResponseConfig,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Generate an AI response from a prompt Read more
Auto Trait Implementations§
impl Freeze for RagAiGenerator
impl !RefUnwindSafe for RagAiGenerator
impl Send for RagAiGenerator
impl Sync for RagAiGenerator
impl Unpin for RagAiGenerator
impl !UnwindSafe for RagAiGenerator
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
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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>
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 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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request