semvec/pypi-packages huggingface dataset:
evalRagPk 0.0.4
A library for evaluating Retrieval-Augmented Generation (RAG) systems
Requires Python: >=3.10

# RAG Evaluator

## Overview

RAG Evaluator is a Python library for evaluating Retrieval-Augmented Generation (RAG) systems. It provides various metrics to evaluate the quality of generated text against reference text.

## Installation

You can install the library using pip:

```bash
pip install evalRagPk
```

## Usage

Here's how to use the RAG Evaluator library:

```python
from evalRagPk import RAGEvaluator

# Initialize the evaluator
evaluator = RAGEvaluator()

# Input data
question = "What are the causes of climate change?"
response = "Climate change is caused by human activities."
reference = "Human activities such as burning fossil fuels cause climate change."

# Evaluate the response
metrics = evaluator.evaluate_all(question, response, reference)

# Print the results
print(metrics)
```

## Streamlit Web App

To run the web app:

- cd into streamlit app folder.
- Create a virtual env
- Activate
- Install all dependencies
- and run
```
streamlit run app.py
```

## Metrics

The following metrics are provided by the library:

- **BLEU**: Measures the overlap between the generated output and reference text based on n-grams.
- **ROUGE-1**: Measures the overlap of unigrams between the generated output and reference text.
- **BERT Score**: Evaluates the semantic similarity between the generated output and reference text using BERT embeddings.
- **Perplexity**: Measures how well a language model predicts the text.
- **Diversity**: Measures the uniqueness of bigrams in the generated output.
- **Racial Bias**: Detects the presence of biased language in the generated output.

## Testing

To run the tests, use the following command:

```
python -m unittest discover -s rag_evaluator -p "test_*.py"
```
python-for-my-log 0.0.11
Record your diary happily

# 漫漫人生路，吾将泛舟独游！虽举目四望皆是他乡之客，但愿吾归，仍是少年！
---

### 一、怎么使用？
1. 安装
```shell
pip install python-for-my-log
```
2. 构建日志对象
```python
from python_for_my_log import LogMiddleware
# 在项目全局的地方实例化
logger = LogMiddleware(log_dir_path="自定义日志存放的目录路径名，默认为/app/logs/服务名/",
                 app_name="自定义服务的名称",
                 hostname="自定义实例的主机名，默认获取实例机器的hostname",
                 log_level="定义日志最低输出的级别，默认DEBUG",
                 log_format_model="日志记录的格式，默认执行给出的elk样式，也提供default模式，也可自定义",
                 log_when="定义日志分割的模式：H 小时，M 分钟，S 秒，默认小时",
                 log_interval=1, # 日志分割的维度，仅支持天D、小时H，分钟M，秒S
                 log_backup_count=30 * 24) # 日志最多保留的个数，默认按小时分割，保留30天的日志
# 记录日志
logger.debug("人生苦短，我用孙氏牌日志记录器")
```
3. 范例调用参考sdk中的test.py文件

### 二、日志存放路径说明
**建议传入你当前服务的根目录且建议通过os模块获取或者通过os.sep代替`/`或`\`**
1. 默认windows系统，在您传入的路径后新建一个log的目录，存放记录的日志，如/log_dir_path/log/debug.*.log
2. linux系统，在您传入的路径最后一层目录名前拼接/app/logs/log_dir_path.split("/")[-1]
```
# 示例: 如您传入的是当前服务的基目录：/project/my_app_name
# windows：那么您存放日志的路径就是：/project/my_app_name/log
# linux: 那么您存放日志的路径就是：/app/logs/my_app_name
```

### 三、更多交流请关注微信公众号`Python小白成长记`
![](https://raw.githubusercontent.com/Sunxiuwen2018/MyPicGoDir/main/Picture/%E6%88%91%E7%9A%84%E5%85%AC%E4%BC%97%E5%8F%B7.jpg)

### 四、更新日志
- v0.0.10
```
1. 修复已知的bug
```
- v0.0.9
```
1. 解决python低版本安装filelock包报错问题
```
- v0.0.8
```
1. 解决debug日志以info级别写入-code文件
```

- v0.0.7
```
- 修复多进程操作日志文件异常问题
1. 多进程日志冲突
- 代码中使用了TimedRotatingFileHandler，但Python标准库的logging模块原生不支持多进程安全写入
- 当多个进程同时操作同一个日志文件时，会出现以下典型问题：
​1. 文件占用冲突：FileNotFoundError或PermissionError（如日志中出现的/app/log/...文件找不到）
​2. 日志轮转错乱：进程A轮转日志时删除旧文件，进程B仍在写入旧文件导致数据丢失
​3. 日志覆盖/重复：多个进程独立维护文件指针，导致写入覆盖或重复
```

- v0.0.6
```
1. 日志文件命名规则
- 按小时分割 ：非API流水日志:{appName}_code-{level}-{其他防止容器日志覆盖唯一值}{YYYYMMDD}T{HH}.log,API流水日志：{appName}_info-{level}-{其他防止容器日志覆盖唯一值}{YYYYMMDD}T{HH}.log
- 按天分割：非API流水日志:{appName}_code-{level}-{其他防止容器日志覆盖唯一值}{YYYYMMDD}.log,API流水日志：{appName}_info-{level}-{其他防止容器日志覆盖唯一值}{YYYYMMDD}.log

