electroid 0.0.1__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.
- electroid/roid.py +61 -0
- {electroid-0.0.1.dist-info → electroid-0.0.3.dist-info}/METADATA +2 -2
- electroid-0.0.3.dist-info/RECORD +7 -0
- electroid-0.0.1.dist-info/RECORD +0 -6
- {electroid-0.0.1.dist-info → electroid-0.0.3.dist-info}/WHEEL +0 -0
- {electroid-0.0.1.dist-info → electroid-0.0.3.dist-info}/licenses/LICENSE +0 -0
- {electroid-0.0.1.dist-info → electroid-0.0.3.dist-info}/top_level.txt +0 -0
electroid/roid.py
ADDED
|
@@ -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", default_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")['text']
|
|
53
|
+
|
|
54
|
+
except Exception as e:
|
|
55
|
+
print("Unable to generate Message response")
|
|
56
|
+
print(f"Exception: {e}")
|
|
57
|
+
return ''
|
|
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.
|
|
3
|
+
Version: 0.0.3
|
|
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,7 @@
|
|
|
1
|
+
electroid/__init__.py,sha256=4lVYZ3KJxbhfVGwdKCgEkaKd7oW9EXLbkDZNcN_dRlY,190
|
|
2
|
+
electroid/roid.py,sha256=vBVMse8UaTU-_rrJXwvI1S7CVX6BVQuB7XSBndGM1tk,2188
|
|
3
|
+
electroid-0.0.3.dist-info/licenses/LICENSE,sha256=BN2PMVuQzswbex0foJhVXSY4XI_Ud4o-Xc9knovYUeU,1074
|
|
4
|
+
electroid-0.0.3.dist-info/METADATA,sha256=19r2R2VyZD64T3dbMw0mdYC1-bL8G3Qv3q2hROkJVGM,755
|
|
5
|
+
electroid-0.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
6
|
+
electroid-0.0.3.dist-info/top_level.txt,sha256=BU7_9bsAnNBcS68Zosr6snSWTfBIbiWC0oLCY-WlUxk,10
|
|
7
|
+
electroid-0.0.3.dist-info/RECORD,,
|
electroid-0.0.1.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
electroid/__init__.py,sha256=4lVYZ3KJxbhfVGwdKCgEkaKd7oW9EXLbkDZNcN_dRlY,190
|
|
2
|
-
electroid-0.0.1.dist-info/licenses/LICENSE,sha256=BN2PMVuQzswbex0foJhVXSY4XI_Ud4o-Xc9knovYUeU,1074
|
|
3
|
-
electroid-0.0.1.dist-info/METADATA,sha256=CWE9NAD5fLicTWMzjSziHoUs8a_oh0p64jHnx12N3ik,678
|
|
4
|
-
electroid-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
-
electroid-0.0.1.dist-info/top_level.txt,sha256=BU7_9bsAnNBcS68Zosr6snSWTfBIbiWC0oLCY-WlUxk,10
|
|
6
|
-
electroid-0.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|