machine-thinking 0.0.4__tar.gz → 0.0.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: machine-thinking
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: Calling the API of 'Thinking-Machines Lab' models without dependencies.
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/machine-thinking
@@ -3,7 +3,7 @@ requires = ["setuptools>=67.0"]
3
3
  build-backend = "setuptools.build_meta"
4
4
  [project]
5
5
  name = "machine-thinking"
6
- version = "0.0.4"
6
+ version = "0.0.6"
7
7
  authors = [
8
8
  {name="Machina Ratiocinatrix", email="machina.ratio@gmail.com"},
9
9
  {name="Alexander Fedotov", email="alex.fedotov@aol.com"}
@@ -9,7 +9,8 @@ from .utils import (query,
9
9
  default_model,
10
10
  get_function,
11
11
  get_func_args,
12
- call_function)
12
+ call_function,
13
+ api_base_ant)
13
14
 
14
15
 
15
16
  def get_weather(location):
@@ -45,7 +46,7 @@ def message(messages=None, instructions=None, tools=None, **kwargs):
45
46
  payload['tool_choice'] = 'auto'
46
47
 
47
48
  while True:
48
- result = query(payload, '/messages')
49
+ result = query(payload, '/messages', api_base_ant)
49
50
  completion_message = result['choices'][0]['message']
50
51
  messages.append(completion_message)
51
52
  thoughts = completion_message.get('reasoning_content', '')
@@ -13,7 +13,8 @@ from os import environ
13
13
 
14
14
  api_key = environ.get("TINKER_API_KEY", '')
15
15
  default_model = environ.get("TINKER_DEFAULT_MODEL", 'thinkingmachines/Inkling')
16
- api_base = environ.get("TINKER_API_BASE", 'https://tinker.thinkingmachines.dev/services/tinker-prod/oai/api/v1')
16
+ api_base_oai = environ.get("TINKER_OAI_API_BASE", 'https://tinker.thinkingmachines.dev/services/tinker-prod/oai/api/v1')
17
+ api_base_ant = environ.get("TINKER_ANT_API_BASE", 'https://tinker.thinkingmachines.dev/services/tinker-prod/anthropic/api/v1')
17
18
 
18
19
 
19
20
  # Set the mandatory headers
@@ -72,8 +73,12 @@ def call_function(func, func_args):
72
73
  return result
73
74
 
74
75
 
75
- def query(payload, url_suffix):
76
+ def query(payload, url_suffix, url_prefix=None):
76
77
  # Convert data dictionary to JSON and encode it to bytes
78
+ if url_prefix:
79
+ api_base = url_prefix
80
+ else:
81
+ api_base= api_base_oai
77
82
  data_bytes = json.dumps(payload).encode('utf-8')
78
83
  # Create the Request object
79
84
  req = urllib.request.Request(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: machine-thinking
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: Calling the API of 'Thinking-Machines Lab' models without dependencies.
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/machine-thinking