semvec/pypi-packages huggingface dataset:
openai-batcher 0.1.0
Default template for PDM package
License: MIT
Requires Python: >=3.10

# OpenAI Batcher

OpenAI Batcher is a Python package designed to process batches of user prompts using OpenAI's API. It allows for efficient batch processing and monitoring of jobs.

## Installation

you can install the package directly using pip:

```bash
pip install openai-batcher
```

Alternatively, You can clone the repository and install the dependencies:

```bash
git clone https://github.com/srinathmkce/openai-batcher
cd openai_batcher
pdm install
```
## Usage

Set your openai key
```bash
export OPENAI_API_KEY=<SET-YOUR-OPENAI-KEY-HERE>
```

Here's an example of how to use the process_batch function from the package:

```bash
from openai_batcher.batch import process_batch
from datasets import load_dataset

# Load dataset
dataset = load_dataset("stanfordnlp/imdb")
train_df = dataset["train"].to_pandas()

# Define system prompt
system_prompt = """
your task is to analyze the sentiment of the review and classify it as Positive or Negative. DO not add any explanation.
JSON:{"sentiment": String // Positive or Negative} 
"""

# Process batch
process_batch(
    system_prompt=system_prompt,
    batch_user_prompts=train_df["text"],
    start_index=0,
    end_index=25,
    batch_size=5
)
```

## Development
To develop this package inside a development container, use the provided devcontainer.json and Dockerfile.

Using Dev Container Open the project in Visual Studio Code.Install the Remote - Containers extension.Reopen the project in the container. Building the Docker Image To build the Docker image manually, run:


```bash
docker build -t openai-batcher .
```

## Next Steps

Your contribuitions are welcome. Following features are yet to be added

1. Checkpointing
2. Auto-Batching
3. Improved Polling meachnism
4. Test Cases
functrace 0.0.5
Python library for tracing function calls and performance
License: MIT
Requires Python: >=3.10
Keywords: trace, tracer, tracing, track, tracker, tracking

```plaintext
  _____                    __
_/ ____\_ __  ____   _____/  |_____________    ____  ____
\   __\  |  \/    \_/ ___\   __\_  __ \__  \ _/ ___\/ __ \
 |  | |  |  /   |  \  \___|  |  |  | \// __ \\  \__\  ___/
 |__| |____/|___|  /\___  >__|  |__|  (____  /\___  >___  >
                 \/     \/                 \/     \/    \/
```

**functrace** is a Python library for detailed function call tracing.
It provides logging and performance tracking to help monitor execution, measure timing, and debug effectively.

## Getting Started

To begin using `functrace`, you'll first need to install it. This can be easily done using `pip`.
Simply run the following command to install the package:

```sh
pip install functrace
```

## Quick Start

Get up and running with `functrace` quickly by following this simple example.
Below is a basic usage scenario to help you integrate `functrace` into your project and start tracing function calls.

```python
from functrace import TraceResult, trace

def trace_callback(result: TraceResult) -> None:
    function_call = result.function_call.format()
    elapsed_time = result.elapsed_time.format()
    returned_value = repr(result.returned_value)
    exception = repr(result.exception)
    parts = [function_call]
    if result.is_started:
        parts.extend(['Started'])
    if result.is_completed:
        parts.extend(['Completed', elapsed_time, returned_value])
    if result.is_failed:
        parts.extend(['Failed', elapsed_time, exception])
    message = ' | '.join(parts)
    print(message)

@trace(callback=trace_callback)
def func(a, b, c):
    return a, b, c

if __name__ == '__main__':
    func(1, 2, 3)
    # func(a=1, b=2, c=3) | Started
    # func(a=1, b=2, c=3) | Completed | 1.25 microseconds | (1, 2, 3)
```

## Summary

You can find `functrace` on [PyPI](https://pypi.org/project/functrace) for installation and package details. For comprehensive documentation and usage guides, visit [Read the Docs](https://functrace.readthedocs.io). For source code and contributions, check out the [GitHub](https://github.com/idanhazan/functrace) repository.