Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
OurBuilding Ambient Agents with LangGraph course is now available on LangChain Academy!
Open In ColabOpen on GitHub

Kinetica

This notebooks goes over how to load documents from Kinetica

%pip install gpudb==7.2.0.9
from langchain_community.document_loaders.kinetica_loaderimport KineticaLoader
API Reference:KineticaLoader
## Loading Environment Variables
import os

from dotenvimport load_dotenv
from langchain_community.vectorstoresimport(
KineticaSettings,
)

load_dotenv()
API Reference:KineticaSettings
# Kinetica needs the connection to the database.
# This is how to set it up.
HOST= os.getenv("KINETICA_HOST","http://127.0.0.1:9191")
USERNAME= os.getenv("KINETICA_USERNAME","")
PASSWORD= os.getenv("KINETICA_PASSWORD","")


defcreate_config()-> KineticaSettings:
return KineticaSettings(host=HOST, username=USERNAME, password=PASSWORD)
from langchain_community.document_loaders.kinetica_loaderimport KineticaLoader

# The following `QUERY` is an example which will not run; this
# needs to be substituted with a valid `QUERY` that will return
# data and the `SCHEMA.TABLE` combination must exist in Kinetica.

QUERY="select text, survey_id from SCHEMA.TABLE limit 10"
kinetica_loader= KineticaLoader(
QUERY,
HOST,
USERNAME,
PASSWORD,
)
kinetica_documents= kinetica_loader.load()
print(kinetica_documents)
API Reference:KineticaLoader
from langchain_community.document_loaders.kinetica_loaderimport KineticaLoader

# The following `QUERY` is an example which will not run; this
# needs to be substituted with a valid `QUERY` that will return
# data and the `SCHEMA.TABLE` combination must exist in Kinetica.

QUERY="select text, survey_id as source from SCHEMA.TABLE limit 10"
kl= KineticaLoader(
query=QUERY,
host=HOST,
username=USERNAME,
password=PASSWORD,
metadata_columns=["source"],
)
kinetica_documents= kl.load()
print(kinetica_documents)
API Reference:KineticaLoader

Related


[8]ページ先頭

©2009-2025 Movatter.jp