https://github.com/rockchinq/flowity
A Scripting Language for Building LLM Apps
https://github.com/rockchinq/flowity
langchain llm programming-language
Last synced: 5 months ago
JSON representation
A Scripting Language for Building LLM Apps
- Host: GitHub
- URL: https://github.com/rockchinq/flowity
- Owner: RockChinQ
- Created: 2024-06-11T13:44:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-12T13:17:36.000Z (over 1 year ago)
- Last Synced: 2025-08-18T12:44:58.711Z (5 months ago)
- Topics: langchain, llm, programming-language
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flowity
Programming language for building LLM workflows.
and its runtime implementation in Python.
## Installation
```bash
pip install flowity
```
## Write flowity code
```flowity
Hello, who are you?
$resp = $query()
$end($resp)
```
Any statements not starting with `$` are considered as prompt, and will be sent to the model while calling `$query()`, the response will be stored in the variable `$resp`.
Prompt will be cached until the next `$query()` call.
> Syntax details can be found [here](docs/Syntax.md).
## Run a workflow
```python
import os
# === Setup Langchain ===
from langchain_openai import ChatOpenAI
os.environ["OPENAI_API_KEY"] = "sk-xxxx" # Your OpenAI api key
# Set OPENAI_API_BASE if you're using a reverse proxy
# os.environ["OPENAI_API_BASE"] = "https://api.openai.com/v1"
model = ChatOpenAI()
# === Write Flowity Code ===
code = """
Hello, who are you?
$str = $query()
$end($str)
"""
# === Run Flowity Code ===
from flowity.rt import rtime
rt = rtime.FlowityRuntime()
ret = rt.run(
code=code,
model=model
)
print(ret)
```