2. 更新对应的日志文件生成后缀时间格式以及分割日志正则匹配
```
swaguard 0.1.0
A library to protect Swagger/OpenAPI UI in FastAPI and Django applications
Requires Python: >=3.6

# Swaguard

Swaguard는 Django와 FastAPI 애플리케이션에서 Swagger/OpenAPI UI를 보호하기 위한 Python 라이브러리입니다. 인증된 사용자만 API 문서에 접근할 수 있도록 합니다.

## 특징

- Swagger UI(/docs), ReDoc(/redoc) 및 OpenAPI 스키마(/openapi.json) 엔드포인트 보호
- 간단한 HTTP-only 쿠키 기반 인증
- 설정 가능한 쿠키 만료 시간 (기본 60분)
- 환경 변수 또는 YAML 파일을 통한 설정
- FastAPI 애플리케이션 지원 (현재 구현)
- Django 애플리케이션 지원 (향후 구현 예정)

## 설치

```bash
pip install swaguard
```

또는 소스에서 직접 설치:

```bash
git clone https://github.com/riseryan89/swaguard.git
cd swaguard
pip install -e .
```

## 사용 방법

### FastAPI에서 사용하기

1. 미들웨어를 사용하여 모든 Swagger 관련 경로 보호:

```python
from fastapi import FastAPI
from swaguard import SwaguardMiddleware, create_login_router, create_user

# 사용자 생성
create_user("admin", "password")

app = FastAPI()

# Swaguard 미들웨어 등록
app.add_middleware(SwaguardMiddleware)

# 로그인 라우터 등록
login_router = create_login_router()
app.include_router(login_router)
```

2. 종속성 주입을 사용하여 특정 엔드포인트 보호:

```python
from fastapi import FastAPI, Depends
from swaguard import verify_swagger_cookie

app = FastAPI()

@app.get("/api/protected")
async def protected_endpoint(username: str = Depends(verify_swagger_cookie)):
    return {"message": f"Hello, {username}!"}
```

## 설정

Swaguard는 다음과 같은 방법으로 설정할 수 있습니다:

### 환경 변수

```bash
# 쿠키 설정
export SWAGUARD_COOKIE_NAME="swaguard_auth"
export SWAGUARD_COOKIE_EXPIRE_MINUTES="60"
export SWAGUARD_COOKIE_SECURE="true"
export SWAGUARD_COOKIE_HTTPONLY="true"
export SWAGUARD_COOKIE_SAMESITE="lax"

# 경로 설정
export SWAGUARD_LOGIN_PATH="/swaguard/login"
export SWAGUARD_LOGOUT_PATH="/swaguard/logout"

# 사용자 설정 (개발 환경에서만 사용 권장)
export SWAGUARD_USERS="admin:password,user:userpass"

# 비밀 키 설정
export SWAGUARD_SECRET_KEY="your-secret-key"
```

### YAML 설정 파일

```yaml
# swaguard_config.yaml
cookie_name: swaguard_auth
cookie_expire_minutes: 60
cookie_secure: true
cookie_httponly: true
cookie_samesite: lax
login_path: /swaguard/login
logout_path: /swaguard/logout
protected_paths:
  - /docs
  - /redoc
  - /openapi.json
users:
  admin: $2b$12$...  # 해시된 비밀번호
```

## 예제

예제 폴더에 샘플 애플리케이션이 포함되어 있습니다:

- `examples/fastapi_example.py`: FastAPI를 사용한 예제

예제 실행:

```bash
cd examples
python fastapi_example.py
```

그런 다음 브라우저에서 http://localhost:<your-port>/docs 에 접속하면 로그인 페이지로 리다이렉트됩니다.

## 라이선스

MIT

## 컨트리뷰션

Pull Request 및 이슈 제출을 환영합니다. 주요 변경 사항에 대해서는 먼저 이슈를 통해 논의해 주세요.
aptisolve 0.2.0
A package for solving numerical and verbal aptitude problems
Requires Python: >=3.6

# AptiSolve

A comprehensive Python package for solving aptitude problems with detailed step-by-step explanations. Perfect for students preparing for competitive exams, interviews, and aptitude tests.

## Features

### Numerical Aptitude
Solve common mathematical problems with detailed step-by-step solutions:
- Percentages
- Simple & Compound Interest
- Time and Work
- Time, Speed and Distance
- Ratios and Proportions
- Averages
- Mixtures and Alligations
- Number Systems
- Permutations and Combinations
- Probability

### Logical Reasoning
Master logical reasoning problems with clear explanations:
- Blood Relations
- Number Series
- Direction Sense
- Coding-Decoding
- Seating Arrangements
- Syllogisms
- Statement-Conclusion Analysis
- Analogies

### Data Interpretation
Analyze and interpret data from various formats:
- Tables (analyze tabular data, compare data points)
- Graphs (line graph analysis, growth rate calculations)
- Charts (pie chart analysis, segment comparison)

### Verbal Aptitude
Practice and improve verbal reasoning skills:
- Synonyms and Antonyms
- Reading Comprehension
- Sentence Completion
- Grammar and Vocabulary
- One Word Substitution
- Paragraph Jumbles

## Installation

```bash
pip install aptisolve