cycls 0.0.2.40__py3-none-any.whl → 0.0.2.42__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.
cycls/theme/index.html CHANGED
@@ -5,8 +5,14 @@
5
5
  <title>AI Agent</title>
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
7
  <script src="https://cdn.tailwindcss.com?plugins=forms,typography"></script>
8
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/github-dark.min.css"/>
9
- <link rel="stylesheet" href="https://esm.sh/katex@0.16.8/dist/katex.min.css" />
8
+ <link
9
+ rel="stylesheet"
10
+ href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/github-dark.min.css"
11
+ />
12
+ <link
13
+ rel="stylesheet"
14
+ href="https://esm.sh/katex@0.16.8/dist/katex.min.css"
15
+ />
10
16
  <script>
11
17
  const HEADER = `{{ header | safe }}`;
12
18
  const INTRO = `{{ intro | safe }}`;
@@ -15,9 +21,9 @@
15
21
  const PROD = {{ prod | tojson }};
16
22
  const PUBLISHABLE_KEY = "{{ pk_live if prod else pk_test }}";
17
23
  </script>
18
- <script type="module" crossorigin src="/assets/index-CtrsaaFE.js"></script>
24
+ <script type="module" crossorigin src="/assets/index-C9QLIkeQ.js"></script>
19
25
  </head>
20
26
  <body>
21
- <div id="root"></div>
27
+ <div style="overflow-x: hidden" id="root"></div>
22
28
  </body>
23
- </html>
29
+ </html>
cycls/web.py CHANGED
@@ -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
  Metadata-Version: 2.4
2
2
  Name: cycls
3
- Version: 0.0.2.40
3
+ Version: 0.0.2.42
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
-
@@ -0,0 +1,9 @@
1
+ cycls/__init__.py,sha256=bVT0dYTXLdSC3ZURgtm-DEOj-VO6RUM6zGsJB0zuj6Y,61
2
+ cycls/runtime.py,sha256=GoRfyPn2uKTIMb4FSowjfo02DsL0VrunDuybdeZxsvM,18221
3
+ cycls/sdk.py,sha256=lqYE52hSZ8kfda-M46zPcrU-dVFztf-qlHa5ozS4Xbs,5132
4
+ cycls/theme/assets/index-C9QLIkeQ.js,sha256=JzH_gKNEKDxJzYN31CPcUW9oeGgkB5D9oM9MNb9i0iE,1097086
5
+ cycls/theme/index.html,sha256=t-6YvnXvvnFX-LLDgUpP5SJrEIYsnE863Dk1OfDEBug,956
6
+ cycls/web.py,sha256=Yoot83871KjSkfkvkZSBeJQ5MnY620tAvT291ybUNQE,4848
7
+ cycls-0.0.2.42.dist-info/METADATA,sha256=4WvqSNmsH5qC8YibeakPPcJiHr8YuNDhqxYyM4J3MyE,5673
8
+ cycls-0.0.2.42.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
9
+ cycls-0.0.2.42.dist-info/RECORD,,