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
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.3.2.tar.gz
(3.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_ragie-0.3.2.tar.gz.
File metadata
- Download URL: langchain_ragie-0.3.2.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/24.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52b17d118da021e1bcfc581fc7987a0a006a0c2cdfd0a6501083d15325081982
|
|
| MD5 |
8a0de9d531d552e0a343e4e98374f4a3
|
|
| BLAKE2b-256 |
7e6973f1bfbded0ba94b89c19540aaaf2e37d1628145b00357a6b466725aaa7f
|
File details
Details for the file langchain_ragie-0.3.2-py3-none-any.whl.
File metadata
- Download URL: langchain_ragie-0.3.2-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Darwin/24.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8499ce2051cfd6af7fe477e9874d31a519f660a9c81e001fa2461b0acc1d9da9
|
|
| MD5 |
dfacdb918aac855c1893d6931707a4a0
|
|
| BLAKE2b-256 |
adfd9e7e688256798040ceb39f47f466f9fff531f4700600e41166ba39ae14fc
|