Skip to main content

LangChain helpers for working with Logseq documents

Project description

Langchain Logseq

Collection of Langchain utilities for working with Logseq files.


Components

This section provides an overview of the components provided, listed by type

Retrievers

Retrievers inject context into a conversation. Works in tandem with a Contextualizer and Document Loader.

  • Input:
    • natural-language user-input, usually query-like
    • (optional) chat history
  • Output:
    • list of Documents to provide context for an LLM to answer the user-input

Implementations

  • LogseqJournalDateRangeRetriever
    • retrieve Logseq journal Documents, intended for queries that require context from a date range
    • required to set up:
      • RetrieverContextualizer
      • LogseqJournalLoader
    • examples:
      • "What did I do over Christmas break 2024?"
      • "How did I spend the last Independence Day?"

Contextualizers

Contextualizers serve as the bridge between natural-language input and a downstream component that handles fetching of relevant Documents.

  • Input:
    • natural-language user-input, usually query-like
    • (optional) chat history
  • Output:
    • structured downstream query, based on

In this library, an instance of RetrieverContextualizer is provided directly to Retrievers during the latter's instantiation. To set up the RetrieverContextualizer, provide RetrieverContextualizerProps, which includes:

  • llm - this is the backbone of the contextualizer
  • prompt - instructions provided to the LLM
  • output_schema - (optional) structured schema used to fetch relevant Documents
    • if no schema is provided, a string shall be returned instead
  • other flags and settings

Loaders

Loaders are one type of component that can fetch relevant Documents. Loaders are typically specific to a corresponding Retriever component.

  • Input:
    • each loader specifies its own schema
      • the Contextualizer is usually responsible for creating an instance of the query obj to act upon
  • Output:
    • list[Document]

Implementations

  • LogseqJournalFilesystemLoader
    • loads from the filesystem, where journal files are expected to be present at specified path

Scripts

PGVector

upload_journal

usage: python scripts/upload_journal_to_pgvector.py [-h] [-p PATH] from_date to_date

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_logseq-0.2.5.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_logseq-0.2.5-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file langchain_logseq-0.2.5.tar.gz.

File metadata

  • Download URL: langchain_logseq-0.2.5.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for langchain_logseq-0.2.5.tar.gz
Algorithm Hash digest
SHA256 6e62e0f224f1ee038fac7d08ac3f83fb1a3dcb1d2f97b0e425f07ea1b6ea17a4
MD5 4d496f263e490ba1773b2620bd60cb93
BLAKE2b-256 10bcc5258e7f8b5cf7b0e6c9fb0a12b6aa0bf6c910d5cd61d5ae7f7c160b4b1e

See more details on using hashes here.

File details

Details for the file langchain_logseq-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_logseq-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 572f500f0153765fe20ff709eff139a24e3492bbafd7bdedaf6b3bc9bed6ce7d
MD5 808c44780f361b741a83e3f3155c9d64
BLAKE2b-256 fa535b9eedb06bbf72bcebe918d224c646fb60142318ccde4be45b2af41eea5d

See more details on using hashes here.

Supported by

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