thinking-machine 0.1.6__tar.gz → 0.1.8__tar.gz
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.
- {thinking_machine-0.1.6/src/thinking_machine.egg-info → thinking_machine-0.1.8}/PKG-INFO +1 -10
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/README.md +0 -9
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/pyproject.toml +2 -1
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/cli.py +2 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/machine.py +21 -1
- thinking_machine-0.1.8/src/thinking_machine/providers/light.py +79 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8/src/thinking_machine.egg-info}/PKG-INFO +1 -10
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine.egg-info/SOURCES.txt +1 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine.egg-info/entry_points.txt +1 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/LICENSE +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/MANIFEST.in +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/setup.cfg +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/__init__.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/config.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/githf.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/machina.yaml +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/providers/__init__.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/providers/basta.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/providers/camelids.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/providers/castor_pollux.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/providers/depsek.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/providers/electroid.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/providers/openai.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/providers/qrog.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/providers/strangelove.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/utilities.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine.egg-info/dependency_links.txt +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine.egg-info/requires.txt +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine.egg-info/top_level.txt +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/tests/test_cli.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/tests/test_e2e.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/tests/test_llm_soup.py +0 -0
- {thinking_machine-0.1.6 → thinking_machine-0.1.8}/tests/test_utilities.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: thinking-machine
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
4
4
|
Summary: A Machine that thinks.
|
|
5
5
|
Author-email: Machina Ratiocinatrix <machina.ratio@gmail.com>, Alexander Fedotov <alex.fedotov@aol.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/machina-ratiocinatrix/thinking-machine
|
|
@@ -42,15 +42,6 @@ Or:
|
|
|
42
42
|
```bash
|
|
43
43
|
thinking-machine multilogue.txt > response.txt
|
|
44
44
|
```
|
|
45
|
-
Or:
|
|
46
|
-
```bash
|
|
47
|
-
thinking-machine -a multilogue.txt | vim
|
|
48
|
-
```
|
|
49
|
-
Or:
|
|
50
|
-
```bash
|
|
51
|
-
thinking-machine -a multilogue.txt > tmp && echo tmp > multilogue.txt
|
|
52
|
-
```
|
|
53
|
-
|
|
54
45
|
Or use it in your Python code:
|
|
55
46
|
```Python
|
|
56
47
|
# Python
|
|
@@ -26,15 +26,6 @@ Or:
|
|
|
26
26
|
```bash
|
|
27
27
|
thinking-machine multilogue.txt > response.txt
|
|
28
28
|
```
|
|
29
|
-
Or:
|
|
30
|
-
```bash
|
|
31
|
-
thinking-machine -a multilogue.txt | vim
|
|
32
|
-
```
|
|
33
|
-
Or:
|
|
34
|
-
```bash
|
|
35
|
-
thinking-machine -a multilogue.txt > tmp && echo tmp > multilogue.txt
|
|
36
|
-
```
|
|
37
|
-
|
|
38
29
|
Or use it in your Python code:
|
|
39
30
|
```Python
|
|
40
31
|
# Python
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "thinking-machine"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.8"
|
|
8
8
|
authors = [
|
|
9
9
|
{name="Machina Ratiocinatrix", email="machina.ratio@gmail.com"},
|
|
10
10
|
{name="Alexander Fedotov", email="alex.fedotov@aol.com"}
|
|
@@ -24,6 +24,7 @@ dependencies = [
|
|
|
24
24
|
|
|
25
25
|
[project.scripts]
|
|
26
26
|
thinking-machine = "thinking_machine.cli:run"
|
|
27
|
+
think = "thinking_machine.cli:run"
|
|
27
28
|
|
|
28
29
|
[project.urls]
|
|
29
30
|
"Homepage" = "https://github.com/machina-ratiocinatrix/thinking-machine"
|
|
@@ -106,6 +106,8 @@ def run():
|
|
|
106
106
|
else:
|
|
107
107
|
if config.provider == 'Baseten':
|
|
108
108
|
os.environ['BASETEN_API_KEY'] = args.provider_api_key
|
|
109
|
+
elif config.provider == 'Lightning':
|
|
110
|
+
os.environ['LIGHTNING_API_KEY'] = args.provider_api_key
|
|
109
111
|
else:
|
|
110
112
|
raise ValueError(f"Unsupported provider specified.")
|
|
111
113
|
|
|
@@ -161,7 +161,7 @@ def machine(plato_text, config, **kwargs):
|
|
|
161
161
|
try:
|
|
162
162
|
from .providers import basta
|
|
163
163
|
except ImportError:
|
|
164
|
-
print("
|
|
164
|
+
print("Baseten module is missing.", file=sys.stderr)
|
|
165
165
|
sys.exit(1)
|
|
166
166
|
|
|
167
167
|
thoughts, text = basta.respond(
|
|
@@ -172,6 +172,26 @@ def machine(plato_text, config, **kwargs):
|
|
|
172
172
|
|
|
173
173
|
return thoughts, text
|
|
174
174
|
|
|
175
|
+
elif provider == 'Lightning':
|
|
176
|
+
# Transform plato_text to CMJ format
|
|
177
|
+
messages = plato_text_to_cmj(plato_text=plato_text,
|
|
178
|
+
machine_name=name)
|
|
179
|
+
# Call OpenAI API via opehaina
|
|
180
|
+
environ['LIGHTNING_API_KEY'] = api_key
|
|
181
|
+
try:
|
|
182
|
+
from .providers import light
|
|
183
|
+
except ImportError:
|
|
184
|
+
print("Lightning module is missing.", file=sys.stderr)
|
|
185
|
+
sys.exit(1)
|
|
186
|
+
|
|
187
|
+
thoughts, text = light.respond(
|
|
188
|
+
messages=messages,
|
|
189
|
+
instructions=system_prompt,
|
|
190
|
+
**kwargs
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
return thoughts, text
|
|
194
|
+
|
|
175
195
|
elif provider == 'Meta':
|
|
176
196
|
# Transform plato_text to CMJ format
|
|
177
197
|
messages = plato_text_to_cmj(plato_text=plato_text,
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Python
|
|
3
|
+
|
|
4
|
+
"""Copyright (c) Alexander Fedotov.
|
|
5
|
+
This source code is licensed under the license found in the
|
|
6
|
+
LICENSE file in the root directory of this source tree.
|
|
7
|
+
"""
|
|
8
|
+
import urllib.request
|
|
9
|
+
import urllib.error
|
|
10
|
+
import json
|
|
11
|
+
from os import environ
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def respond(messages, instructions, **kwargs):
|
|
15
|
+
"""
|
|
16
|
+
"""
|
|
17
|
+
api_key = environ.get("LIGHTNING_API_KEY")
|
|
18
|
+
api_base = environ.get("LIGHTNING_API_BASE", "https://lightning.ai/api/v1")
|
|
19
|
+
default_model = environ.get("LIGHTNING_DEFAULT_MODEL", "openai/gpt-5.5-2026-04-23")
|
|
20
|
+
|
|
21
|
+
instruction = kwargs.get('system_instruction', instructions)
|
|
22
|
+
first_message = [dict(role='system', content=instruction)] if instruction else []
|
|
23
|
+
|
|
24
|
+
# add contents and user text to the first (instruction) message
|
|
25
|
+
first_message.extend(messages)
|
|
26
|
+
instruction_and_contents = first_message
|
|
27
|
+
|
|
28
|
+
# Define the payload
|
|
29
|
+
payload = {
|
|
30
|
+
"model": kwargs.get("model", default_model),
|
|
31
|
+
"messages": instruction_and_contents,
|
|
32
|
+
"max_completion_tokens": kwargs.get("max_tokens", 32000),
|
|
33
|
+
"temperature": kwargs.get("temperature", 1.0),
|
|
34
|
+
"reasoning_effort": kwargs.get("reasoning_effort", "xhigh"),
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
# Convert data dictionary to JSON and encode it to bytes
|
|
38
|
+
data_bytes = json.dumps(payload).encode('utf-8')
|
|
39
|
+
|
|
40
|
+
# Set the mandatory headers
|
|
41
|
+
headers = {
|
|
42
|
+
"Content-Type": "application/json",
|
|
43
|
+
"Authorization": f"Bearer {api_key}",
|
|
44
|
+
"User-Agent": "Thinking-Machine"
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# Create the Request object
|
|
48
|
+
req = urllib.request.Request(
|
|
49
|
+
f'{api_base}/chat/completions',
|
|
50
|
+
data=data_bytes,
|
|
51
|
+
headers=headers,
|
|
52
|
+
method="POST")
|
|
53
|
+
|
|
54
|
+
try:
|
|
55
|
+
# Execute the request
|
|
56
|
+
with urllib.request.urlopen(req, timeout=300) as response:
|
|
57
|
+
response_data = response.read().decode('utf-8')
|
|
58
|
+
output = json.loads(response_data)
|
|
59
|
+
message = output['choices'][0]['message']
|
|
60
|
+
text = message['content']
|
|
61
|
+
thoughts = message.get('reasoning_content', '')
|
|
62
|
+
|
|
63
|
+
return thoughts, text
|
|
64
|
+
|
|
65
|
+
except urllib.error.HTTPError as e:
|
|
66
|
+
# Handle HTTP errors (e.g., 401 Unauthorized, 400 Bad Request)
|
|
67
|
+
error_info = e.read().decode('utf-8', errors='ignore')
|
|
68
|
+
print(f"HTTP Error {e.code}: {e.reason}")
|
|
69
|
+
print(f"Error Details: {error_info}")
|
|
70
|
+
return '', ''
|
|
71
|
+
|
|
72
|
+
except urllib.error.URLError as e:
|
|
73
|
+
# Handle network/connection errors
|
|
74
|
+
print(f"Failed to reach the server: {e.reason}")
|
|
75
|
+
return '', ''
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
if __name__ == '__main__':
|
|
79
|
+
...
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: thinking-machine
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
4
4
|
Summary: A Machine that thinks.
|
|
5
5
|
Author-email: Machina Ratiocinatrix <machina.ratio@gmail.com>, Alexander Fedotov <alex.fedotov@aol.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/machina-ratiocinatrix/thinking-machine
|
|
@@ -42,15 +42,6 @@ Or:
|
|
|
42
42
|
```bash
|
|
43
43
|
thinking-machine multilogue.txt > response.txt
|
|
44
44
|
```
|
|
45
|
-
Or:
|
|
46
|
-
```bash
|
|
47
|
-
thinking-machine -a multilogue.txt | vim
|
|
48
|
-
```
|
|
49
|
-
Or:
|
|
50
|
-
```bash
|
|
51
|
-
thinking-machine -a multilogue.txt > tmp && echo tmp > multilogue.txt
|
|
52
|
-
```
|
|
53
|
-
|
|
54
45
|
Or use it in your Python code:
|
|
55
46
|
```Python
|
|
56
47
|
# Python
|
|
@@ -21,6 +21,7 @@ src/thinking_machine/providers/camelids.py
|
|
|
21
21
|
src/thinking_machine/providers/castor_pollux.py
|
|
22
22
|
src/thinking_machine/providers/depsek.py
|
|
23
23
|
src/thinking_machine/providers/electroid.py
|
|
24
|
+
src/thinking_machine/providers/light.py
|
|
24
25
|
src/thinking_machine/providers/openai.py
|
|
25
26
|
src/thinking_machine/providers/qrog.py
|
|
26
27
|
src/thinking_machine/providers/strangelove.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/providers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/providers/camelids.py
RENAMED
|
File without changes
|
{thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/providers/castor_pollux.py
RENAMED
|
File without changes
|
|
File without changes
|
{thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/providers/electroid.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine/providers/strangelove.py
RENAMED
|
File without changes
|
|
File without changes
|
{thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine.egg-info/requires.txt
RENAMED
|
File without changes
|
{thinking_machine-0.1.6 → thinking_machine-0.1.8}/src/thinking_machine.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|