cycls 0.0.2.40__tar.gz → 0.0.2.41__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: cycls
3
- Version: 0.0.2.40
3
+ Version: 0.0.2.41
4
4
  Summary: Cycls SDK
5
5
  Author: Mohammed J. AlRujayi
6
6
  Author-email: mj@cycls.com
@@ -53,8 +53,8 @@ This philosophy has a powerful side-effect: it makes development genuinely itera
53
53
  ## Key Features
54
54
 
55
55
  * ✨ **Zero-Config Deployment:** No YAML or Dockerfiles. `cycls` infers your dependencies, and APIs directly from your Python code.
56
- * 🚀 **One-Command Push to Cloud:** Go from local code to a globally scalable, serverless application with a single `agent.push()`.
57
- * 💻 **Instant Local Testing:** Run `agent.run()` to spin up a local server with hot-reloading for rapid iteration and debugging.
56
+ * 🚀 **One-Command Push to Cloud:** Go from local code to a globally scalable, serverless application with a single `agent.deploy()`.
57
+ * 💻 **Instant Local Testing:** Run `agent.local()` to spin up a local server with hot-reloading for rapid iteration and debugging.
58
58
  * 🤖 **OpenAI-Compatible API:** Automatically serves a streaming `/chat/completions` endpoint.
59
59
  * 🌐 **Automatic Web UI:** Get a clean, interactive front-end for your agent out of the box, with no front-end code required.
60
60
  * 🔐 **Built-in Authentication:** Secure your agent for production with a simple `auth=True` flag that enables JWT-based authentication.
@@ -83,7 +83,7 @@ agent = cycls.Agent()
83
83
  async def hello(context):
84
84
  yield "hi"
85
85
 
86
- agent.run()
86
+ agent.local()
87
87
  ```
88
88
 
89
89
  Run it from your terminal:
@@ -133,7 +133,7 @@ async def cake_agent(context):
133
133
  return await llm(context.messages)
134
134
 
135
135
  # Deploy the agent to the cloud
136
- agent.push(prod=True)
136
+ agent.deploy(prod=True)
137
137
  ```
138
138
 
139
139
  Run the deployment command from your terminal:
@@ -145,4 +145,3 @@ After a few moments, your agent will be live and accessible at a public URL like
145
145
 
146
146
  ### License
147
147
  This project is licensed under the MIT License.
148
-
@@ -31,8 +31,8 @@ This philosophy has a powerful side-effect: it makes development genuinely itera
31
31
  ## Key Features
32
32
 
33
33
  * ✨ **Zero-Config Deployment:** No YAML or Dockerfiles. `cycls` infers your dependencies, and APIs directly from your Python code.
34
- * 🚀 **One-Command Push to Cloud:** Go from local code to a globally scalable, serverless application with a single `agent.push()`.
35
- * 💻 **Instant Local Testing:** Run `agent.run()` to spin up a local server with hot-reloading for rapid iteration and debugging.
34
+ * 🚀 **One-Command Push to Cloud:** Go from local code to a globally scalable, serverless application with a single `agent.deploy()`.
35
+ * 💻 **Instant Local Testing:** Run `agent.local()` to spin up a local server with hot-reloading for rapid iteration and debugging.
36
36
  * 🤖 **OpenAI-Compatible API:** Automatically serves a streaming `/chat/completions` endpoint.
37
37
  * 🌐 **Automatic Web UI:** Get a clean, interactive front-end for your agent out of the box, with no front-end code required.
38
38
  * 🔐 **Built-in Authentication:** Secure your agent for production with a simple `auth=True` flag that enables JWT-based authentication.
@@ -61,7 +61,7 @@ agent = cycls.Agent()
61
61
  async def hello(context):
62
62
  yield "hi"
63
63
 
64
- agent.run()
64
+ agent.local()
65
65
  ```
66
66
 
67
67
  Run it from your terminal:
@@ -111,7 +111,7 @@ async def cake_agent(context):
111
111
  return await llm(context.messages)
112
112
 
113
113
  # Deploy the agent to the cloud
114
- agent.push(prod=True)
114
+ agent.deploy(prod=True)
115
115
  ```
116
116
 
117
117
  Run the deployment command from your terminal:
@@ -122,4 +122,4 @@ python main.py
122
122
  After a few moments, your agent will be live and accessible at a public URL like https://cake.cycls.ai.
123
123
 
124
124
  ### License
125
- This project is licensed under the MIT License.
125
+ This project is licensed under the MIT License.
@@ -47,7 +47,8 @@ class Agent:
47
47
  if len(self.registered_functions) > 1:
48
48
  print(f"⚠️ Warning: Multiple agents found. Running '{i['name']}'.")
49
49
  print(f"🚀 Starting local server at localhost:{port}")
50
- i["config"][0], i["config"][6] = self.theme, False
50
+ # i["config"][0], i["config"][6] = self.theme, False
51
+ i["config"][0] = self.theme
51
52
  uvicorn.run(web(i["func"], *i["config"]), host="0.0.0.0", port=port)
52
53
  return
53
54
 
@@ -63,7 +64,7 @@ class Agent:
63
64
  if len(self.registered_functions) > 1:
64
65
  print(f"⚠️ Warning: Multiple agents found. Running '{i['name']}'.")
65
66
 
66
- i["config"][6] = False
67
+ # i["config"][6] = False
67
68
 
68
69
  copy={str(self.theme):"public", str(cycls_path)+"/web.py":"web.py"}
69
70
  copy.update({i:i for i in self.copy})
@@ -1,6 +1,6 @@
1
1
  import json, inspect
2
2
 
3
- async def openai_encoder(stream): # clean up the meta data / new API?
3
+ async def async_openai_encoder(stream): # clean up the meta data / new API?
4
4
  async for message in stream:
5
5
  payload = {"id": "chatcmpl-123",
6
6
  "object": "chat.completion.chunk",
@@ -12,6 +12,18 @@ async def openai_encoder(stream): # clean up the meta data / new API?
12
12
  yield f"data: {json.dumps(payload)}\n\n"
13
13
  yield "data: [DONE]\n\n"
14
14
 
15
+ def openai_encoder(stream):
16
+ for message in stream:
17
+ payload = {"id": "chatcmpl-123",
18
+ "object": "chat.completion.chunk",
19
+ "created": 1728083325,
20
+ "model": "model-1-2025-01-01",
21
+ "system_fingerprint": "fp_123456",
22
+ "choices": [{"delta": {"content": message}}]}
23
+ if message:
24
+ yield f"data: {json.dumps(payload)}\n\n"
25
+ yield "data: [DONE]\n\n"
26
+
15
27
  test_auth_public_key = """
16
28
  -----BEGIN PUBLIC KEY-----
17
29
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyDudrDtQ5irw6hPWf2rw
@@ -89,7 +101,8 @@ def web(func, front_end_path="", prod=False, org=None, api_token=None, header=""
89
101
  context = Context(messages = messages, user = User(**user_data) if user_data else None)
90
102
  stream = await func(context) if inspect.iscoroutinefunction(func) else func(context)
91
103
  if request.url.path == "/chat/completions":
92
- stream = openai_encoder(stream)
104
+ # stream = openai_encoder(stream)
105
+ stream = async_openai_encoder(stream) if inspect.isasyncgen(stream) else openai_encoder(stream)
93
106
  return StreamingResponse(stream, media_type="text/event-stream")
94
107
 
95
108
  @app.get("/metadata")
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cycls"
3
- version = "0.0.2.40"
3
+ version = "0.0.2.41"
4
4
 
5
5
  packages = [{ include = "cycls" }]
6
6
  include = ["cycls/theme/**/*"]
File without changes
File without changes