semvec/pypi-packages huggingface dataset:
aieng-rag-utils 1.0.0
Helper modules for AI Engineering RAG Bootcamp reference implementations
Requires Python: >=3.10

# aieng-rag-utils

`aieng-rag-utils` is a Python library providing utility functions and tools to streamline Retrieval-Augmented Generation (RAG) workflows. It is designed to help AI engineers build, evaluate, and deploy RAG-based applications efficiently.

## Features

- Document loaders, chunkers and pretty-print
- Web Search
- Vector store integrations
- Query and retrieval helpers
- Evaluation and benchmarking tools

## Installation

```bash
pip3 install aieng-rag-utils
```

## Sample Usage

```python
from aieng.rag.utils import get_device_name
from aieng.rag.utils.search import DocumentReader
from aieng.rag.utils.pubmed import RAGLLM

device = get_device_name()

doc_reader = DocumentReader(directory_path="./source_documents")
docs, chunks = doc_reader.load()

llm = RAGLLM(
    llm_type="openai",
    llm_name="gpt-4o",
    api_base=OPENAI_BASE_URL,
    api_key=OPENAI_API_KEY,
).load_model(**rag_cfg) # RAG Configuration

```
PyApso 1.1.0
Adaptive Particle Swarm Optimization for continuous, multi-objective, and multidimensional problems
Keywords: optimization, particle swarm optimization, APSO, metaheuristic

# PyApso

**PyApso** is an implementation of the **Adaptive Particle Swarm Optimization (APSO)** algorithm and designed for solving continuous, multi-objective, and multi-dimensional optimization problems. 

---

## Installation

Install the package using pip:

```bash
pip install pyapso
````
Or from source:
```bash
git clone https://github.com/smohamadabedy/pyapso.git
cd pyapso
pip install .
```

## Features
ADAPTIVE -  key parameters: (inertia weight, avg weight)
Continuous optimization support
Single and multi-objective fitness evaluation
Constraint-aware evolution
Batch evaluation and parallel execution
Excel and JSON logging
Custom callbacks and visualizations

## Usage

```python
from pyapso import APSO
import numpy as np

def fitness(x):
    return np.sum(x**2)

if __name__ == "__main__":
    best, score, history, hd = APSO(
        objective_function=fitness,
        dim=1,
        bounds=([-10], [10]),
        num_particles=100,
        max_iter=10,
        verbose = 1,live_plot=False,folder="results_folder",save_prefix="results_file"
    ).run()    
            
    print("Best solution:", best)
    print("Best score:", score)

    # Save optimization history (JSON,CSV)
    hd.save()

    # Plot optimization history
    hd.plot()
```
## Modes

```python
apso.run("avg", c1=1.8, c2=1.8, w_min=0.5, w_max=0.9)
```
"avg" mode adapts the inertia weight dynamically between w_min and w_max using swarm behavior.

```python
apso.run("inertia",c1=1.8, c2=1.8, inertia=0.05)
```
"inertia" mode adapts a fixed inertia weight throughout the optimization (default).

💡 Tip:

 - A higher c1 encourages particles to explore their own search path.
 - A higher c2 encourages convergence to the global best.
 - Lower inertia means the swarm is more reactive and less explorative.



## Examples
You can find runnable demos in the examples/ directory:

```bash
examples/
├── demo_1.py    # 5D Rastrigin function
├── demo_2.py    # 3D constrained benchmark
├── demo_3.py    # 2D McCormick function
```

Run an example:
```bash
python examples/demo_2.py
```