Skip to main content

narrativeparser

PyPI version License: MIT Downloads LinkedIn

A Python package for analyzing and understanding nuanced narratives by distinguishing between factual accounts and imaginative interpretations.

Installation

pip install narrativeparser

Usage

The package provides a function narrativeparser that processes input text and returns a structured representation separating factual and imaginative elements.

Basic Example

from narrativeparser import narrativeparser

user_input = "Your text to analyze here..."
result = narrativeparser(user_input)
print(result)

Using a Custom LLM

You can use any LangChain-compatible LLM by passing it to the llm parameter:

from langchain_openai import ChatOpenAI
from narrativeparser import narrativeparser

llm = ChatOpenAI()
user_input = "Your text to analyze here..."
response = narrativeparser(user_input, llm=llm)
from langchain_anthropic import ChatAnthropic
from narrativeparser import narrativeparser

llm = ChatAnthropic()
user_input = "Your text to analyze here..."
response = narrativeparser(user_input, llm=llm)
from langchain_google_genai import ChatGoogleGenerativeAI
from narrativeparser import narrativeparser

llm = ChatGoogleGenerativeAI()
user_input = "Your text to analyze here..."
response = narrativeparser(user_input, llm=llm)

API Key Configuration

The package uses ChatLLM7 by default. You can provide your API key in multiple ways:

  1. Via environment variable:
export LLM7_API_KEY="your_api_key_here"
  1. Directly in code:
from narrativeparser import narrativeparser

user_input = "Your text to analyze here..."
response = narrativeparser(user_input, api_key="your_api_key_here")

Get a free API key by registering at https://token.llm7.io/

Parameters

  • user_input (str): The text input to process
  • llm (Optional[BaseChatModel]): LangChain LLM instance (defaults to ChatLLM7)
  • api_key (Optional[str]): API key for LLM7 (if using default LLM)

Default LLM

The package uses ChatLLM7 by default, which provides sufficient rate limits for most use cases. For higher rate limits, provide your own API key.

Issues

Report issues and feature requests at GitHub Issues

Author

Eugene Evstafev - hi@euegne.plus

Metadata

Release files for narrativeparser 2025.12.21083854

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for narrativeparser 2025.12.21083854
File Size Uploaded
narrativeparser-2025.12.21083854.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for narrativeparser 2025.12.21083854
File Interpreter ABI Platform
narrativeparser-2025.12.21083854-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / narrativeparser-2025.12.21083854.tar.gz

Download URL narrativeparser-2025.12.21083854.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a844c6c208a13770a93d1aa64d029a1e1d460e2ddf09c6493a9a0f889b910ef1
BLAKE2b-256 checksum
How to use checksums
bd1ad8054bbde79d6f28125b54dc7ce1ff6ecf462b2b19736051987122d7749f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release files / narrativeparser-2025.12.21083854-py3-none-any.whl

Download URL narrativeparser-2025.12.21083854-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44551ae38461150bee788738617e3ad249a1770ef721c6ac049cda6243894c88
BLAKE2b-256 checksum
How to use checksums
9356fa9983a9a1695eaaaa755cdd5a910aa1f579e8d276fffa7e4c4701d58bfe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release history Release notifications | RSS feed

This release

2025.12.21083854 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page