huggingface / huggingface/agents-course

[HANDS-ON BUG] Unit 3| Creating a RAG Tool for Guest Stories | Step 2 | langgraph

Open
#410 0 comments 0 reactions 0 assignees View on GitHub
hands-on-bug
Dominant language
MDX
Stars
32.6k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

For the AI Agent Langgraph version the code needs update.

Extracting text function "extract_text" tries to return "\n\n".join([doc.text for doc in results[:3]]), and it gives an error in tool call:

{'tools': {'messages': [ToolMessage(content='Error: AttributeError("\'Document\' object has no attribute \'text\'")\n Please fix your mistakes.', name='guest_info_retriever', id='c34e52a8-3ba2-437b-a0f3-dadfe1fa99e1', tool_call_id='0', status='error')]}}

To allow the tool to return data, next change will help (doc.text replace by doc.page_content):

return "\n\n".join([doc.text for doc in results[:3]]) -> return "\n\n".join([doc.page_content for doc in results[:3]])

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the extract_text function in Unit 3, Creating a RAG Tool for Guest Stories, Step 2, and reproduce the guest_info_retriever tool call shown in the issue. Verify that the tool returns the retrieved guest-story data without the Document attribute error.

Written by the indexing model from the issue text.

Assessment

Domain
ai, documentation
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.