thinking-machine 0.1.6__tar.gz → 0.1.7__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.
Files changed (33) hide show
  1. {thinking_machine-0.1.6/src/thinking_machine.egg-info → thinking_machine-0.1.7}/PKG-INFO +1 -1
  2. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/pyproject.toml +1 -1
  3. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/cli.py +2 -0
  4. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/machine.py +21 -1
  5. thinking_machine-0.1.7/src/thinking_machine/providers/light.py +82 -0
  6. {thinking_machine-0.1.6 → thinking_machine-0.1.7/src/thinking_machine.egg-info}/PKG-INFO +1 -1
  7. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine.egg-info/SOURCES.txt +1 -0
  8. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/LICENSE +0 -0
  9. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/MANIFEST.in +0 -0
  10. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/README.md +0 -0
  11. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/setup.cfg +0 -0
  12. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/__init__.py +0 -0
  13. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/config.py +0 -0
  14. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/githf.py +0 -0
  15. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/machina.yaml +0 -0
  16. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/providers/__init__.py +0 -0
  17. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/providers/basta.py +0 -0
  18. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/providers/camelids.py +0 -0
  19. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/providers/castor_pollux.py +0 -0
  20. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/providers/depsek.py +0 -0
  21. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/providers/electroid.py +0 -0
  22. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/providers/openai.py +0 -0
  23. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/providers/qrog.py +0 -0
  24. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/providers/strangelove.py +0 -0
  25. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine/utilities.py +0 -0
  26. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine.egg-info/dependency_links.txt +0 -0
  27. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine.egg-info/entry_points.txt +0 -0
  28. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine.egg-info/requires.txt +0 -0
  29. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/src/thinking_machine.egg-info/top_level.txt +0 -0
  30. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/tests/test_cli.py +0 -0
  31. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/tests/test_e2e.py +0 -0
  32. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/tests/test_llm_soup.py +0 -0
  33. {thinking_machine-0.1.6 → thinking_machine-0.1.7}/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.6
3
+ Version: 0.1.7
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "thinking-machine"
7
- version = "0.1.6"
7
+ version = "0.1.7"
8
8
  authors = [
9
9
  {name="Machina Ratiocinatrix", email="machina.ratio@gmail.com"},
10
10
  {name="Alexander Fedotov", email="alex.fedotov@aol.com"}
@@ -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("openai module is missing.", file=sys.stderr)
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,82 @@
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("LIGHNING_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_tokens": kwargs.get("max_tokens", 32000),
33
+ "temperature": kwargs.get("temperature", 1.0),
34
+ "reasoning_effort": kwargs.get("reasoning_effort", "high"),
35
+ "thinking": {
36
+ "type": "enabled"
37
+ }
38
+ }
39
+
40
+ # Convert data dictionary to JSON and encode it to bytes
41
+ data_bytes = json.dumps(payload).encode('utf-8')
42
+
43
+ # Set the mandatory headers
44
+ headers = {
45
+ "Content-Type": "application/json",
46
+ "Authorization": f"Bearer {api_key}",
47
+ "User-Agent": "Thinking-Machine"
48
+ }
49
+
50
+ # Create the Request object
51
+ req = urllib.request.Request(
52
+ f'{api_base}/chat/completions',
53
+ data=data_bytes,
54
+ headers=headers,
55
+ method="POST")
56
+
57
+ try:
58
+ # Execute the request
59
+ with urllib.request.urlopen(req, timeout=300) as response:
60
+ response_data = response.read().decode('utf-8')
61
+ output = json.loads(response_data)
62
+ message = output['choices'][0]['message']
63
+ text = message['content']
64
+ thoughts = message['reasoning_content']
65
+
66
+ return thoughts, text
67
+
68
+ except urllib.error.HTTPError as e:
69
+ # Handle HTTP errors (e.g., 401 Unauthorized, 400 Bad Request)
70
+ error_info = e.read().decode('utf-8', errors='ignore')
71
+ print(f"HTTP Error {e.code}: {e.reason}")
72
+ print(f"Error Details: {error_info}")
73
+ return '', ''
74
+
75
+ except urllib.error.URLError as e:
76
+ # Handle network/connection errors
77
+ print(f"Failed to reach the server: {e.reason}")
78
+ return '', ''
79
+
80
+
81
+ if __name__ == '__main__':
82
+ ...
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: thinking-machine
3
- Version: 0.1.6
3
+ Version: 0.1.7
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
@@ -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