-
Notifications
You must be signed in to change notification settings - Fork 2
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
Revamp Chatbot Prototype #7
base: dev
Are you sure you want to change the base?
Conversation
7cfe1c5
to
634e5ca
Compare
1caf9e2
to
565645a
Compare
…ler_chatbot chains
|
||
from rag.utils.history import get_session_history | ||
from langchain_core.runnables.history import RunnableWithMessageHistory | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Define a basic RAG (Retrieval-Augmented Generation) chain | |
# This chain consists of a prompt template, a language model, and an output parser |
from langchain_core.runnables.history import RunnableWithMessageHistory | ||
|
||
rag_chain = chatbot_template | openai_llm | StrOutputParser() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Define a RAG chain that includes historical context from previous interactions |
Hi Solomon! Thanks for the really comprehensive work, I am loving the configurability of the chatbot and think this enables us to have a lot of flexibility in terms of what we are able to do. The change to FastAPI from Flask makes sense especially when it comes to asynchronous nature/potential of chatbots and also love the FastAPI documentation that comes with it. I was able to eventually get both the test script up and running and then also run the API with a local Qdrant vector database, so that's good. Ran into a couple of bugs which I've commented on and we've discussed (there have been quite a few changes since this PR was put out so that's unsurprising). It would be great to know what the steps are to deploy the chatbot on the EC2 instance, this is potentially we can discuss at some point in the coming weeks. I think it might be useful @Jack-Vines to review the API part of this PR as myself and @crispy-wonton do not have much experience with these packages or how they set up. As a more general comment, I think we are missing some documentation at the top of each file, i.e. a clear message which is readable for those who either have no or some experience with either web applications or RAG pipelines and I think potentially some visual representations would really help us understand the functionality of the different files and the architecture overall. I am happy to help out with this! I think as a whole, we also need documentation on how to set everything up from poetry, to LangFuse and of course with regards to running an EC2 instance! It doesn't seem trivial, at least to a beginner like myself, so I think this would be super helpful. Thanks again for the stellar work! |
…rating into langfuse
…ocessPoolExecutor
…on generated chains
…utilization metric error
Description
Revamps the NIBE prototype to use latest Langchain. Also separates responsibilities:
Note: WhatsApp interface hasn't been implemented, and this PR will be updated to reflect these changes. The aim of this PR is to first revamp the prototype to use the latest Langchain LCEL framework.
Addresses #6 , branch is
2_revamp
Instructions for Reviewer
Contact me for Langfuse integration details (env vars needed in your
.env
file)2_revamp
make pip-install
if you already have the project conda environment setupTo test the API:
poetry
installed, feel free to ask me how best to do thisconda deactivate
, thencd api
poetry env use 3.10
, thenpoetry install
langchain app serve --app app.server:app
0.0.0.0:8000
/invoke
endpoint by replacing the string in the JSON request"input": "string"
, with a query.Please pay special attention to and other notes
Checklist:
notebooks/
N/Apre-commit
and addressed any issues not automatically fixeddev
README
sOther additional features to review:
Review instructions, after
make install
ormake pip-install
, test out CLI commands withchatbot --help
, there are descriptions for other commands available.