psycopol-synth analyzes psychological-political theories, extracting concepts and relationships to provide clear structured summaries.
Project description
psycopol-synth
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_keyto increase the quota.
Issues & Support
Please report bugs or submit feature requests at
https://github.com/chigwell/psycopol-synth/issues.
Author
- Eugene Evstafev
- Email: hi@euegne.plus
- GitHub: https://github.com/chigwell
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file psycopol_synth-2025.12.22081424.tar.gz.
File metadata
- Download URL: psycopol_synth-2025.12.22081424.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30050c3d75f48c8a46dcea8a9bfa25a595fa1e626185ea190eddfcc81fc650b9
|
|
| MD5 |
741e874eb3be0690ff84ee3b9098c046
|
|
| BLAKE2b-256 |
62586ed89bd9362cfc3fcd568365f3fed25c23d4780c83119ecebe36bf74decf
|
File details
Details for the file psycopol_synth-2025.12.22081424-py3-none-any.whl.
File metadata
- Download URL: psycopol_synth-2025.12.22081424-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21551835a9503a3cb628e869e6f58d5f639412c45edaea472fa7e68c762e31cb
|
|
| MD5 |
2e540056f05c3fcc41d9bdf54ae2329d
|
|
| BLAKE2b-256 |
6035701717f41eee65f9d833b6a9c5447360ccab3b0454535674285f683905ca
|