gproxy_protocol/adapt/generate/gemini_responses/
synthesis.rs1use super::*;
2
3impl GeminiViaResponses {
4 pub async fn prepare_for_stream_synthesis<S: crate::capability::StateStore>(
7 input: g::GenerateContentRequestBody,
8 endpoint: Endpoint,
9 identities: GenerationIdentity,
10 state: &super::super::GenerationStateAccess<'_, S>,
11 ) -> Result<Self, TransformError> {
12 let original = input.into_declared();
13 let buffered = original.clone();
14 let mut prepared = Self::prepare_with_state(buffered, endpoint, identities, state).await?;
15 prepared.original_request = original;
16 prepared.target_request.stream = Some(Some(false));
17 Ok(prepared)
18 }
19 pub async fn prepare_for_stream_synthesis_with_capabilities<
22 S: crate::capability::StateStore,
23 R: crate::capability::ResourceAccess,
24 >(
25 input: g::GenerateContentRequestBody,
26 endpoint: Endpoint,
27 identities: GenerationIdentity,
28 state: &super::super::GenerationStateAccess<'_, S>,
29 resources: &super::super::GenerationResources<'_, R>,
30 ) -> Result<Self, TransformError> {
31 let original = input.into_declared();
32 let buffered = original.clone();
33 let mut prepared =
34 Self::prepare_with_capabilities(buffered, endpoint, identities, state, resources)
35 .await?;
36 prepared.original_request = original;
37 prepared.target_request.stream = Some(Some(false));
38 Ok(prepared)
39 }
40}
41
42impl ResponsesViaGemini {
43 pub async fn prepare_for_stream_synthesis<S: crate::capability::StateStore>(
46 input: r::GenerateContentRequestBody,
47 endpoint: Endpoint,
48 identities: GenerationIdentity,
49 state: &super::super::GenerationStateAccess<'_, S>,
50 context: p::GeminiReplayContext,
51 ) -> Result<Self, TransformError> {
52 let original = input.into_declared();
53 let mut buffered = original.clone();
54 buffered.stream = Some(Some(false));
55 let mut prepared =
56 Self::prepare_with_state(buffered, endpoint, identities, state, context).await?;
57 prepared.original_request = original;
58 Ok(prepared)
59 }
60 pub async fn prepare_for_stream_synthesis_with_capabilities<
63 S: crate::capability::StateStore,
64 R: crate::capability::ResourceAccess,
65 >(
66 input: r::GenerateContentRequestBody,
67 endpoint: Endpoint,
68 identities: GenerationIdentity,
69 state: &super::super::GenerationStateAccess<'_, S>,
70 resources: &super::super::GenerationResources<'_, R>,
71 context: p::GeminiReplayContext,
72 ) -> Result<Self, TransformError> {
73 let original = input.into_declared();
74 let mut buffered = original.clone();
75 buffered.stream = Some(Some(false));
76 let mut prepared = Self::prepare_with_capabilities(
77 buffered, endpoint, identities, state, resources, context,
78 )
79 .await?;
80 prepared.original_request = original;
81 Ok(prepared)
82 }
83}