ragpon is a Python project for RAG (Retrieval Augmented Generation) over Japanese documents. It includes document ingestion, chunking, BM25 and vector search, reranking, and application layers built with FastAPI and Streamlit.
.docx), and PowerPoint (.pptx) filesDataFrame objects directlyragpon/
Core library code, including configuration, document readers, chunk processors, repositories, models, and services.ragpon/apps/fastapi/
API server that integrates with OpenAI or Azure OpenAI and provides the RAG backend.ragpon/apps/streamlit/
Streamlit-based frontend UI.ragpon/examples/
Sample configuration files and usage examples.tests/
Unit tests.docs/
Sphinx documentation scaffold.>=3.11,<3.14pipJapanese chunking uses ja_ginza, so install dependencies including the related model packages during setup.
poetry install
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Sample configuration files:
ragpon/examples/sample_config.ymlragpon/apps/fastapi/config/sample_config.ymlAt minimum, review these keys:
MODELS.CL_NAGOYA_RURI_V3_MODEL_PATHMODELS.RURI_RERANKER_LARGE_PATHDATABASES.USE_BM25DATABASES.BM25_PATHDATABASES.USE_CHROMADBDATABASES.CHROMADB_COLLECTION_NAMEDATABASES.CHROMADB_FOLDER_PATHWhen this repository is cloned from GitHub, local model files are not included.
For the FastAPI app, prepare the Hugging Face model directory
models--cl-nagoya--ruri-v3-310m under
ragpon/apps/fastapi/models/, then point
MODELS.CL_NAGOYA_RURI_V3_MODEL_PATH at its snapshots/<revision> directory.
See ragpon/apps/fastapi/models/README.md.
LLM configuration is controlled through environment variables.
export OPENAI_TYPE=openai
export OPENAI_API_KEY=YOUR_API_KEY
export OPENAI_MODEL=gpt-4o-mini
export OPENAI_TYPE=azure
export AZURE_OPENAI_ENDPOINT=YOUR_ENDPOINT
export AZURE_OPENAI_API_KEY=YOUR_API_KEY
export AZURE_OPENAI_DEPLOYMENT=YOUR_DEPLOYMENT
export AZURE_OPENAI_MODEL=gpt-5.1
A minimal example is available in ragpon/examples/basic_usage.py.
from ragpon import Config, DocumentProcessingService, JAGinzaChunkProcessor
config = Config("ragpon/examples/sample_config.yml")
service = DocumentProcessingService(
config_or_config_path=config,
chunk_processor=JAGinzaChunkProcessor(chunk_size=300),
)
service.process_file("path/to/document.pdf")
results = service.search(query="What is ragpon?")
print(results)
DocumentProcessingService provides these main operations:
process_file: ingest a fileprocess_dataframe: ingest a DataFrame as-isprocess_dataframe_with_chunking: chunk a text column in a DataFrame before ingestingsearch: run retrievalenhance_search_results: attach surrounding context to resultsrerank_results: rerank retrieved resultsdelete_by_ids / delete_by_metadata: remove indexed dataFastAPI:
uvicorn ragpon.apps.fastapi.fast_api_app:app --host 0.0.0.0 --port 8006 --workers 4
Streamlit:
streamlit run ragpon/apps/streamlit/streamlit_app.py --server.port 8005 --server.address 0.0.0.0
Exposed ports:
http://localhost:8005http://localhost:8006Example environment variables:
OPENAI_API_KEYOPENAI_TYPEOPENAI_MODELMYSQL_HOSTMYSQL_PORTMYSQL_USERMYSQL_PASSWORDMYSQL_DATABASEMYSQL_POOL_NAMEMYSQL_POOL_SIZEMYSQL_AUTOCOMMITMYSQL_CHARSETAzure OpenAI notes:
gpt-5.1 through the Responses API.gpt-5.1 is called through the Python SDK with base_url=.../openai/v1/.AZURE_OPENAI_DEPLOYMENT should be the Azure deployment name passed to client.responses.create(model=...).The root compose.yml can start postgres, chromadb, fastapi, and streamlit together. However, fastapi and streamlit currently assume prebuilt local images named ragpon-fastapi and ragpon-streamlit, so additional build/setup work is required before docker compose up.
Notes:
compose.yml includes a PostgreSQL service, but the FastAPI implementation currently defaults to DB_TYPE = "mysql".pytest
Run a specific test file if needed:
pytest tests/test_config.py
Sphinx sources are located in docs/source/.
cd docs
make html
.
├── ragpon
│ ├── apps
│ ├── config
│ ├── domain
│ ├── examples
│ ├── ml_models
│ ├── repository
│ └── service
├── tests
├── docs
├── visualization
├── pyproject.toml
└── compose.yml
See LICENSE.
ragpon is a Python project for RAG (Retrieval Augmented Generation) over Japanese documents. It includes document ingestion, chunking, BM25 and vector search, reranking, and application layers built with FastAPI and Streamlit.
.docx), and PowerPoint (.pptx) filesDataFrame objects directlyragpon/
Core library code, including configuration, document readers, chunk processors, repositories, models, and services.ragpon/apps/fastapi/
API server that integrates with OpenAI or Azure OpenAI and provides the RAG backend.ragpon/apps/streamlit/
Streamlit-based frontend UI.ragpon/examples/
Sample configuration files and usage examples.tests/
Unit tests.docs/
Sphinx documentation scaffold.>=3.11,<3.14pipJapanese chunking uses ja_ginza, so install dependencies including the related model packages during setup.
poetry install
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Sample configuration files:
ragpon/examples/sample_config.ymlragpon/apps/fastapi/config/sample_config.ymlAt minimum, review these keys:
MODELS.CL_NAGOYA_RURI_V3_MODEL_PATHMODELS.RURI_RERANKER_LARGE_PATHDATABASES.USE_BM25DATABASES.BM25_PATHDATABASES.USE_CHROMADBDATABASES.CHROMADB_COLLECTION_NAMEDATABASES.CHROMADB_FOLDER_PATHWhen this repository is cloned from GitHub, local model files are not included.
For the FastAPI app, prepare the Hugging Face model directory
models--cl-nagoya--ruri-v3-310m under
ragpon/apps/fastapi/models/, then point
MODELS.CL_NAGOYA_RURI_V3_MODEL_PATH at its snapshots/<revision> directory.
See ragpon/apps/fastapi/models/README.md.
LLM configuration is controlled through environment variables.
export OPENAI_TYPE=openai
export OPENAI_API_KEY=YOUR_API_KEY
export OPENAI_MODEL=gpt-4o-mini
export OPENAI_TYPE=azure
export AZURE_OPENAI_ENDPOINT=YOUR_ENDPOINT
export AZURE_OPENAI_API_KEY=YOUR_API_KEY
export AZURE_OPENAI_DEPLOYMENT=YOUR_DEPLOYMENT
export AZURE_OPENAI_MODEL=gpt-5.1
A minimal example is available in ragpon/examples/basic_usage.py.
from ragpon import Config, DocumentProcessingService, JAGinzaChunkProcessor
config = Config("ragpon/examples/sample_config.yml")
service = DocumentProcessingService(
config_or_config_path=config,
chunk_processor=JAGinzaChunkProcessor(chunk_size=300),
)
service.process_file("path/to/document.pdf")
results = service.search(query="What is ragpon?")
print(results)
DocumentProcessingService provides these main operations:
process_file: ingest a fileprocess_dataframe: ingest a DataFrame as-isprocess_dataframe_with_chunking: chunk a text column in a DataFrame before ingestingsearch: run retrievalenhance_search_results: attach surrounding context to resultsrerank_results: rerank retrieved resultsdelete_by_ids / delete_by_metadata: remove indexed dataFastAPI:
uvicorn ragpon.apps.fastapi.fast_api_app:app --host 0.0.0.0 --port 8006 --workers 4
Streamlit:
streamlit run ragpon/apps/streamlit/streamlit_app.py --server.port 8005 --server.address 0.0.0.0
Exposed ports:
http://localhost:8005http://localhost:8006Example environment variables:
OPENAI_API_KEYOPENAI_TYPEOPENAI_MODELMYSQL_HOSTMYSQL_PORTMYSQL_USERMYSQL_PASSWORDMYSQL_DATABASEMYSQL_POOL_NAMEMYSQL_POOL_SIZEMYSQL_AUTOCOMMITMYSQL_CHARSETAzure OpenAI notes:
gpt-5.1 through the Responses API.gpt-5.1 is called through the Python SDK with base_url=.../openai/v1/.AZURE_OPENAI_DEPLOYMENT should be the Azure deployment name passed to client.responses.create(model=...).The root compose.yml can start postgres, chromadb, fastapi, and streamlit together. However, fastapi and streamlit currently assume prebuilt local images named ragpon-fastapi and ragpon-streamlit, so additional build/setup work is required before docker compose up.
Notes:
compose.yml includes a PostgreSQL service, but the FastAPI implementation currently defaults to DB_TYPE = "mysql".pytest
Run a specific test file if needed:
pytest tests/test_config.py
Sphinx sources are located in docs/source/.
cd docs
make html
.
├── ragpon
│ ├── apps
│ ├── config
│ ├── domain
│ ├── examples
│ ├── ml_models
│ ├── repository
│ └── service
├── tests
├── docs
├── visualization
├── pyproject.toml
└── compose.yml
See LICENSE.