thoughtflow 0.0.1__py3-none-any.whl → 0.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
thoughtflow/__init__.py CHANGED
@@ -1,7 +1,99 @@
1
+ """
2
+ ThoughtFlow: A minimal, explicit, Pythonic substrate for LLM and agent systems.
1
3
 
2
- import numpy
3
- import numpy as np
4
- import pandas as pd
4
+ Core Philosophy:
5
+ - Tiny surface area: Few powerful primitives over many specialized classes
6
+ - Explicit state: All state is visible, serializable, and replayable
7
+ - Portability: Works across OpenAI, Anthropic, local models, serverless
8
+ - Deterministic testing: Record/replay workflows, stable sessions
5
9
 
6
- from .jtools1 import Sorter # Assuming you have a class named Sorter in jtools1.py
7
- from .jtools2 import Adder # Assuming you have a class named Adder in jtools2.py
10
+ Core Primitives:
11
+ - LLM: Multi-provider interface for language model calls
12
+ - MEMORY: Event-sourced state container (messages, logs, reflections, variables)
13
+ - THOUGHT: Unit of cognition (Prompt + Context + LLM + Parsing + Validation)
14
+ - ACTION: External operation wrapper with consistent logging
15
+
16
+ Basic Usage:
17
+ >>> from thoughtflow import LLM, MEMORY, THOUGHT
18
+ >>>
19
+ >>> llm = LLM("openai:gpt-4o", key="your-api-key")
20
+ >>> memory = MEMORY()
21
+ >>> memory.add_msg("user", "Hello!")
22
+ >>>
23
+ >>> thought = THOUGHT(
24
+ ... name="respond",
25
+ ... llm=llm,
26
+ ... prompt="Respond to the user message: {last_user_msg}"
27
+ ... )
28
+ >>> memory = thought(memory)
29
+ >>> result = memory.get_var("respond_result")
30
+ """
31
+
32
+ from __future__ import annotations
33
+
34
+ # Core primitives
35
+ from thoughtflow.llm import LLM
36
+ from thoughtflow.memory.base import MEMORY
37
+ from thoughtflow.thought import THOUGHT
38
+ from thoughtflow.action import ACTION
39
+
40
+ # Utilities
41
+ from thoughtflow._util import (
42
+ EventStamp,
43
+ event_stamp,
44
+ hashify,
45
+ construct_prompt,
46
+ construct_msgs,
47
+ valid_extract,
48
+ ValidExtractError,
49
+ )
50
+
51
+ # Deprecated (for backward compatibility)
52
+ from thoughtflow.agent import Agent, TracedAgent
53
+
54
+ # Keep message types for potential utility
55
+ from thoughtflow.message import Message, MessageList
56
+
57
+ # Submodule access (keep tools, trace, eval for advanced usage)
58
+ from thoughtflow import tools
59
+ from thoughtflow import memory
60
+ from thoughtflow import trace
61
+ from thoughtflow import eval
62
+
63
+ # Version
64
+ try:
65
+ from importlib.metadata import version as _get_version
66
+
67
+ __version__ = _get_version("thoughtflow")
68
+ except Exception:
69
+ __version__ = "0.0.0"
70
+
71
+ # Public API
72
+ __all__ = [
73
+ # Core Primitives
74
+ "LLM",
75
+ "MEMORY",
76
+ "THOUGHT",
77
+ "ACTION",
78
+ # Utilities
79
+ "EventStamp",
80
+ "event_stamp",
81
+ "hashify",
82
+ "construct_prompt",
83
+ "construct_msgs",
84
+ "valid_extract",
85
+ "ValidExtractError",
86
+ # Types
87
+ "Message",
88
+ "MessageList",
89
+ # Deprecated
90
+ "Agent",
91
+ "TracedAgent",
92
+ # Submodules
93
+ "tools",
94
+ "memory",
95
+ "trace",
96
+ "eval",
97
+ # Metadata
98
+ "__version__",
99
+ ]