Skip to main content

psycopol-synth

PyPI version License: MIT Downloads LinkedIn

A lightweight Python package for automatically extracting and summarizing key concepts from complex psychological and political theories.
Given a text excerpt or a summary of a theoretical work, psycopol_synth uses an LLM to identify post‑Freudian psychological ideas, their relationship to political dynamics, and the main arguments, critiques, and potential applications.

Features

  • Extracts concepts, relationships, and implications from dense theory texts.
  • Works with the free tier of LLM7 out of the box.
  • Accepts any LangChain chat model (OpenAI, Anthropic, Google Gemini …).
  • Returns a structured list of tokens that match a predefined regex pattern, guaranteeing consistent output for downstream processing.

Installation

pip install psycopol_synth

Quickstart

from psycopol_synth import psycopol_synth

text = """
In his critique of classical political theory, Freud argues that the emotional underpinnings of state ideology are rooted in subconscious desires. Contemporary scholars extend this view by incorporating psychoanalytic frameworks into analyses of political mobilization.
"""

# Using the default LLM7 provider
results = psycopol_synth(user_input=text)

# results is a list of extracted strings following the regex pattern
print(results)

Using a Custom LLM

psycopol_synth accepts any LangChain chat model.
Below are examples for several popular providers.

OpenAI

from langchain_openai import ChatOpenAI
from psycopol_synth import psycopol_synth

llm = ChatOpenAI()  # You can set `model_name`, `temperature`, etc.
response = psycopol_synth(user_input=text, llm=llm)

Anthropic

from langchain_anthropic import ChatAnthropic
from psycopol_synth import psycopol_synth

llm = ChatAnthropic()
response = psycopol_synth(user_input=text, llm=llm)

Google Gemini

from langchain_google_genai import ChatGoogleGenerativeAI
from psycopol_synth import psycopol_synth

llm = ChatGoogleGenerativeAI()
response = psycopol_synth(user_input=text, llm=llm)

Specifying an LLM7 API Key

The default ChatLLM7 instance uses the LLM7_API_KEY environment variable.
If you wish to supply the key directly:

response = psycopol_synth(user_input=text, api_key="your_llm7_api_key")

A free key can be obtained by registering at https://token.llm7.io/.

Function Signature

def psycopol_synth(
    user_input: str,
    api_key: Optional[str] = None,
    llm: Optional[BaseChatModel] = None
) -> List[str]
Parameter Type Description
user_input str The raw text or summary that you wish to analyze.
llm Optional[BaseChatModel] A LangChain chat model instance. If omitted, the function falls back to ChatLLM7.
api_key Optional[str] API key for the LLM7 provider. Ignored if a custom LLM is supplied.

Rate Limits & Performance

  • The free tier of LLM7 comfortably handles the majority of use cases.
  • If you exceed the default limits, simply provide your own api_key to increase the quota.

Issues & Support

Please report bugs or submit feature requests at
https://github.com/chigwell/psycopol-synth/issues.

Author

Metadata

Release files for psycopol-synth 2025.12.22081424

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

Source distribution (sdist)

Source distribution for psycopol-synth 2025.12.22081424
File Size Uploaded
psycopol_synth-2025.12.22081424.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for psycopol-synth 2025.12.22081424
File Interpreter ABI Platform
psycopol_synth-2025.12.22081424-py3-none-any.whl Python 3 none any Details

Total release size: 13.9 kB

Release files / psycopol_synth-2025.12.22081424.tar.gz

Download URL psycopol_synth-2025.12.22081424.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
30050c3d75f48c8a46dcea8a9bfa25a595fa1e626185ea190eddfcc81fc650b9
BLAKE2b-256 checksum
How to use checksums
62586ed89bd9362cfc3fcd568365f3fed25c23d4780c83119ecebe36bf74decf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release files / psycopol_synth-2025.12.22081424-py3-none-any.whl

Download URL psycopol_synth-2025.12.22081424-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
21551835a9503a3cb628e869e6f58d5f639412c45edaea472fa7e68c762e31cb
BLAKE2b-256 checksum
How to use checksums
6035701717f41eee65f9d833b6a9c5447360ccab3b0454535674285f683905ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

2025.12.22081424 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