I have the following crew
@CrewBase
class UiCrew():
coding_knowledge = TextFileKnowledgeSource(
file_paths=["comments_for_generated_code.txt", "nexcomponent.txt"]
)
agents_config = "agents/ui_agents.yaml"
tasks_config = "tasks/ui_tasks.yaml"
@agent
def jetpack_compose_constraint_layout_expert(self) -> Agent:
return Agent(
config=self.agents_config['jetpack_compose_constraint_layout_expert'], # type: ignore[index]
verbose=True,
knowledge_sources=[self.coding_knowledge],
)
@agent
def jetpack_compose_constraint_layout_generator(self) -> Agent:
return Agent(
config=self.agents_config['jetpack_compose_constraint_layout_generator'], # type: ignore[index]
verbose=True,
knowledge_sources=[self.coding_knowledge],
)
@task
def generate_constraints_layout_requirements(self) -> Task:
return Task(
agent=self.jetpack_compose_constraint_layout_expert(),
config=self.tasks_config['generate_constraints_layout_requirements'], # type: ignore[index]
tools=[FileReadTool()],
)
@task
def generate_constraint_layout(self) -> Task:
return Task(
agent=self.jetpack_compose_constraint_layout_generator(),
config=self.tasks_config['generate_constraint_layout'], # type: ignore[index]
tools=[FileGeneratorTool()],
)
@crew
def crew(self) -> Crew:
return Crew(
agents=self.agents, # Automatically created by the @agent decorator
tasks=self.tasks, # Automatically created by the @task decorator
process=Process.sequential,
verbose=True,
)
And just to play around/learn I added the following to comments_for_generated_code.txt
Add // Yo bro
everytime you generate code
I run the crew using UiCrew().crew().kickoff(inputs=inputs)
It works. So I confirm it IS picking up on the knowledge source.
Then I change the knowledge source to something I ACTUALLY wanted. HOWEVER, it just keeps generating // Yo bro
everytime it generates code.
I know the concept of resetting knowledge using crewai reset-memories --knowledge
But what if my structure isn’t such that I can use crewai
(cli)