Skip to content

Commit 3115b2c

Browse files
committed
Add basic readme for litlytics library and add example code
1 parent 09f5cf8 commit 3115b2c

File tree

3 files changed

+102
-7
lines changed

3 files changed

+102
-7
lines changed

packages/litlytics/README.md

+39-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,47 @@
1-
# litlytics
1+
# LitLytics
22

3-
To install dependencies:
3+
**LitLytics** is an affordable, simple analytics platform that leverages LLMs to automate data analysis.
4+
It was designed to help teams without dedicated data scientists gain insights from their data.
5+
6+
This is a library that allows running pipelines in browser or server environments.
7+
8+
## Installing
9+
10+
Make sure you have npm-compatible package manager installed (e.g. [Bun](https://bun.sh/)).
11+
12+
Then, install LitLytics from [npm](https://npm.com/packages/litlytics) by running following command:
413

514
```bash
6-
bun install
15+
bun add litlytics
716
```
817

9-
To run:
18+
## Using litlytics package to run pipelines
1019

11-
```bash
12-
bun run litlytics.ts
20+
Once you have library installed, you can run your pipeline configs like shown in [example](./example/run.ts) below:
21+
22+
```javascript
23+
import { LitLytics, type Pipeline } from '../litlytics';
24+
import pipeline from './pipeline.json';
25+
26+
// create new instance with provider/model of your choice
27+
const litlytics = new LitLytics({
28+
provider: 'openai',
29+
model: 'gpt-4o-mini',
30+
key: process.env.OPENAI_API_KEY,
31+
});
32+
// set pipeline config
33+
litlytics.setPipeline(pipeline);
34+
// execute pipeline
35+
const result = await litlytics.runPipeline();
36+
// read results
37+
console.log(result?.results);
1338
```
1439
15-
This project was created using `bun init` in bun v1.1.29. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
40+
## License
41+
42+
This project is [licensed](/LICENSE.md) under the **GNU Affero General Public License v3.0 (AGPL-3.0)**.
43+
This license ensures that the software remains free and open, even when used as part of a network service. If you modify or distribute the project (including deploying it as a service), you must also make your changes available under the same license.
44+
45+
### Commercial/Enterprise Licensing
46+
47+
If your use case requires a proprietary license (for example, you do not wish to open-source your modifications or need a more flexible licensing arrangement), we offer **commercial and enterprise licenses**. Please [contact us](mailto:[email protected]?subject=LitLytics%20License) to discuss licensing options tailored to your needs.
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "instagram-example",
3+
"pipelinePlan": "",
4+
"pipelineDescription": "",
5+
"source": {
6+
"id": "source_0",
7+
"name": "Source",
8+
"description": "Primary source",
9+
"type": "source",
10+
"sourceType": "text",
11+
"docs": [
12+
{
13+
"id": "textdoc",
14+
"name": "Default document",
15+
"content": "Post is a photo of my cute black cat with white mustache.",
16+
"test": true,
17+
"processingResults": []
18+
}
19+
],
20+
"connectsTo": [
21+
"step_0"
22+
],
23+
"expanded": true
24+
},
25+
"steps": [
26+
{
27+
"id": "step_0",
28+
"name": "Write an instagram post",
29+
"description": "Write a post for instagram based on text description of the image.",
30+
"type": "llm",
31+
"input": "doc",
32+
"prompt": "Create an engaging Instagram post based on the provided text description of the image.\nHighlight key elements, emotions, and any relevant hashtags to enhance visibility and engagement.\nEnsure the tone is suitable for Instagram, aiming to captivate the audience and encourage interaction.\nUse simpler language. Write as if you are not a native English speaker.",
33+
"connectsTo": [
34+
"step_1"
35+
],
36+
"expanded": true
37+
},
38+
{
39+
"id": "step_1",
40+
"name": "Proof-read and edit instagram post text",
41+
"description": "Proof-read and edit instagram post text to make it more natural and engaging.",
42+
"type": "llm",
43+
"input": "result",
44+
"prompt": "Please proofread and edit the provided Instagram post text to enhance its natural flow and engagement.\nFocus on improving grammar, clarity, and overall appeal to the audience, while maintaining the original message and tone.",
45+
"connectsTo": [
46+
"litlytics_output"
47+
],
48+
"expanded": true
49+
}
50+
],
51+
"results": []
52+
}

packages/litlytics/example/run.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { LitLytics, type Pipeline } from '../litlytics';
2+
import pipeline from './pipeline.json';
3+
4+
const litlytics = new LitLytics({
5+
provider: 'openai',
6+
model: 'gpt-4o-mini',
7+
key: process.env.OPENAI_API_KEY!,
8+
});
9+
litlytics.setPipeline(pipeline as Pipeline);
10+
const result = await litlytics.runPipeline();
11+
console.log(result?.results);

0 commit comments

Comments
 (0)