gemini_adk_fluent_rs/
tasks.rs1pub use crate::spec::{
4 SkillSpec, SkillToolSpec, TaskExpectation, TaskObservationKind, TaskScenario, TaskStep,
5 TaskTraceSnapshot,
6};
7pub use gemini_adk_rs::tasks::*;
8
9#[derive(Debug, Clone)]
11pub struct Skill {
12 spec: SkillSpec,
13}
14
15impl Skill {
16 pub fn new(name: impl Into<String>, version: impl Into<String>) -> Self {
18 Self {
19 spec: SkillSpec {
20 name: name.into(),
21 version: version.into(),
22 ..Default::default()
23 },
24 }
25 }
26 pub fn description(mut self, text: impl Into<String>) -> Self {
28 self.spec.description = text.into();
29 self
30 }
31 pub fn instruction(mut self, text: impl Into<String>) -> Self {
33 self.spec.instruction = text.into();
34 self
35 }
36 pub fn input(mut self, name: impl Into<String>, field: crate::spec::StateFieldSpec) -> Self {
38 self.spec.inputs.insert(name.into(), field);
39 self
40 }
41 pub fn output(mut self, name: impl Into<String>, field: crate::spec::StateFieldSpec) -> Self {
43 self.spec.outputs.insert(name.into(), field);
44 self
45 }
46 pub fn tool(mut self, tool: crate::spec::ToolSpec, effect: TaskToolEffect) -> Self {
48 self.spec.tools.push(SkillToolSpec { tool, effect });
49 self
50 }
51 pub fn conversation(mut self, conversation: crate::conversation::ConversationSpec) -> Self {
53 self.spec.conversation = Some(conversation);
54 self
55 }
56 pub fn state(mut self, name: impl Into<String>, field: crate::spec::StateFieldSpec) -> Self {
58 self.spec.state.insert(name.into(), field);
59 self
60 }
61 pub fn extract(mut self, extractor: crate::spec::ExtractSpec) -> Self {
63 self.spec.extract.push(extractor);
64 self
65 }
66 pub fn computed(mut self, computed: crate::spec::ComputedSpec) -> Self {
68 self.spec.computed.push(computed);
69 self
70 }
71 pub fn watch(mut self, watch: crate::spec::WatchSpec) -> Self {
73 self.spec.watch.push(watch);
74 self
75 }
76 pub fn pattern(mut self, pattern: crate::spec::PatternSpec) -> Self {
78 self.spec.patterns.push(pattern);
79 self
80 }
81 pub fn memory(mut self, memory: crate::spec::MemorySpec) -> Self {
83 self.spec.memory = Some(memory);
84 self
85 }
86 pub fn compile(self, resources: &crate::spec::SpecResources) -> Result<CompiledSkill, String> {
88 self.spec.compile(resources)
89 }
90 pub fn into_spec(self) -> SkillSpec {
92 self.spec
93 }
94}