33from typing import List , Optional
44from pydantic import BaseModel
55
6+ from wardrobe_crew .add_image_tool import AddImageTool
7+
68
79class TagOutput (BaseModel ):
810 tags : List [str ]
911 description : Optional [str ] = None
1012
1113
14+ add_image_tool = AddImageTool ()
15+
16+
1217@CrewBase
1318class WardrobeCrew :
1419 """Crew automatisch taggt Kleidung mit lokalem Ollama-LLM"""
@@ -23,17 +28,26 @@ def image_tagger(self) -> Agent:
2328 "Material und Schnitt, spezialisiert auf visuelle Analyse."
2429 ),
2530 verbose = True ,
26- multimodal = True ,
31+ )
32+
33+ @task
34+ def image_analyzing_task (self ) -> Task :
35+ return Task (
36+ description = (
37+ "Analysiere das Bild eines Kleidungsstücks. Bild: {image_url}"
38+ ),
39+ expected_output = "Eine Beschreibung des Bildes mit besonderem Fokus auf das Kleidungsstück, einschließlich Stil, Farbe, Material und Schnitt." ,
40+ agent = self .image_tagger (),
41+ tools = [add_image_tool ],
2742 )
2843
2944 @task
3045 def tagging_task (self ) -> Task :
3146 return Task (
3247 description = (
33- "Analysiere das Bild eines Kleidungsstücks hier {image_url} und extrahiere 5–8 "
34- "präzise Tags wie Stil, Farbe, Material und Schnitt."
48+ "Finde 5-8 Tags, die das Kleidungsstück beschreiben, basierend auf der Analyse des Bildes. "
3549 ),
36- expected_output = "Ein Dictionary mit 'tags' (Liste) und optional 'description' " ,
50+ expected_output = "Eine Liste von Tags, die das Kleidungsstück beschreiben. " ,
3751 agent = self .image_tagger (),
3852 output_pydantic = TagOutput ,
3953 )
@@ -42,7 +56,7 @@ def tagging_task(self) -> Task:
4256 def crew (self ) -> Crew :
4357 return Crew (
4458 agents = [self .image_tagger ()],
45- tasks = [self .tagging_task ()],
59+ tasks = [self .image_analyzing_task (), self . tagging_task ()],
4660 process = Process .sequential ,
4761 verbose = True ,
4862 )
0 commit comments