langchain-ai / opengpts

MIT License
6.3k stars 827 forks source link

TypeError: string indices must be integers, not 'str' #330

Open ZhiminHeGit opened 1 month ago

ZhiminHeGit commented 1 month ago

https://github.com/langchain-ai/opengpts/blob/d2098456399ac11ddd7fc6b8ae9716fd3a3d4c61/backend/app/agent.py#L152

ZhiminHeGit commented 1 month ago

added print( _tool, type(_tool)) on the previous line for debugging and got " Wikipedia <class 'str'>". it shows _tool is a str , not a dictionary as expected.

ZhiminHeGit commented 1 month ago

was following the examples in api.MD. the code for creating assistant is here: print(requests.post('http://127.0.0.1:8100/assistants', json={ "name": "bar", "config": {"configurable": { "type": "agent", "type==agent/agent_type": "GPT 3.5 Turbo", "type==agent/system_message": "You are a helpful assistant", "type==agent/tools": ["Wikipedia"] }}, "public": True }, cookies= {"opengpts_user_id": "foo"}).content)

tools passed in from line 138 is ['Wikipedia'], is a list containing string, rather than type Tool