semvec/pypi-packages huggingface dataset:
hayloft 0.4.1
UI tool for LLM frameworks
License: MIT
Requires Python: >=3.8,<4.0
Keywords: UI tool,LLM app,tracking,monitoring,llama-index

# Hayloft 

[![Downloads](https://static.pepy.tech/badge/hayloft/month)](https://pepy.tech/project/hayloft)
[![](https://dcbadge.vercel.app/api/server/EKewT5cYMy?compact=true&style=flat)](https://discord.gg/EKewT5cYMy)
[![Twitter](https://img.shields.io/twitter/url/https/twitter.com/eaturchenkov.svg?style=social&label=Follow%20%40eaturchenkov)](https://twitter.com/eaturchenkov)

UI tool for LLM frameworks to make easy prompt/completion tracking, store and comparison of different sessions.

- [Installation](#installation)
- [Usage](#usage)
  - [LlamaIndex](#llamaindex)
  - [BabyAGI](#babyagi)

## Installation

Install package with pip
```
pip install hayloft
```

## Usage

Start hayloft server

```
hayloft start
```

Trace logs of your script on [http://localhost:7000](http://localhost:7000)

### LlamaIndex

Install `llama-index`, create `example.py` file as below. Put [examples](https://github.com/jerryjliu/llama_index/tree/main/examples) folder from llama_index repo near the file.

```python
import os
os.environ["OPENAI_API_KEY"] = 'YOUR_OPENAI_API_KEY'

from llama_index import SimpleDirectoryReader, VectorStoreIndex 
from hayloft.llama_index import grab_logs

grab_logs()

documents = SimpleDirectoryReader("examples/paul_graham_essay/data").load_data()
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
query_engine.query("What did the author do growing up?")
```

Or you can start live sessions from hayloft ui, just modify code like here

```python
import os
os.environ["OPENAI_API_KEY"] = 'YOUR_OPENAI_API_KEY'

from llama_index import SimpleDirectoryReader, VectorStoreIndex 
from hayloft.llama_index import listen

def agent(query: str):
    documents = SimpleDirectoryReader("examples/paul_graham_essay/data").load_data()
    index = VectorStoreIndex.from_documents(documents)
    query_engine = index.as_query_engine()
    query_engine.query(query)

listen(agent)
```

Start this script

```
python example.py
```

### BabyAGI

Clone `BabyAGI fork` repo, setup virtual env and install all dependencies

```
git clone git@github.com:eturchenkov/babyagi-hayloft.git && cd babyagi-hayloft
pip install -r requirements.txt
```

Adjust config in .env file and start `babyagi.py` script

```
python babyagi.py
```
thanosql-magic 0.3.9
ThanoSQL Magic
License: MIT
Keywords: smartmind thanosql ipython jupyter

# thanosql-magic

## Introduction

`thanosql-magic` is a Jupyter Notebook extension that provides SQL query capabilities using [ThanoSQL](https://www.thanosql.ai). This magic extension enables users to interact with ThanoSQL Workspace databases using extended SQL syntax within a Jupyter notebook.

`thanosql-magic` uses IPython magic. [IPython magic](https://ipython.readthedocs.io/en/stable/interactive/magics.html) is a special command that can be used in the IPython shell to perform specific tasks before executing the code. Since Jupyter includes the IPython shell, you can also use these magic commands in Jupyter Notebook.

IPython magic commands are prefixed with % or %% and % applies the magic to a single line of code, while %% applies the magic to multiple lines of code.

## Installation

To install thanosql-magic, you can use pip:

```
pip install thanosql-magic
```

Once installed, you can load the extension in your Jupyter notebook by running:

```python
%load_ext thanosql
```

## Usage

After loading the extension, you can connect to your ThanoSQL Engine instance by setting the thanosql variable:

1. Setting API_TOKEN

   ```python
   %thanosql API_TOKEN=<Issued_API_TOKEN>
   ```

1. Changing the Default API URI (Optional)

   ```python
   %thanosql http://localhost:8000/api/v1/query
   ```

3. Using Magic Commands

   You can then execute SQL queries on your Thanos data using the %thanosql magic command:

   ```python
   %%thanosql
   SELECT * FROM users
   ```

   This will run the SQL query and display the results in your Jupyter notebook.

You can also refer to the guide provided in [ThanoSQL's official documentation](https://docs.thanosql.ai/getting_started/hello_ThanoSQL/#3-check-the-list-of-the-thanosql-models-and-datasets-using-the-list-query-syntax).

## Requirements
- Python 3.x
- Jupyter Notebook

## Contributing
If you find any issues or would like to contribute to thanosql-magic, feel free to submit a pull request or open an issue on the [GitHub repository](https://github.com/smartmind-team/thanosql-magic).

## License

[MIT](LICENSE)