Skip to content

Add docstring for dspy.ReAct #8334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

chenmoneygithub
Copy link
Collaborator

Add docstring for dspy.ReAct.


class ReAct(Module):
def __init__(self, signature, tools: list[Callable], max_iters=5):
def __init__(self, signature: Type["Signature"], tools: list[Callable], max_iters: Optional[int] = 5):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no need to make the type of max_iters Optional since it has default value.

react = dspy.ReAct(signature="question->answer", tools=[get_weather])

pred = react(question="What is the weather in Tokyo?")

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm why isn’t this example 3 lines. All the imports (esp Tool) and API key stuff is unnecessary

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually I prefer to have the code example fully runnable instead of assuming users already have the prerequisite knowledge, unless the full code is extremely long. For our new users, it may take a while to figure out all the setups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants