cazuela 0.0.1__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.
cazuela-0.0.1/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2026, UH Robot House
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cazuela-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,20 @@
1
+ Metadata-Version: 2.4
2
+ Name: cazuela
3
+ Version: 0.0.1
4
+ Summary: Cazuela Server
5
+ Author-email: Patrick Holthaus <patrick.holthaus@googlemail.com>
6
+ License-Expression: BSD-2-Clause
7
+ Project-URL: Homepage, https://gitlab.com/robothouse/rh-user/cazuela/
8
+ Project-URL: Bug Tracker, https://gitlab.com/robothouse/rh-user/cazuela/issues/
9
+ Classifier: Programming Language :: Python
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: ollama
15
+ Requires-Dist: ztl
16
+ Dynamic: license-file
17
+
18
+ # Cazuela
19
+
20
+ Simple `ztl` Task Interface for AI. Currently supports `ollama` only.
@@ -0,0 +1,3 @@
1
+ # Cazuela
2
+
3
+ Simple `ztl` Task Interface for AI. Currently supports `ollama` only.
@@ -0,0 +1,23 @@
1
+ [project]
2
+ name = "cazuela"
3
+ version = "0.0.1"
4
+ authors = [
5
+ { name="Patrick Holthaus", email="patrick.holthaus@googlemail.com" },
6
+ ]
7
+ description = "Cazuela Server"
8
+ readme = "README.md"
9
+ license = "BSD-2-Clause"
10
+ license-files = [ "LICENSE" ]
11
+ requires-python = ">=3.10"
12
+ classifiers = [
13
+ "Programming Language :: Python",
14
+ "Operating System :: OS Independent"
15
+ ]
16
+ dependencies = [
17
+ "ollama",
18
+ "ztl"
19
+ ]
20
+
21
+ [project.urls]
22
+ "Homepage" = "https://gitlab.com/robothouse/rh-user/cazuela/"
23
+ "Bug Tracker" = "https://gitlab.com/robothouse/rh-user/cazuela/issues/"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import os
4
+ import argparse
5
+
6
+ from ztl.core.server import TaskServer
7
+ from ztl.core.protocol import State, Task
8
+ from ztl.core.task import ExecutableTask, TaskExecutor, TaskController
9
+
10
+ from ollama import Client
11
+
12
+
13
+ class OLLamaTask(ExecutableTask):
14
+
15
+ def __init__(self, client, request):
16
+ self.client = client
17
+ self.request = request
18
+
19
+ def execute(self):
20
+ response = self.client.chat(
21
+ model=self.request["component"],
22
+ messages=[
23
+ {
24
+ 'role': 'user',
25
+ 'content': self.request["goal"],
26
+ 'stream': False
27
+ },
28
+ ]
29
+ )
30
+ return response
31
+
32
+ def abort(self):
33
+ return False
34
+
35
+
36
+ class Controller(TaskController):
37
+
38
+ def __init__(self, remote):
39
+ self.current_id = 0
40
+ self.running = {}
41
+ self.client = Client(host=remote)
42
+
43
+ def init(self, request):
44
+ self.current_id += 1
45
+ request = Task.decode(request)
46
+ if request["handler"] == "ollama":
47
+ self.running[self.current_id] = TaskExecutor(OLLamaTask, self.client, request)
48
+ else:
49
+ raise RuntimeError("No such handler '%s'" % request["handler"])
50
+ return self.current_id, "Initiated task '%s' with request: %s" % (self.current_id, request)
51
+
52
+ def status(self, mid, request):
53
+ if mid in self.running:
54
+ state = self.running[mid].state()
55
+ return state, self.running[mid].result()
56
+ else:
57
+ return State.REJECTED, "Invalid ID '%s'" % mid
58
+
59
+ def abort(self, mid, request):
60
+ if mid in self.running:
61
+ success = self.running[mid].stop()
62
+ state = self.running[mid].state()
63
+ return state, success
64
+ else:
65
+ return State.REJECTED, "Invalid ID '%s'" % mid
66
+
67
+ def main_cli():
68
+
69
+ parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
70
+ parser.add_argument("-p", "--port", type=int,
71
+ help="The port to listen listen on.", default=5570)
72
+ parser.add_argument("-s", "--scope", type=str,
73
+ help="The scope that to respond to.", default="/prompt")
74
+ parser.add_argument("-l", "--ollama", type=str,
75
+ help="The OLLama instance address.", default=os.environ.get('OLLAMA_HOST', 'http://localhost:11434'))
76
+
77
+ args, unknown = parser.parse_known_args()
78
+
79
+ server = TaskServer(args.port)
80
+ server.register(args.scope, Controller(args.ollama))
81
+ server.listen()
82
+
83
+ if __name__ == "__main__":
84
+
85
+ main_cli()
@@ -0,0 +1,20 @@
1
+ Metadata-Version: 2.4
2
+ Name: cazuela
3
+ Version: 0.0.1
4
+ Summary: Cazuela Server
5
+ Author-email: Patrick Holthaus <patrick.holthaus@googlemail.com>
6
+ License-Expression: BSD-2-Clause
7
+ Project-URL: Homepage, https://gitlab.com/robothouse/rh-user/cazuela/
8
+ Project-URL: Bug Tracker, https://gitlab.com/robothouse/rh-user/cazuela/issues/
9
+ Classifier: Programming Language :: Python
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: ollama
15
+ Requires-Dist: ztl
16
+ Dynamic: license-file
17
+
18
+ # Cazuela
19
+
20
+ Simple `ztl` Task Interface for AI. Currently supports `ollama` only.
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/cazuela/cazuela.py
5
+ src/cazuela.egg-info/PKG-INFO
6
+ src/cazuela.egg-info/SOURCES.txt
7
+ src/cazuela.egg-info/dependency_links.txt
8
+ src/cazuela.egg-info/requires.txt
9
+ src/cazuela.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ ollama
2
+ ztl
@@ -0,0 +1 @@
1
+ cazuela