Ragie integration for LangChain
Project description
langchain-ragie
Ragie (https://ragie.ai) integration for LangChain
Install
pip install langchain-ragie
Usage
If you need asyncio, see this example..
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
from langchain_core.runnables import RunnablePassthrough
import langchain_ragie
template = """Answer the question based only on the following context:
{context}
Question: {question}
"""
prompt = ChatPromptTemplate.from_template(template)
model = ChatOpenAI()
retriever = langchain_ragie.RagieRetriever()
def format_docs(docs):
return "\n\n".join([d.page_content for d in docs])
chain = (
{"context": retriever | format_docs, "question": RunnablePassthrough()}
| prompt
| model
| StrOutputParser()
)
response = chain.invoke("What do the besties think about Davos?")
print(response)
License
Distributed under the MIT License. See LICENSE.txt
for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
langchain_ragie-0.2.0.tar.gz
(3.3 kB
view details)
Built Distribution
File details
Details for the file langchain_ragie-0.2.0.tar.gz
.
File metadata
- Download URL: langchain_ragie-0.2.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40e94a028713c47b816ca6123beec90f5cce7886c39230ec7b7a44a5e3a5e43f |
|
MD5 | 2c8f0ab93756c3ea498973ed9fbe8b28 |
|
BLAKE2b-256 | bc714d1bc01e4a4a7dcd3c5d993dd0ae46a121d04bc5947a11bbcc7184cd743b |
File details
Details for the file langchain_ragie-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: langchain_ragie-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a4407c1cf50f72261d70c201a20df4dbeb90b5b18a7039df8a729c66e1cdb89 |
|
MD5 | 34470863f7195c4e564a83a8e729ea5e |
|
BLAKE2b-256 | 0317d716c1e29d3624efdd72f38c5d1813b3adbbd771a243a7a9c577a3231754 |