Skip to content
Discussion options

You must be logged in to vote
from functools import partial

def write_callback_to_file(step_output, file_path: str = "output.txt"):
  with open(file_path, 'a') as file:
      # my logic

callback_partial_function = partial(write_callback_to_file, file_path="output1.txt")
agent = Agent(
    role=task_info.agent.role,
    goal=task_info.agent.goal,
    backstory=task_info.agent.backstory,
    verbose=False,
    llm=get_llm(),
    step_callback=callback_partial_function
)

This worked for me, I needed to use partial from functools

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by pip-install-skills
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant