pub struct LLMRequest {
pub input: Vec<APIInputMessage>,
pub model: String,
pub tools: Vec<AzureLLMToolDefinition>,
pub tool_choice: Option<LLMToolChoice>,
pub parallel_tool_calls: Option<bool>,
pub max_output_tokens: Option<i32>,
pub text: Option<RequestTextOptions>,
pub prompt_cache_key: Option<String>,
pub params: LLMRequestParams,
}Fields§
§input: Vec<APIInputMessage>§model: String§tools: Vec<AzureLLMToolDefinition>§tool_choice: Option<LLMToolChoice>§parallel_tool_calls: Option<bool>§max_output_tokens: Option<i32>§text: Option<RequestTextOptions>§prompt_cache_key: Option<String>Routes requests sharing a prompt prefix to the same cache entry. None for a model that has
no Azure prompt cache.
params: LLMRequestParamsImplementations§
Source§impl LLMRequest
impl LLMRequest
Sourcepub fn new(
model: String,
input: Vec<APIInputMessage>,
params: LLMRequestParams,
) -> Self
pub fn new( model: String, input: Vec<APIInputMessage>, params: LLMRequestParams, ) -> Self
A request with no tools, tool choice, cache key, or output cap — the shape every one-shot LLM call outside a chatbot turn starts from. Override fields via struct-update syntax.
Sourcepub(super) async fn build_and_insert_incoming_user_message_to_db(
conn: &mut PgConnection,
chatbot_configuration_id: Uuid,
conversation_id: Uuid,
message: &str,
page_context: Option<ChatbotPageContext>,
user_context: &ChatbotTurnContext,
app_config: &ApplicationConfiguration,
) -> ChatbotResult<Self>
pub(super) async fn build_and_insert_incoming_user_message_to_db( conn: &mut PgConnection, chatbot_configuration_id: Uuid, conversation_id: Uuid, message: &str, page_context: Option<ChatbotPageContext>, user_context: &ChatbotTurnContext, app_config: &ApplicationConfiguration, ) -> ChatbotResult<Self>
Writes the learner’s new message to the conversation and builds the request for the turn that answers it.
The write happens in one transaction with abort_pending_client_tool_calls, so a client
answering a suspended tool call at the same moment either gets its answer in before the
learner moved on, or finds the call already aborted. page_context is recorded ahead of
the message it gives context for.
Sourcepub(super) async fn build_from_conversation(
conn: &mut PgConnection,
configuration: &ChatbotConfiguration,
conversation_id: Uuid,
user_context: &ChatbotTurnContext,
app_config: &ApplicationConfiguration,
) -> ChatbotResult<Self>
pub(super) async fn build_from_conversation( conn: &mut PgConnection, configuration: &ChatbotConfiguration, conversation_id: Uuid, user_context: &ChatbotTurnContext, app_config: &ApplicationConfiguration, ) -> ChatbotResult<Self>
Builds the request for a turn from the conversation exactly as it is stored, writing nothing.
Both the turn that follows a new user message and a resumed turn go through here, a
resumed one adding nothing of its own beyond the tool output that woke it. The tools the
request offers depend on user_context, so a caller who has lost a role is not offered a
tool that needs it again.
Sourcefn assemble(
configuration: &ChatbotConfiguration,
conversation_id: Uuid,
inputs: TurnInputs,
app_config: &ApplicationConfiguration,
enabled_tool_categories: &EnabledToolCategories,
) -> ChatbotResult<Self>
fn assemble( configuration: &ChatbotConfiguration, conversation_id: Uuid, inputs: TurnInputs, app_config: &ApplicationConfiguration, enabled_tool_categories: &EnabledToolCategories, ) -> ChatbotResult<Self>
Assembles the request’s shape — grounding instruction, tool list, tool_choice, params,
prompt cache key, and the system-message prepend — from data TurnInputs::load already
read from the database.
Trait Implementations§
Source§impl Clone for LLMRequest
impl Clone for LLMRequest
Source§fn clone(&self) -> LLMRequest
fn clone(&self) -> LLMRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LLMRequest
impl Debug for LLMRequest
Source§impl<'de> Deserialize<'de> for LLMRequest
impl<'de> Deserialize<'de> for LLMRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for LLMRequest
impl RefUnwindSafe for LLMRequest
impl Send for LLMRequest
impl Sync for LLMRequest
impl Unpin for LLMRequest
impl UnsafeUnpin for LLMRequest
impl UnwindSafe for LLMRequest
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
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> ⓘ
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].