Cycls SDK
Project description
cycls.py
pip install cycls
sync app
from cycls import Cycls, Message, Text
push = Cycls()
@push("cake")
def app(m: Message):
return Text(m.content)
https://cycls.com/@cake
async app
from cycls import Cycls, Message, Text
push = Cycls()
@push("her")
async def app(m: Message):
return Text(m.content)
https://cycls.com/@her
debug
push = Cycls(debug=True)
groq app
from cycls import Cycls, Message, Text
from groq import AsyncGroq
push = Cycls()
groq = AsyncGroq(api_key="YOUR_KEY")
async def llm(content):
stream = await groq.chat.completions.create(
messages=[
{"role": "system", "content": "you are a helpful assistant."},
{"role": "user", "content": content}
],
model="llama3-70b-8192",
temperature=0.5, max_tokens=1024, top_p=1, stop=None,
stream=True,
)
async def event_stream():
async for chunk in stream:
yield f"{chunk.choices[0].delta.content}"
return event_stream()
@push("groq-app")
async def app(x:Message):
stream = await llm(x.content)
return Text(stream)
https://cycls.com/@groq-app
history
@push("cake")
def app(m:Message):
print(m.history)
return Text(m.content)
https://cycls.com/@cake
groq app with history
from cycls import Cycls, Message, Text
from groq import AsyncGroq
push = Cycls()
groq = AsyncGroq(api_key="YOUR_KEY")
async def llm(messages):
stream = await groq.chat.completions.create(
messages=messages,
model="llama3-70b-8192",
temperature=0.5, max_tokens=1024, top_p=1, stop=None,
stream=True,
)
async def event_stream():
async for chunk in stream:
yield f"{chunk.choices[0].delta.content}"
return event_stream()
@push("groq-app")
async def app(m:Message):
x = [{"role": "system", "content": "you are a helpful assistant."}]
x += m.history
x += [{"role": "user", "content": m.content}]
stream = await llm(x)
return Text(stream)
https://cycls.com/@groq-app
Known issues
- Dev mode doesn't work on Windows machines
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cycls-0.0.2.12.tar.gz
(3.7 kB
view details)
Built Distribution
File details
Details for the file cycls-0.0.2.12.tar.gz
.
File metadata
- Download URL: cycls-0.0.2.12.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.13 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 415cb81160dae790dc5211b28204f093c5da5507ed888a43e20d12a770d06b12 |
|
MD5 | 892e2fc651c402bd2c3c8bd3389df07a |
|
BLAKE2b-256 | 8a533fe756514f89d05366a2917e26832fb1ff04bb6e11227cb6a346257ca1d3 |
File details
Details for the file cycls-0.0.2.12-py3-none-any.whl
.
File metadata
- Download URL: cycls-0.0.2.12-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.13 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2341c9ce209e60bdbb84e107522103475671b0903e6e4b8140532373cc230b6b |
|
MD5 | 00a11aec7536cf36ba457ee06c8b6204 |
|
BLAKE2b-256 | 555cfe607f84f97645f2210e6af984a88de4aa29cfde7342c556e702189fe7ca |