The InterSystems IRIS adoption for Langchain
Project description
Langchain with InterSystems IRIS
Langchain with support for InterSystems IRIS
Install
pip install langchain-iris
Example
import os
from dotenv import load_dotenv
from langchain.docstore.document import Document
from langchain.document_loaders import TextLoader
from langchain.text_splitter import CharacterTextSplitter
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.embeddings import HuggingFaceEmbeddings
from langchain.embeddings.fastembed import FastEmbedEmbeddings
from langchain_iris import IRISVector
loader = TextLoader("state_of_the_union.txt")
documents = loader.load()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
docs = text_splitter.split_documents(documents)
CONNECTION_STRING = 'iris://_SYSTEM:SYS@localhost:1972/USER'
load_dotenv(override=True)
embeddings = OpenAIEmbeddings()
COLLECTION_NAME = "state_of_the_union_test"
db = IRISVector.from_documents(
embedding=embeddings,
documents=docs,
collection_name=COLLECTION_NAME,
connection_string=CONNECTION_STRING,
)
query = "What did the president say about Ketanji Brown Jackson"
docs_with_score = db.similarity_search_with_score(query)
for doc, score in docs_with_score:
print("-" * 80)
print("Score: ", score)
print(doc.page_content)
print("-" * 80)
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
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_iris-0.2.2.tar.gz.
File metadata
- Download URL: langchain_iris-0.2.2.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
687223c810e38dc8846bff9ad39d802343a0d10c70c8bf9ee0ecf849bdd9a737
|
|
| MD5 |
4a8f57cb965ca9b0afba2f9ed631618e
|
|
| BLAKE2b-256 |
19b79f293ef16a22268411969714c2b5ca1d0634c5dc08f41355791663554e19
|
Provenance
The following attestation bundles were made for langchain_iris-0.2.2.tar.gz:
Publisher:
main.yml on caretdev/langchain-iris
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_iris-0.2.2.tar.gz -
Subject digest:
687223c810e38dc8846bff9ad39d802343a0d10c70c8bf9ee0ecf849bdd9a737 - Sigstore transparency entry: 752769654
- Sigstore integration time:
-
Permalink:
caretdev/langchain-iris@7fbffd904dd26f8468bec0bbb7fb7d016aecfd70 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/caretdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@7fbffd904dd26f8468bec0bbb7fb7d016aecfd70 -
Trigger Event:
release
-
Statement type:
File details
Details for the file langchain_iris-0.2.2-py3-none-any.whl.
File metadata
- Download URL: langchain_iris-0.2.2-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25f2d58d2af66072d1bc5eff16dcc6b8ae813f5791d5dc0f6e6efacd26240f67
|
|
| MD5 |
b8ca5679374ef95e7126fde08a5aa805
|
|
| BLAKE2b-256 |
da8d55b01e82af298c159dfdb5cb39237e845c9d0a86763b758064674e77ffe6
|
Provenance
The following attestation bundles were made for langchain_iris-0.2.2-py3-none-any.whl:
Publisher:
main.yml on caretdev/langchain-iris
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_iris-0.2.2-py3-none-any.whl -
Subject digest:
25f2d58d2af66072d1bc5eff16dcc6b8ae813f5791d5dc0f6e6efacd26240f67 - Sigstore transparency entry: 752769655
- Sigstore integration time:
-
Permalink:
caretdev/langchain-iris@7fbffd904dd26f8468bec0bbb7fb7d016aecfd70 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/caretdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@7fbffd904dd26f8468bec0bbb7fb7d016aecfd70 -
Trigger Event:
release
-
Statement type: