Skip to main content

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.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

langchain_ragie-0.3.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file langchain_ragie-0.3.0.tar.gz.

File metadata

  • Download URL: langchain_ragie-0.3.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

Hashes for langchain_ragie-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1350b7a5d73b732d23488519ec54fb15409e95b43380571096fd11d097e9ee5a
MD5 94da92fac6b9cbb0f852aafff9541fc2
BLAKE2b-256 42fa94d969bc995cd1d7d7a1af4fa7976a64c17b5f979716ad40a1070db8197f

See more details on using hashes here.

File details

Details for the file langchain_ragie-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: langchain_ragie-0.3.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

Hashes for langchain_ragie-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7c6805d053f0f2f4ccffdf1b5b60d5ae569cf04f83db3b118a705383c391501
MD5 fab21856481ec74460cd415b0db02d7d
BLAKE2b-256 e31e1587728c3ceceb6efc7a9853b799d3f825db8e18d4de483a2c2b14ff4603

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page