hcli-hai 3.0.0__tar.gz → 3.1.0__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 (32) hide show
  1. {hcli_hai-3.0.0/hcli_hai.egg-info → hcli_hai-3.1.0}/PKG-INFO +3 -3
  2. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/cli/context.py +0 -29
  3. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/cli/model.py +16 -2
  4. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/package.py +1 -1
  5. {hcli_hai-3.0.0 → hcli_hai-3.1.0/hcli_hai.egg-info}/PKG-INFO +3 -3
  6. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/pyproject.toml +2 -2
  7. hcli_hai-3.1.0/tests/test_hai.py +41 -0
  8. hcli_hai-3.0.0/tests/test_hai.py +0 -60
  9. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/LICENSE.txt +0 -0
  10. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/MANIFEST.in +0 -0
  11. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/README.rst +0 -0
  12. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/__init__.py +0 -0
  13. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/__main__.py +0 -0
  14. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/cli/__init__.py +0 -0
  15. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/cli/ai.py +0 -0
  16. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/cli/cli.py +0 -0
  17. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/cli/config.py +0 -0
  18. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/cli/logger.py +0 -0
  19. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/cli/template.json +0 -0
  20. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/cli/utils/formatting.py +0 -0
  21. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/cli/utils/hutils.py +0 -0
  22. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/cli/utils/summary.py +0 -0
  23. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/config.py +0 -0
  24. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/data/hcli_hai.1 +0 -0
  25. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai/hutils.py +0 -0
  26. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai.egg-info/SOURCES.txt +0 -0
  27. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai.egg-info/dependency_links.txt +0 -0
  28. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai.egg-info/entry_points.txt +0 -0
  29. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai.egg-info/requires.txt +0 -0
  30. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/hcli_hai.egg-info/top_level.txt +0 -0
  31. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/requirements.txt +0 -0
  32. {hcli_hai-3.0.0 → hcli_hai-3.1.0}/setup.cfg +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: hcli_hai
3
- Version: 3.0.0
3
+ Version: 3.1.0
4
4
  Summary: HCLI hai is a python package wrapper that contains an HCLI sample application (hai); hai is an HCLI for interacting with Anthropic's Claude or OpenAI's GPT AI models via terminal input and output streams.
5
- Author-email: Jeff Michaud <cometaj2@comcast.net>
5
+ Author-email: Jeff Michaud <cometaj2@proton.me>
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/cometaj2/hcli_hai
8
- Keywords: cli,client,server,connector,hypermedia,rest,generic,development
8
+ Keywords: ai,llm,cli,client,server,connector,hypermedia,rest,generic,development
9
9
  Classifier: Development Status :: 4 - Beta
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: Topic :: Software Development
@@ -123,35 +123,6 @@ class ContextManager:
123
123
  self.config = c.Config()
124
124
  self.context = self.get_context()
125
125
 
126
- # def __count(self):
127
- # with self.rlock:
128
- # encoding = tiktoken.get_encoding(self.encoding_base)
129
- #
130
- # self.message_tokens = 0
131
- # for item in self.context.messages:
132
- # if "content" in item:
133
- # self.message_tokens += len(encoding.encode(item["content"]))
134
- #
135
- # self.context_tokens = 0
136
- # for item in self.context.messages:
137
- # self.context_tokens += len(encoding.encode(json.dumps(item)))
138
- #
139
- # self.total_tokens = self.message_tokens + self.context_tokens
140
- # message = "Context tokens: " + str(self.total_tokens)
141
- # logging.info(message)
142
- #
143
- # if self.total_tokens > self.max_context_length:
144
- # return True
145
- #
146
- # return False
147
- #
148
- # def trim(self):
149
- # with self.rlock:
150
- # while(self.__count()):
151
- # self.context.messages.pop(1)
152
- # message = "Context tokens: " + str(self.total_tokens) + ". Trimming the oldest entries to remain under " + str(self.max_context_length) + " tokens."
153
- # logging.info(message)
154
-
155
126
  def trim(self):
156
127
  self.counter.trim(self.context)
157
128
 
