cycls 0.0.2.13__tar.gz → 0.0.2.14__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.
@@ -0,0 +1,64 @@
1
+ Metadata-Version: 2.1
2
+ Name: cycls
3
+ Version: 0.0.2.14
4
+ Summary: Cycls SDK
5
+ Author: Mohammed Jamal
6
+ Author-email: mj@cycls.com
7
+ Requires-Python: >=3.8,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.8
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Dist: asyncssh (>=2.14.2,<3.0.0)
15
+ Requires-Dist: fastapi (>=0.111.0,<0.112.0)
16
+ Requires-Dist: httpx (>=0.27.0,<0.28.0)
17
+ Description-Content-Type: text/markdown
18
+
19
+ </br></br><p align="center"><img src="https://cycls.com/static/assets/favicon.svg" alt="Cycls"></p></br>
20
+
21
+ <div align="center">
22
+ <a href="https://pypi.org/project/cycls/" target="_blank" rel="noopener noreferrer">
23
+ <img loading="lazy" src="https://img.shields.io/pypi/v/cycls.svg" alt="PyPI" class="img_ev3q" style="display: inline;">
24
+ </a>
25
+ <a href="https://discord.gg/BMnaMatDC7" target="_blank" rel="noopener noreferrer">
26
+ <img loading="lazy" src="https://img.shields.io/discord/1175782747164389466" alt="Discord" class="img_ev3q" style="display: inline;">
27
+ </a>
28
+ </div>
29
+
30
+ </br>
31
+
32
+ ```sh
33
+ pip install cycls
34
+ ```
35
+
36
+ ```py
37
+ from cycls import Cycls, Text
38
+
39
+ cycls = Cycls()
40
+
41
+ # sync app on https://cycls.com/@spark
42
+ @cycls("spark")
43
+ def spark_app(x):
44
+ print("history", x.history)
45
+ print("session id", x.id)
46
+ return Text(x.content+" from spark")
47
+
48
+ # async app on https://cycls.com/@cake
49
+ @cycls("cake")
50
+ async def cake_app(x):
51
+ print("history", x.history)
52
+ print("session id", x.id)
53
+ return Text(x.content+" from cake")
54
+
55
+ # publish to https://cycls.com
56
+ cycls.push()
57
+ ```
58
+
59
+ - `Text` renders markdown
60
+ - `Text` is both streaming/bulk based on input
61
+
62
+
63
+ Try it live https://cycls.com/@groq
64
+
@@ -0,0 +1,45 @@
1
+ </br></br><p align="center"><img src="https://cycls.com/static/assets/favicon.svg" alt="Cycls"></p></br>
2
+
3
+ <div align="center">
4
+ <a href="https://pypi.org/project/cycls/" target="_blank" rel="noopener noreferrer">
5
+ <img loading="lazy" src="https://img.shields.io/pypi/v/cycls.svg" alt="PyPI" class="img_ev3q" style="display: inline;">
6
+ </a>
7
+ <a href="https://discord.gg/BMnaMatDC7" target="_blank" rel="noopener noreferrer">
8
+ <img loading="lazy" src="https://img.shields.io/discord/1175782747164389466" alt="Discord" class="img_ev3q" style="display: inline;">
9
+ </a>
10
+ </div>
11
+
12
+ </br>
13
+
14
+ ```sh
15
+ pip install cycls
16
+ ```
17
+
18
+ ```py
19
+ from cycls import Cycls, Text
20
+
21
+ cycls = Cycls()
22
+
23
+ # sync app on https://cycls.com/@spark
24
+ @cycls("spark")
25
+ def spark_app(x):
26
+ print("history", x.history)
27
+ print("session id", x.id)
28
+ return Text(x.content+" from spark")
29
+
30
+ # async app on https://cycls.com/@cake
31
+ @cycls("cake")
32
+ async def cake_app(x):
33
+ print("history", x.history)
34
+ print("session id", x.id)
35
+ return Text(x.content+" from cake")
36
+
37
+ # publish to https://cycls.com
38
+ cycls.push()
39
+ ```
40
+
41
+ - `Text` renders markdown
42
+ - `Text` is both streaming/bulk based on input
43
+
44
+
45
+ Try it live https://cycls.com/@groq
@@ -106,9 +106,9 @@ class Cycls:
106
106
  print("✦/✧","development mode")
107
107
  # print("✦/✧",f"url {self.url}")
108
108
  register(list(self.apps.keys()), self.network, self.url+"/gateway", "dev")
109
- t2 = asyncio.create_task(run_server(self.server,self.port))
110
109
 
