-
Notifications
You must be signed in to change notification settings - Fork 171
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
Course material and code don't match up -> gives type error #7
Comments
Furthermore, the solutions folder doesn't seem to include bot.py which is the entrypoint to the app. That file also imports the generate_response function from agent.py file. In the solutions folder that function is also now defined in two places: agent.py and tools/vector.py. In the latter it's never called. |
I'm experiencing the same issue. Perhaps the maintainer could bind the dependencies in requirements.txt to specific releases. |
@adam-cowley Please help us with this |
Solution here |
Thanks for raising the issue. The course has been recently updated to reflect changes in Langchain v0.2 and the code to manage agents and tools updated.
Closing as no longer relevant. |
It seems that there's either something missing or wrong in the course material, compared to your code in the /solutions folder. If you follow along the course, you end up with a type error at the end of the following section: https://graphacademy.neo4j.com/courses/llm-chatbot-python/3-tools/1-vector-tool/
Error: "pydantic.v1.error_wrappers.ValidationError: 2 validation errors for AIMessage
content
str type expected (type=type_error.str)
content
value is not a valid list (type=type_error.list)"
In your solutions/tools/vector.py you seem to have the generate_response(prompt) function and tools =[] defined in vectory.py file but nowhere in the course material they were moved there (up until the above section). They were originally put in the agent.py file.
I.e. there seems to be some kind of mismatch between your solutions code and the code outlined in the course material. Here's the code from the vector.py file if you follow along with the course material:
import streamlit as st
from langchain_community.vectorstores.neo4j_vector import Neo4jVector
from llm import llm, embeddings
from langchain.chains import RetrievalQA
neo4jvector = Neo4jVector.from_existing_index(
embeddings, # (1)
url=st.secrets["NEO4J_URI"], # (2)
username=st.secrets["NEO4J_USERNAME"], # (3)
password=st.secrets["NEO4J_PASSWORD"], # (4)
index_name="moviePlots", # (5)
node_label="Movie", # (6)
text_node_property="plot", # (7)
embedding_node_property="plotEmbedding", # (8)
retrieval_query="""
RETURN
node.plot AS text,
score,
{
title: node.title,
directors: [ (person)-[:DIRECTED]->(node) | person.name ],
actors: [ (person)-[r:ACTED_IN]->(node) | [person.name, r.role] ],
tmdbId: node.tmdbId,
source: 'https://www.themoviedb.org/movie/'+ node.tmdbId
} AS metadata
"""
)
retriever = neo4jvector.as_retriever()
kg_qa = RetrievalQA.from_chain_type(
llm,
chain_type="stuff",
retriever=retriever,
)
The text was updated successfully, but these errors were encountered: