DLI Course 'Building RAG Agents for LLMs' - Assessment Support

Hi team,

I am finishing the final assessment of Deep Learning Institute course ‘Building RAG Agents
for LLMs’.

However, although I successfully launched basic_chat, retriever and generator models to 9012 port and able to generate response locally, when run the evaluation script server_app.py, it could not start Gradio UI, it only shows ‘Starting FastAPI app’.
Therefore, when assess task, it shows ‘it does not look like you completed the assessment yet’.

I need some technical support to debug the issue, in order to pass the assessment.
dli #rag

Best,
Fortuna

Hey Fortuna!

Sorry about the delay! server_app.py is running perpetually in another microservice and the UI should be getting exposed to a port (:8090 I think). From there, you should be hitting the evaluate button to execute the script. Does this help?

Hi,
I have the same problem. Did you manage to do it? I’m going insane :(

Hi @vkudlay, thanks for your reply.

I successfully got Gradio run, and passed all the evaluation questions, as screenshot attached.
The chatbot showed ‘Congrats! You passed the assessment!’.

However, when assessed task, it still showed the same issue.
Could you please to clarify why Gradio UI and environment assess task results are not align?

Best,
Fortuna

Awesome! Did you kickstart the service yourself, or are you using the one perpetually open at <course_url>:8090? If you started it yourself, then the # secret line is still just a comment, hence passing the test does nothing. The running frontend microservice has some actual commands that run in place of that one.

If you’re curious how this is achieved:

  mod: ## Modifier service. Does nothing in dev. Removes solution component in prod
     container_name: modifier
     context: notebooks/docker_router
     dockerfile: Dockerfile
     volumes: 
      - /var/run/docker.sock:/var/run/docker.sock
      - ./notebooks/:/notebooks/
    depends_on: 
      - "frontend"
    command: >
      sed -i -e 's:code_that_does_something():## secret:g' /notebooks/frontend/server_app.py

Example: If your course environment url is http://blablabla.aws.labs.courses.nvidia.com/lab/lab, then frontend should be running on http://blablabla.aws.labs.courses.nvidia.com:8090

Hi I am getting this below error while running server_app.py “Assessment” kindly help…

I have deployed the llms in 9012 port using langserve but still facing this issue unable to complete kindly help.

error logs:

Gradio Stream failed: [{‘loc’: ('root ',), ‘msg’: ‘str type expected’, ‘type’: ‘type_error.str’}, {‘loc’: ('root ', ‘text’), ‘msg’: ‘field required’, ‘type’: ‘value_error.missing’}, {‘loc’: ('root ', ‘messages’), ‘msg’: ‘field required’, ‘type’: ‘value_error.missing’}, {‘loc’: ('root ',), ‘msg’: ‘value is not a valid list’, ‘type’: ‘type_error.list’}]

Heyo! There’s a number of things that could be happening. I’d need more information about the surrounding context to be of much help. The issue is definitely stemming from the fact that the history is getting corrupted (maybe one of your chains is returning none, or maybe your generator chain isn’t quite there). Can you provide some more context?
The tip on the assessment is to check over the frontend code and see what exactly needs to be deployed for your remoterunnable to properly slot into the frontend-side orchestration.

Hey @vkudlay ! I’m having the same error as jcarun28 in the Assessment.

Gradio Stream failed: [{‘loc’: ('root ',), ‘msg’: ‘str type expected’, ‘type’: ‘type_error.str’}, {‘loc’: ('root ', ‘text’), ‘msg’: ‘field required’, ‘type’: ‘value_error.missing’}, {‘loc’: ('root ', ‘messages’), ‘msg’: ‘field required’, ‘type’: ‘value_error.missing’}, {‘loc’: ('root ',), ‘msg’: ‘value is not a valid list’, ‘type’: ‘type_error.list’}]

This error is happening only when “RAG” chain is activate on Gradio app. I tried a lot of solutions, like changing add_message, add_text, bot and I tried to change the retrieval_chain, but without success.

Some error is happening on
chains_dict[‘retriever’]

This is my server_app.py:

server_app.zip (4.3 KB)

Hey @leonardo.ti.bruno!
The error you’re seeing is coming from Gradio, but is being generated from the LLM streaming routine.

I see in the file that you’re sending your routes out like the following:

add_routes(
    app,
    llm,
    path="/basic_chat",
)

add_routes(
    app,
    llm,
    path="/retriever",
)

add_routes(
    app,
    llm,
    path="/generator",
)

This is probably where things are breaking. The second argument is what is going to be received on the front end, effectively meaning that every RemoteRunnable in the microservice is trying to pass through your ChatNVIDIA LLM. This is sufficient for basic_chat but insufficient for both generator and retriever.

Hello @vkudlay I saw a lot of implementation required for application, the context_getter on “/retriever” and the llm_gen for “/generator”, and I modified a lot on retrievier chain and output_chain, but when I think was finishing the course, sadly I got this message:

image

What I can do to solve this? Thank you!

Oh yeah. You can request more time. I’ll send a private message asking for either DLI username or email address associated with the account.

Thank you very much vkudlay!
Email: leonardo
leonardo.ti.bruno@gmail.com

Awesome! Time has been added. Feel free to delete the post with your creds. Does my comment above clear things up, or is there something else I can clarify?

Hello @vkudlay. This is my server_app.py right now. I’m receiving on RAG the same message as before:

Gradio Stream failed: [{‘loc’: ('root ',), ‘msg’: ‘str type expected’, ‘type’: ‘type_error.str’}, {‘loc’: ('root ', ‘text’), ‘msg’: ‘field required’, ‘type’: ‘value_error.missing’}, {‘loc’: ('root ', ‘messages’), ‘msg’: ‘field required’, ‘type’: ‘value_error.missing’}, {‘loc’: ('root ',), ‘msg’: ‘value is not a valid list’, ‘type’: ‘type_error.list’}]

server_app_2.zip (4.6 KB)

What’s exactly could be happening here? What’s exactly Gradio is sending to these endpoints?

See the earlier comment, and check out how the frontend is using your RemoteRunnable. The error is being generated from your generator endpoint since it’s expecting a ChatPromptTemplate response.

I could finish!


Thank you very much @vkudlay

1 Like

Hey @ricordo.yan.
My post above isn’t actually the solution (we’d rather the solution didn’t wind up in the forums lol). It just shows that the solution is supposed to look like. The retriever and generator components need to be properly implemented per the course instructions/as would be ingestible by frontend/server_app.py :D

Hello @vkudlay , I was able to figure out the error. However, when I paste the question and answer pair it keeps telling me please upload the fresh paper. What I am doing wrong here?

Hey @ricordo.yan, that issue has to do with the documents you loaded in in part 7. You need to make sure in that step that at least one of your papers has a last-modified date that it at most one month ago. Verify that at least two such “fresh” chunks are in your vectorstore/have been processed appropriately from part 7.


Hello @vkudlay , I passed the assessment and I completed all the course notebooks. However, the course completion just does not complete the circle. Will the certificate be sent to me by email? Thanks