Skip to content
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

/learn add Feature. Search Detailed file path. #1165

Open
gigascake opened this issue Dec 20, 2024 · 0 comments
Open

/learn add Feature. Search Detailed file path. #1165

gigascake opened this issue Dec 20, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@gigascake
Copy link

Problem

Proposed Solution

(examples)
/ask Select a list of ipynb file paths using the dspy.ReAcT code.

'''''
intro_ollama.ipynb:485: "Cell \u001b[0;32mIn[9], line 12\u001b[0m\n\u001b[1;32m 9\u001b[0m generate_answer \u001b[38;5;241m=\u001b[39m dspy\u001b[38;5;241m.\u001b[39mReAct(BasicQA, tools\u001b[38;5;241m=\u001b[39m[dspy\u001b[38;5;241m.\u001b[39mRetrieve(k\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m1\u001b[39m)])\n\u001b[1;32m 11\u001b[0m \u001b[38;5;66;03m# Call the predictor on a particular input.\u001b[39;00m\n\u001b[0;32m---> 12\u001b[0m pred \u001b[38;5;241m=\u001b[39m \u001b[43mgenerate_answer\u001b[49m\u001b[43m(\u001b[49m\u001b[43mquestion\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdev_example\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mquestion\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 14\u001b[0m \u001b[38;5;66;03m# Print the input and the prediction.\u001b[39;00m\n\u001b[1;32m 15\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m"\u001b[39m\u001b[38;5;124mQuestion: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mdev_example\u001b[38;5;241m.\u001b[39mquestion\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m"\u001b[39m)\n",
intro_ollama.ipynb:488: "File \u001b[0;32m/data01/anaconda3/envs/dspy/lib/python3.13/site-packages/dspy/predict/react.py:92\u001b[0m, in \u001b[0;36mReAct.forward\u001b[0;34m(self, input_args)\u001b[0m\n\u001b[1;32m 90\u001b[0m trajectory \u001b[38;5;241m=\u001b[39m {}\n\u001b[1;32m 91\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m idx \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmax_iters):\n\u001b[0;32m---> 92\u001b[0m pred \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mreact\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m\u001b[39;49m\u001b[38;5;241;43m\u001b[39;49m\u001b[43minput_args\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtrajectory\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mformat\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mtrajectory\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mlast_iteration\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43midx\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m==\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmax_iters\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m-\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 94\u001b[0m trajectory[\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m"\u001b[39m\u001b[38;5;124mthought_\u001b[39m\u001b[38;5;132;01m{\u001b[39;00midx\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m"\u001b[39m] \u001b[38;5;241m=\u001b[39m pred\u001b[38;5;241m.\u001b[39mnext_thought\n\u001b[1;32m 95\u001b[0m trajectory[\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m"\u001b[39m\u001b[38;5;124mtool_name_\u001b[39m\u001b[38;5;132;01m{\u001b[39;00midx\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m"\u001b[39m] \u001b[38;5;241m=\u001b[39m pred\u001b[38;5;241m.\u001b[39mnext_tool_name\n",
intro_ollama.ipynb:510: "generate_answer = dspy.ReAct(BasicQA, tools=[dspy.Retrieve(k=1)])\n"
'''''

Additional context

@gigascake gigascake added the enhancement New feature or request label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant