No project description provided
Project description
Dewy LangChain Plugin
This package provides Dewy integration for LangChain.
Example:
from langchain_core.runnables import RunnableParallel, RunnablePassthrough
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate
from dewy_langchain import DewyRetriever
retriever = DewyRetriever.for_collection("main", base_url="http://localhost:8000")
prompt = ChatPromptTemplate.from_messages(
[
(
"system",
"""
You're a helpful AI assistant. Given a user question and some retrieved content, answer the user question.
If none of the articles answer the question, just say you don't know.
Here is the retrieved content:
{context}
""",
),
("human", "{question}"),
]
)
def format_chunks(chunks):
return "\n\n".join([d.page_content for d in chunks])
chain = (
{ "context": retriever | format_chunks, "question": RunnablePassthrough() }
| prompt
| llm
| StrOutputParser()
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dewy_langchain-0.3.0.tar.gz
(2.0 kB
view details)
Built Distribution
File details
Details for the file dewy_langchain-0.3.0.tar.gz
.
File metadata
- Download URL: dewy_langchain-0.3.0.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37110deb5d7c6358a419f57e316ae71cdd8ee1b81849ad932876e0bba2035f0c |
|
MD5 | 05fa8eeb34675722e861d2263ec2529e |
|
BLAKE2b-256 | e0d87574529bb82ef2beb897bee85adb6b62bc3ecb61ca8b5b07bf463721df92 |
File details
Details for the file dewy_langchain-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: dewy_langchain-0.3.0-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b7519509ca1f8404935271b02c6da701179d845dd587509b818f4610c0bb56e |
|
MD5 | ca1f7ad80cfac85766106505a8b6adc1 |
|
BLAKE2b-256 | 0dfb76570af4e1d3f806619364d94ccb8a021b5fcef6a7f4ffc47480233f2950 |