111
110
  t1 = asyncio.create_task(create_ssh_tunnel(f"{self.subdomain}-cycls", self.port))
111
+ t2 = asyncio.create_task(run_server(self.server,self.port))
112
112
  await asyncio.gather(t1, t2) if not prod else asyncio.gather(t2)
113
113
 
114
114
  Text = StreamingResponse
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cycls"
3
- version = "0.0.2.13"
3
+ version = "0.0.2.14"
4
4
 
5
5
  packages = [{ include = "cycls" }]
6
6
  description = "Cycls SDK"
cycls-0.0.2.13/PKG-INFO DELETED
@@ -1,142 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: cycls
3
- Version: 0.0.2.13
4
- Summary: Cycls SDK
5
- Author: Mohammed Jamal
6
- Author-email: mj@cycls.com
7
- Requires-Python: >=3.8,<4.0
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.8
10
- Classifier: Programming Language :: Python :: 3.9
11
- Classifier: Programming Language :: Python :: 3.10
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Requires-Dist: asyncssh (>=2.14.2,<3.0.0)
15
- Requires-Dist: fastapi (>=0.111.0,<0.112.0)
16
- Requires-Dist: httpx (>=0.27.0,<0.28.0)
17
- Description-Content-Type: text/markdown
18
-
19
- </br></br><p align="center"><img src="https://cycls.com/static/assets/favicon.svg" alt="Cycls"></p></br>
20
-
21
- <div align="center">
22
- <a href="https://pypi.org/project/cycls/" target="_blank" rel="noopener noreferrer">
23
- <img loading="lazy" src="https://img.shields.io/pypi/v/cycls.svg" alt="PyPI" class="img_ev3q" style="display: inline;">
24
- </a>
25
- <a href="https://discord.gg/BMnaMatDC7" target="_blank" rel="noopener noreferrer">
26
- <img loading="lazy" src="https://img.shields.io/discord/1175782747164389466" alt="Discord" class="img_ev3q" style="display: inline;">
27
- </a>
28
- </div>
29
-
30
- # cycls.py
31
-
32
- ```sh
33
- pip install cycls
34
- ```
35
-
36
- ## sync app
37
- ```py
38
- from cycls import Cycls, Message, Text
39
-
40
- push = Cycls()
41
-
42
- @push("cake")
43
- def app(m: Message):
44
- return Text(m.content)
45
- ```
46
- `https://cycls.com/@cake`
47
-
48
- ## async app
49
- ```py
50
- from cycls import Cycls, Message, Text
51
-
52
- push = Cycls()
53
-
54
- @push("her")
55
- async def app(m: Message):
56
- return Text(m.content)
57
- ```
58
- `https://cycls.com/@her`
59
-
60
- ## debug
61
- ```py
62
- push = Cycls(debug=True)
63
- ```
64
-
65
- ## groq app
66
- ```py
67
- from cycls import Cycls, Message, Text
68
- from groq import AsyncGroq
69
-
70
- push = Cycls()
71
-
72
- groq = AsyncGroq(api_key="YOUR_KEY")
73
-
74
- async def llm(content):
75
- stream = await groq.chat.completions.create(
76
- messages=[
77
- {"role": "system", "content": "you are a helpful assistant."},
78
- {"role": "user", "content": content}
79
- ],
80
- model="llama3-70b-8192",
81
- temperature=0.5, max_tokens=1024, top_p=1, stop=None,
82
- stream=True,
83
- )
84
-
85
- async def event_stream():
86
- async for chunk in stream:
87
- yield f"{chunk.choices[0].delta.content}"
88
-
89
- return event_stream()
90
-
91
- @push("groq-app")
92
- async def app(x:Message):
93
- stream = await llm(x.content)
94
- return Text(stream)
95
- ```
96
- `https://cycls.com/@groq-app`
97
-
98
- ## history
99
- ```py
100
- @push("cake")
101
- def app(m:Message):
102
- print(m.history)
103
- return Text(m.content)
104
- ```
105
- `https://cycls.com/@cake`
106
-
107
- ## groq app with history
108
- ```py
109
- from cycls import Cycls, Message, Text
110
- from groq import AsyncGroq
111
-
112
- push = Cycls()
113
-
114
- groq = AsyncGroq(api_key="YOUR_KEY")
115
-
116
- async def llm(messages):
117
- stream = await groq.chat.completions.create(
118
- messages=messages,
119
- model="llama3-70b-8192",
120
- temperature=0.5, max_tokens=1024, top_p=1, stop=None,
121
- stream=True,
122
- )
123
-
124
- async def event_stream():
125
- async for chunk in stream:
126
- yield f"{chunk.choices[0].delta.content}"
127
-
128
- return event_stream()
129
-
130
- @push("groq-app")
131
- async def app(m:Message):
132
- x = [{"role": "system", "content": "you are a helpful assistant."}]
133
- x += m.history
134
- x += [{"role": "user", "content": m.content}]
135
- stream = await llm(x)
136
- return Text(stream)
137
- ```
138
- `https://cycls.com/@groq-app`
139
-
140
- # Known issues
141
- - Dev mode doesn't work on Windows machines
142
-
cycls-0.0.2.13/README.md DELETED
@@ -1,123 +0,0 @@
1
- </br></br><p align="center"><img src="https://cycls.com/static/assets/favicon.svg" alt="Cycls"></p></br>
2
-
3
- <div align="center">
4
- <a href="https://pypi.org/project/cycls/" target="_blank" rel="noopener noreferrer">
5
- <img loading="lazy" src="https://img.shields.io/pypi/v/cycls.svg" alt="PyPI" class="img_ev3q" style="display: inline;">
6
- </a>
7
- <a href="https://discord.gg/BMnaMatDC7" target="_blank" rel="noopener noreferrer">
8
- <img loading="lazy" src="https://img.shields.io/discord/1175782747164389466" alt="Discord" class="img_ev3q" style="display: inline;">
9
- </a>
10
- </div>
11
-
12
- # cycls.py
13
-
14
- ```sh
15
- pip install cycls
16
- ```
17
-
18
- ## sync app
19
- ```py
20
- from cycls import Cycls, Message, Text
21
-
22
- push = Cycls()
23
-
24
- @push("cake")
25
- def app(m: Message):
26
- return Text(m.content)
27
- ```
28
- `https://cycls.com/@cake`
29
-
30
- ## async app
31
- ```py
32
- from cycls import Cycls, Message, Text
33
-
34
- push = Cycls()
35
-
36
- @push("her")
37
- async def app(m: Message):
38
- return Text(m.content)
39
- ```
40
- `https://cycls.com/@her`
41
-
42
- ## debug
43
- ```py
44
- push = Cycls(debug=True)
45
- ```
46
-
47
- ## groq app
48
- ```py
49
- from cycls import Cycls, Message, Text
50
- from groq import AsyncGroq
51
-
52
- push = Cycls()
53
-
54
- groq = AsyncGroq(api_key="YOUR_KEY")
55
-
56
- async def llm(content):
57
- stream = await groq.chat.completions.create(
58
- messages=[
59
- {"role": "system", "content": "you are a helpful assistant."},
60
- {"role": "user", "content": content}
61
- ],
62
- model="llama3-70b-8192",
63
- temperature=0.5, max_tokens=1024, top_p=1, stop=None,
64
- stream=True,
65
- )
66
-
67
- async def event_stream():
68
- async for chunk in stream:
69
- yield f"{chunk.choices[0].delta.content}"
70
-
71
- return event_stream()
72
-
73
- @push("groq-app")
74
- async def app(x:Message):
75
- stream = await llm(x.content)
76
- return Text(stream)
77
- ```
78
- `https://cycls.com/@groq-app`
79
-
80
- ## history
81
- ```py
82
- @push("cake")
83
- def app(m:Message):
84
- print(m.history)
85
- return Text(m.content)
86
- ```
87
- `https://cycls.com/@cake`
88
-
89
- ## groq app with history
90
- ```py
91
- from cycls import Cycls, Message, Text
92
- from groq import AsyncGroq
93
-
94
- push = Cycls()
95
-
96
- groq = AsyncGroq(api_key="YOUR_KEY")
97
-
98
- async def llm(messages):
99
- stream = await groq.chat.completions.create(
100
- messages=messages,
101
- model="llama3-70b-8192",
102
- temperature=0.5, max_tokens=1024, top_p=1, stop=None,
103
- stream=True,
104
- )
105
-
106
- async def event_stream():
107
- async for chunk in stream:
108
- yield f"{chunk.choices[0].delta.content}"
109
-
110
- return event_stream()
111
-
112
- @push("groq-app")
113
- async def app(m:Message):
114
- x = [{"role": "system", "content": "you are a helpful assistant."}]
115
- x += m.history
116
- x += [{"role": "user", "content": m.content}]
117
- stream = await llm(x)
118
- return Text(stream)
119
- ```
120
- `https://cycls.com/@groq-app`
121
-
122
- # Known issues
123
- - Dev mode doesn't work on Windows machines
File without changes
File without changes