Skip to main content

LLM-chained psychological profile generator for fictional characters (Psygen revised).

Project description

psygen-revised

Python package implementing Psygen Revised: a three-stage (optional fourth) LLM pipeline that produces a structured psychological profile for a character from a natural-language query.

  • Schema: JSON Schema for each layer and the merged profile (package data).
  • Runner: ProfileGenerator chains axiom → intermediate → emergent calls, validates JSON, merges evidence.
  • Prompt surface: to_prompt_string() emits dialogue-ready text (20 emergent traits + coping style + role identity), capped at 600 characters per the design contract.

Install

pip install psygen-revised

With OpenAI client helper:

pip install psygen-revised[openai]

Quick use

import asyncio
from psygen_revised import ProfileGenerator, OpenAiLlmClient

async def main():
    client = OpenAiLlmClient.from_env()  # OPENAI_API_KEY
    gen = ProfileGenerator(client)
    profile = await gen.generate("Linus from Stardew Valley")
    print(profile.to_prompt_string())
    print(profile.to_json())

asyncio.run(main())

Custom LLM backend

Implement psygen_revised.protocols.LlmClient (complete(system, user) -> str) and pass it to ProfileGenerator.

CLI

psygen-generate "Linus from Stardew Valley" -o linus.json

Design

See DESIGN.md and PLAN.md in this directory.

License

MIT

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

psygen_revised-0.1.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

psygen_revised-0.1.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file psygen_revised-0.1.0.tar.gz.

File metadata

  • Download URL: psygen_revised-0.1.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for psygen_revised-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fdd5d6abc91628c6dce1f834fe8f5efa2034b7179aac369442b1172c5f1d42c3
MD5 2e29dc000853e5acdd5add6b33cba988
BLAKE2b-256 f7d6f87c844f9dac58dc507315a046dedbc5a94b62c7f58deaf26eb057c2a260

See more details on using hashes here.

File details

Details for the file psygen_revised-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: psygen_revised-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for psygen_revised-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1679b0f113fdce18aa7e3898987ca62ca79159f687ad1fae53dc4cdaaeb2ce5
MD5 d125ca4e89a27e3e8b801662bb20ef96
BLAKE2b-256 a1253278740e3ccf50eac1bd18dbd8469cb4320cbcb4a762e58d4703b037a62c

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