electroid 0.0.1__tar.gz → 0.0.2__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: electroid
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Anthropomorphized electric power consumption.
5
5
  Author-email: Alexander Fedotov <alex.fedotov@aol.com>
6
6
  Project-URL: Homepage, https://github.com/alxfed/electroid
@@ -14,7 +14,7 @@ License-File: LICENSE
14
14
  Dynamic: license-file
15
15
 
16
16
  # Electroid
17
- `electroid` is a Python library.
17
+ `electroid` is a Python library utilizing the anthropomorphized electric power consumption for tasks at hand.
18
18
  <pre>
19
19
  pip install electroid
20
20
  </pre>
@@ -0,0 +1,10 @@
1
+ # Electroid
2
+ `electroid` is a Python library utilizing the anthropomorphized electric power consumption for tasks at hand.
3
+ <pre>
4
+ pip install electroid
5
+ </pre>
6
+ Then:
7
+ ```Python
8
+ # Python
9
+ import electroid
10
+ ```
@@ -3,7 +3,7 @@ requires = ["setuptools>=67.0"]
3
3
  build-backend = "setuptools.build_meta"
4
4
  [project]
5
5
  name = "electroid"
6
- version = "0.0.1"
6
+ version = "0.0.2"
7
7
  authors = [
8
8
  {name="Alexander Fedotov", email="alex.fedotov@aol.com"},
9
9
  ]
@@ -0,0 +1,61 @@
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
+ from os import environ
9
+ import requests
10
+
11
+ api_key = environ.get("ANTHROPIC_API_KEY")
12
+ organization = environ.get("ANTHROPIC_ORGANIZATION", "")
13
+ api_base = environ.get("ANTHROPIC_API_BASE", "https://api.anthropic.com/v1")
14
+ api_type = environ.get("ANTHROPIC_VERSION", "2023-06-01")
15
+ default_model = environ.get("ANTHROPIC_DEFAULT_MODEL", 'claude-haiku-4-5-20251001')
16
+ message_model = environ.get("ANTHROPIC_MESSAGE_MODEL",'claude-sonnet-4-5-20250929')
17
+ # claude-3-opus-20240229, claude-3-sonnet-20240229
18
+
19
+ headers = {
20
+ "x-api-key": api_key,
21
+ "anthropic-version": "2023-06-01",
22
+ "content-type": "application/json"
23
+ }
24
+
25
+
26
+ def messages(messages=None, **kwargs):
27
+ """ All parameters should be in kwargs, but they are optional
28
+ """
29
+ json_data = {
30
+ "model": kwargs.get("model", message_model),
31
+ "system": kwargs.get("system", "answer concisely"),
32
+ "messages": messages,
33
+ "max_tokens": kwargs.get("max_tokens", 1),
34
+ "stop_sequences": kwargs.get("stop_sequences",['stop']),
35
+ "stream": kwargs.get("stream", False),
36
+ "temperature": kwargs.get("temperature", 0.5),
37
+ "top_k": kwargs.get("top_k", 250),
38
+ "top_p": kwargs.get("top_p", 0.5),
39
+ "metadata": kwargs.get("metadata", None)
40
+ }
41
+ try:
42
+ response = requests.post(
43
+ f"{api_base}/messages",
44
+ headers=headers,
45
+ json=json_data,
46
+ )
47
+ if response.status_code == requests.codes.ok:
48
+ dump = response.json()
49
+ else:
50
+ print(f"Request status code: {response.status_code}")
51
+ return None
52
+ return dump.get("content")
53
+
54
+ except Exception as e:
55
+ print("Unable to generate Message response")
56
+ print(f"Exception: {e}")
57
+ return None
58
+
59
+
60
+ if __name__ == "__main__":
61
+ print("you launched main.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: electroid
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Anthropomorphized electric power consumption.
5
5
  Author-email: Alexander Fedotov <alex.fedotov@aol.com>
6
6
  Project-URL: Homepage, https://github.com/alxfed/electroid
@@ -14,7 +14,7 @@ License-File: LICENSE
14
14
  Dynamic: license-file
15
15
 
16
16
  # Electroid
17
- `electroid` is a Python library.
17
+ `electroid` is a Python library utilizing the anthropomorphized electric power consumption for tasks at hand.
18
18
  <pre>
19
19
  pip install electroid
20
20
  </pre>
@@ -2,6 +2,7 @@ LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
4
  src/electroid/__init__.py
5
+ src/electroid/roid.py
5
6
  src/electroid.egg-info/PKG-INFO
6
7
  src/electroid.egg-info/SOURCES.txt
7
8
  src/electroid.egg-info/dependency_links.txt
electroid-0.0.1/README.md DELETED
@@ -1,10 +0,0 @@
1
- # Electroid
2
- `electroid` is a Python library.
3
- <pre>
4
- pip install electroid
5
- </pre>
6
- Then:
7
- ```Python
8
- # Python
9
- import electroid
10
- ```
File without changes
File without changes