A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://python.langchain.com/docs/integrations/document_loaders/surrealdb/ below:

SurrealDB | 🦜️🔗 LangChain

SurrealDB

SurrealDB is an end-to-end cloud-native database designed for modern applications, including web, mobile, serverless, Jamstack, backend, and traditional applications. With SurrealDB, you can simplify your database and API infrastructure, reduce development time, and build secure, performant apps quickly and cost-effectively.

Key features of SurrealDB include:

View the features, the latest releases, and documentation.

This notebook shows how to use functionality related to the SurrealDBLoader.

Overview​

The SurrealDB Document Loader returns a list of Langchain Documents from a SurrealDB database.

The Document Loader takes the following optional parameters:

The output Document takes the following shape:

Document(
page_content=<json encoded string containing the result document>,
metadata={
'id': <document id>,
'ns': <namespace name>,
'db': <database_name>,
'table': <table name>,
... <additional fields from metadata property of the document>
}
)
Setup​

Uncomment the below cells to install surrealdb and langchain.


import nest_asyncio

nest_asyncio.apply()
import json

from langchain_community.document_loaders.surrealdb import SurrealDBLoader
loader = SurrealDBLoader(
dburl="ws://localhost:8000/rpc",
ns="langchain",
db="database",
table="documents",
db_user="root",
db_pass="root",
filter_criteria={},
)
docs = loader.load()
len(docs)
doc = docs[-1]
doc.metadata
{'id': 'documents:zzz434sa584xl3b4ohvk',
'source': '../../how_to/state_of_the_union.txt',
'ns': 'langchain',
'db': 'database',
'table': 'documents'}
page_content = json.loads(doc.page_content)
'When we use taxpayer dollars to rebuild America – we are going to Buy American: buy American products to support American jobs. \n\nThe federal government spends about $600 Billion a year to keep the country safe and secure. \n\nThere’s been a law on the books for almost a century \nto make sure taxpayers’ dollars support American jobs and businesses. \n\nEvery Administration says they’ll do it, but we are actually doing it. \n\nWe will buy American to make sure everything from the deck of an aircraft carrier to the steel on highway guardrails are made in America. \n\nBut to compete for the best jobs of the future, we also need to level the playing field with China and other competitors. \n\nThat’s why it is so important to pass the Bipartisan Innovation Act sitting in Congress that will make record investments in emerging technologies and American manufacturing. \n\nLet me give you one example of why it’s so important to pass it.'

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4