@@ -1,10 +1,12 @@
1
+ # max_token controls and caps off the response size.
2
+
1
3
  models = {
2
4
  "claude-3-haiku-20240307": {
3
5
  'model' : "claude-3-haiku-20240307",
4
6
  'max_tokens' : 2048
5
7
  },
6
- "claude-3-5-haiku-22024102": {
7
- 'model' : "claude-3-haiku-20240307",
8
+ "claude-3-5-haiku-20241022": {
9
+ 'model' : "claude-3-5-haiku-20241022",
8
10
  'max_tokens' : 8192
9
11
  },
10
12
  "claude-3-5-haiku-latest": {
@@ -31,4 +33,16 @@ models = {
31
33
  'model' : "claude-3-opus-20240229",
32
34
  'max_tokens' : 4096
33
35
  },
36
+ "claude-3-7-sonnet-20250219": {
37
+ 'model' : "claude-3-7-sonnet-20250219",
38
+ 'max_tokens' : 8192
39
+ },
40
+ "claude-3-7-sonnet-latest": {
41
+ 'model' : "claude-3-7-sonnet-latest",
42
+ 'max_tokens' : 8192
43
+ },
44
+ "claude-3-sonnet-20240229": {
45
+ 'model' : "claude-3-sonnet-20240229",
46
+ 'max_tokens' : 4096
47
+ }
34
48
  }
@@ -1,3 +1,3 @@
1
- __version__ = "3.0.0"
1
+ __version__ = "3.1.0"
2
2
  dependencies = ["tiktoken==0.8.0",
3
3
  "anthropic==0.36.2"]
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: hcli_hai
3
- Version: 3.0.0
3
+ Version: 3.1.0
4
4
  Summary: HCLI hai is a python package wrapper that contains an HCLI sample application (hai); hai is an HCLI for interacting with Anthropic's Claude or OpenAI's GPT AI models via terminal input and output streams.
5
- Author-email: Jeff Michaud <cometaj2@comcast.net>
5
+ Author-email: Jeff Michaud <cometaj2@proton.me>
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/cometaj2/hcli_hai
8
- Keywords: cli,client,server,connector,hypermedia,rest,generic,development
8
+ Keywords: ai,llm,cli,client,server,connector,hypermedia,rest,generic,development
9
9
  Classifier: Development Status :: 4 - Beta
10
10
  Classifier: Intended Audience :: Developers
11
11
  Classifier: Topic :: Software Development
@@ -7,7 +7,7 @@ name = "hcli_hai"
7
7
  dynamic = ["version", "dependencies"]
8
8
  description="HCLI hai is a python package wrapper that contains an HCLI sample application (hai); hai is an HCLI for interacting with Anthropic's Claude or OpenAI's GPT AI models via terminal input and output streams."
9
9
  readme = "README.rst"
10
- authors = [{name = "Jeff Michaud", email = "cometaj2@comcast.net"}]
10
+ authors = [{name = "Jeff Michaud", email = "cometaj2@proton.me"}]
11
11
  license = {text = "MIT"}
12
12
  classifiers = [
13
13
  "Development Status :: 4 - Beta",
@@ -18,7 +18,7 @@ classifiers = [
18
18
  "Programming Language :: Python :: 3.11",
19
19
  "Programming Language :: Python :: 3.12"
20
20
  ]
21
- keywords = ["cli", "client", "server", "connector", "hypermedia", "rest", "generic", "development"]
21
+ keywords = ["ai", "llm", "cli", "client", "server", "connector", "hypermedia", "rest", "generic", "development"]
22
22
 
23
23
  [project.urls]
24
24
  Homepage = "https://github.com/cometaj2/hcli_hai"
@@ -0,0 +1,41 @@
1
+ import subprocess
2
+ import os
3
+ import pytest
4
+
5
+ def test_hai_context(gunicorn_server, cleanup):
6
+ hello = """
7
+ #!/bin/bash
8
+ set -x
9
+
10
+ export HUCKLE_HOME=~/.huckle_test
11
+ eval $(huckle env)
12
+
13
+ hai new > /dev/null 2>&1
14
+ hai context --json
15
+ """
16
+
17
+ p2 = subprocess.Popen(['bash', '-c', hello], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
18
+ out, err = p2.communicate()
19
+ error = err.decode('utf-8')
20
+ result = out.decode('utf-8')
21
+
22
+ assert('{\n "messages": [\n {\n "content": "",\n "role": "system"\n }\n ],\n "name": "",\n "title": ""\n}\n' == result)
23
+
24
+ def test_hai_name(gunicorn_server, cleanup):
25
+ hello = """
26
+ #!/bin/bash
27
+ set -x
28
+
29
+ export HUCKLE_HOME=~/.huckle_test
30
+ eval $(huckle env)
31
+
32
+ hai name set hello
33
+ hai name
34
+ """
35
+
36
+ p3 = subprocess.Popen(['bash', '-c', hello], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
37
+ out, err = p3.communicate()
38
+ error = err.decode('utf-8')
39
+ result = out.decode('utf-8')
40
+
41
+ assert('hello\n' == result)
@@ -1,60 +0,0 @@
1
- import subprocess
2
- import os
3
-
4
- def test_hai_context():
5
- setup = """
6
- #!/bin/bash
7
- set -x
8
-
9
- gunicorn --workers=1 --threads=1 "hcli_core:connector(\\"`hcli_hai path`\\")" --error-log ./error.log --daemon
10
- sleep 3
11
- huckle cli install http://127.0.0.1:8000
12
-
13
- cat ./error.log
14
- """
15
-
16
- p1 = subprocess.Popen(['bash', '-c', setup], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
17
- out, err = p1.communicate()
18
-
19
- error = err.decode('utf-8')
20
- result = out.decode('utf-8')
21
- print(error)
22
- print(result)
23
-
24
- hello = """
25
- #!/bin/bash
26
- set -x
27
-
28
- eval $(huckle env)
29
- hai new > /dev/null 2>&1
30
- hai context
31
- """
32
-
33
- p2 = subprocess.Popen(['bash', '-c', hello], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
34
- out, err = p2.communicate()
35
- error = err.decode('utf-8')
36
- result = out.decode('utf-8')
37
- print(error)
38
- print(result)
39
-
40
- assert(result == '{\n "messages": [\n {\n "content": "",\n "role": "system"\n }\n ],\n "name": "",\n "title": ""\n}')
41
-
42
- def test_hai_name():
43
- hello = """
44
- #!/bin/bash
45
- set -x
46
-
47
- eval $(huckle env)
48
- hai name set hello
49
- hai name
50
- ps aux | grep '[g]unicorn' | awk '{print $2}' | xargs kill
51
- """
52
-
53
- p3 = subprocess.Popen(['bash', '-c', hello], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
54
- out, err = p3.communicate()
55
- error = err.decode('utf-8')
56
- result = out.decode('utf-8')
57
- print(error)
58
- print(result)
59
-
60
- assert(result == 'hello')
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes