#[non_exhaustive]pub struct FewShotExample {
pub conversation_context: Option<ConversationContext>,
pub extra_info: HashMap<String, String>,
pub output: Option<GeneratorSuggestion>,
pub instruction_list: Option<InstructionList>,
/* private fields */
}conversations or generator-evaluations or generators only.Expand description
Providing examples in the generator (i.e. building a few-shot generator) helps convey the desired format of the LLM response.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.conversation_context: Option<ConversationContext>Optional. Conversation transcripts.
extra_info: HashMap<String, String>Optional. Key is the placeholder field name in input, value is the value of the placeholder. E.g. instruction contains “@price”, and ingested data has <“price”, “10”>
output: Option<GeneratorSuggestion>Required. Example output of the model.
instruction_list: Option<InstructionList>Instruction list of this few_shot example.
Implementations§
Source§impl FewShotExample
impl FewShotExample
pub fn new() -> Self
Sourcepub fn set_conversation_context<T>(self, v: T) -> Selfwhere
T: Into<ConversationContext>,
pub fn set_conversation_context<T>(self, v: T) -> Selfwhere
T: Into<ConversationContext>,
Sets the value of conversation_context.
§Example
use google_cloud_dialogflow_v2::model::ConversationContext;
let x = FewShotExample::new().set_conversation_context(ConversationContext::default()/* use setters */);Sourcepub fn set_or_clear_conversation_context<T>(self, v: Option<T>) -> Selfwhere
T: Into<ConversationContext>,
pub fn set_or_clear_conversation_context<T>(self, v: Option<T>) -> Selfwhere
T: Into<ConversationContext>,
Sets or clears the value of conversation_context.
§Example
use google_cloud_dialogflow_v2::model::ConversationContext;
let x = FewShotExample::new().set_or_clear_conversation_context(Some(ConversationContext::default()/* use setters */));
let x = FewShotExample::new().set_or_clear_conversation_context(None::<ConversationContext>);Sourcepub fn set_extra_info<T, K, V>(self, v: T) -> Self
pub fn set_extra_info<T, K, V>(self, v: T) -> Self
Sets the value of extra_info.
§Example
let x = FewShotExample::new().set_extra_info([
("key0", "abc"),
("key1", "xyz"),
]);Sourcepub fn set_output<T>(self, v: T) -> Selfwhere
T: Into<GeneratorSuggestion>,
pub fn set_output<T>(self, v: T) -> Selfwhere
T: Into<GeneratorSuggestion>,
Sourcepub fn set_or_clear_output<T>(self, v: Option<T>) -> Selfwhere
T: Into<GeneratorSuggestion>,
pub fn set_or_clear_output<T>(self, v: Option<T>) -> Selfwhere
T: Into<GeneratorSuggestion>,
Sourcepub fn set_instruction_list<T: Into<Option<InstructionList>>>(
self,
v: T,
) -> Self
pub fn set_instruction_list<T: Into<Option<InstructionList>>>( self, v: T, ) -> Self
Sets the value of instruction_list.
Note that all the setters affecting instruction_list are mutually
exclusive.
§Example
use google_cloud_dialogflow_v2::model::SummarizationSectionList;
let x = FewShotExample::new().set_instruction_list(Some(
google_cloud_dialogflow_v2::model::few_shot_example::InstructionList::SummarizationSectionList(SummarizationSectionList::default().into())));Sourcepub fn summarization_section_list(
&self,
) -> Option<&Box<SummarizationSectionList>>
pub fn summarization_section_list( &self, ) -> Option<&Box<SummarizationSectionList>>
The value of instruction_list
if it holds a SummarizationSectionList, None if the field is not set or
holds a different branch.
Sourcepub fn set_summarization_section_list<T: Into<Box<SummarizationSectionList>>>(
self,
v: T,
) -> Self
pub fn set_summarization_section_list<T: Into<Box<SummarizationSectionList>>>( self, v: T, ) -> Self
Sets the value of instruction_list
to hold a SummarizationSectionList.
Note that all the setters affecting instruction_list are
mutually exclusive.
§Example
use google_cloud_dialogflow_v2::model::SummarizationSectionList;
let x = FewShotExample::new().set_summarization_section_list(SummarizationSectionList::default()/* use setters */);
assert!(x.summarization_section_list().is_some());Trait Implementations§
Source§impl Clone for FewShotExample
impl Clone for FewShotExample
Source§fn clone(&self) -> FewShotExample
fn clone(&self) -> FewShotExample
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more