thoughtflow 0.0.2__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
@@ -7,25 +7,54 @@ Core Philosophy:
7
7
  - Portability: Works across OpenAI, Anthropic, local models, serverless
8
8
  - Deterministic testing: Record/replay workflows, stable sessions
9
9
 
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
+
10
16
  Basic Usage:
11
- >>> from thoughtflow import Agent
12
- >>> from thoughtflow.adapters import OpenAIAdapter
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!")
13
22
  >>>
14
- >>> adapter = OpenAIAdapter(api_key="...")
15
- >>> agent = Agent(adapter)
16
- >>> response = agent.call([
17
- ... {"role": "user", "content": "Hello!"}
18
- ... ])
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")
19
30
  """
20
31
 
21
32
  from __future__ import annotations
22
33
 
23
- # Core exports
24
- from thoughtflow.agent import Agent
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
25
55
  from thoughtflow.message import Message, MessageList
26
56
 
27
- # Submodule access
28
- from thoughtflow import adapters
57
+ # Submodule access (keep tools, trace, eval for advanced usage)
29
58
  from thoughtflow import tools
30
59
  from thoughtflow import memory
31
60
  from thoughtflow import trace
@@ -41,12 +70,26 @@ except Exception:
41
70
 
42
71
  # Public API
43
72
  __all__ = [
44
- # Core
45
- "Agent",
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
46
87
  "Message",
47
88
  "MessageList",
89
+ # Deprecated
90
+ "Agent",
91
+ "TracedAgent",
48
92
  # Submodules
49
- "adapters",
50
93
  "tools",
51
94
  "memory",
52
95
  "trace",