cycls 0.0.2.15__tar.gz → 0.0.2.17__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.1
2
2
  Name: cycls
3
- Version: 0.0.2.15
3
+ Version: 0.0.2.17
4
4
  Summary: Cycls SDK
5
5
  Author: Mohammed Jamal
6
6
  Author-email: mj@cycls.com
@@ -34,31 +34,35 @@ pip install cycls
34
34
  ```
35
35
 
36
36
  ```py
37
- from cycls import Cycls, Text
37
+ from cycls import Cycls
38
38
 
39
39
  cycls = Cycls()
40
40
 
41
41
  # sync app on https://cycls.com/@spark
42
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")
43
+ def spark_app(message):
44
+ print("history", message.history)
45
+ print("session id", message.id)
46
+ return message.content + "from spark"
47
47
 
48
48
  # async app on https://cycls.com/@cake
49
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")
50
+ async def cake_app(message):
51
+ print("history", message.history)
52
+ print("session id", message.id)
53
+ return message.content + "from cake"
54
54
 
55
55
  # publish to https://cycls.com
56
56
  cycls.push()
57
57
  ```
58
58
 
59
- - `Text` renders markdown
60
- - `Text` is both streaming/bulk based on input
59
+ Return a string. Supports markdown. Supports generators for streaming responses.
61
60
 
61
+ try it live
62
+ - https://cycls.com/@groq
63
+ - https://cycls.com/@openai
62
64
 
63
- Try it live https://cycls.com/@groq
65
+ code examples
66
+ - https://github.com/Cycls/examples/blob/main/groq.py
67
+ - https://github.com/Cycls/examples/blob/main/openai.py
64
68
 
@@ -16,30 +16,34 @@ pip install cycls
16
16
  ```
17
17
 
18
18
  ```py
19
- from cycls import Cycls, Text
19
+ from cycls import Cycls
20
20
 
21
21
  cycls = Cycls()
22
22
 
23
23
  # sync app on https://cycls.com/@spark
24
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")
25
+ def spark_app(message):
26
+ print("history", message.history)
27
+ print("session id", message.id)
28
+ return message.content + "from spark"
29
29
 
30
30
  # async app on https://cycls.com/@cake
31
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")
32
+ async def cake_app(message):
33
+ print("history", message.history)
34
+ print("session id", message.id)
35
+ return message.content + "from cake"
36
36
 
37
37
  # publish to https://cycls.com
38
38
  cycls.push()
39
39
  ```
40
40
 
41
- - `Text` renders markdown
42
- - `Text` is both streaming/bulk based on input
41
+ Return a string. Supports markdown. Supports generators for streaming responses.
43
42
 
43
+ try it live
44
+ - https://cycls.com/@groq
45
+ - https://cycls.com/@openai
44
46
 
45
- Try it live https://cycls.com/@groq
47
+ code examples
48
+ - https://github.com/Cycls/examples/blob/main/groq.py
49
+ - https://github.com/Cycls/examples/blob/main/openai.py
@@ -0,0 +1 @@
1
+ from .cycls import Cycls
@@ -70,10 +70,10 @@ class Cycls:
70
70
  def decorator(func):
71
71
  @wraps(func)
72
72
  async def async_wrapper(*args, **kwargs):
73
- return await func(*args, **kwargs)
73
+ return StreamingResponse(await func(*args, **kwargs))
74
74
  @wraps(func)
75
75
  def sync_wrapper(*args, **kwargs):
76
- return func(*args, **kwargs)
76
+ return StreamingResponse(func(*args, **kwargs))
77
77
  wrapper = async_wrapper if inspect.iscoroutinefunction(func) else sync_wrapper
78
78
  self.apps["@"+handle] = wrapper
79
79
  return wrapper
@@ -112,6 +112,4 @@ class Cycls:
112
112
 
113
113
  await asyncio.gather(t1, t2) if not prod else await asyncio.gather(t2)
114
114
 
115
- Text = StreamingResponse
116
-
117
115
  # poetry publish --build
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cycls"
3
- version = "0.0.2.15"
3
+ version = "0.0.2.17"
4
4
 
5
5
  packages = [{ include = "cycls" }]
6
6
  description = "Cycls SDK"
@@ -1 +0,0 @@
1
- from .cycls import Cycls, Text, Message
File without changes