Skip to content

feat: add OpenAI LLM generator - #1

Closed
UdayKumar9381 wants to merge 42 commits into
mainfrom
feat/openai-generator
Closed

UdayKumar9381 wants to merge 42 commits into
mainfrom
feat/openai-generator

Conversation

@UdayKumar9381

Copy link
Copy Markdown
Owner

Summary

  • add OpenAIGenerator using the OpenAI Chat Completions API
  • support model, API key/env fallback, system prompt, and max tokens
  • add mocked unit tests and OpenAI usage example
  • export generator and update changelog

Testing

  • pytest tests/ -v — 93 passed
  • ruff check ragframework/generator/openai.py tests/test_generator/test_openai.py — passed
  • mypy ragframework/ — passed
  • python -m py_compile examples/openai_rag.py — passed

Closes adaumsilva#8

hardik47278 and others added 30 commits September 12, 2026 23:00
…-generator

feat: add AnthropicGenerator for grounded RAG answers
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
style: add missing newline to pipeline exports
Signed-off-by: Aditya Datta <crazyme07071996@gmail.com>
…and-release-setup

Chore/issue backlog and release setup
…structions

README: install from PyPI, live version badge
Signed-off-by: NesrineGharbi77 <161094617+NesrineGharbi77@users.noreply.github.com>
Use a dedicated pre-commit Python 3.10 environment with NumPy 2.2.6 so the mypy hook matches the project's type-check target. Document the requirement and include the getting-started EOF fix.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…er-tooling-precommit-dependabot

chore: add pre-commit hooks and Dependabot
Bumps the github-actions group with 4 updates: [actions/checkout](https://github.com/actions/checkout), [actions/setup-python](https://github.com/actions/setup-python), [codecov/codecov-action](https://github.com/codecov/codecov-action) and [actions/github-script](https://github.com/actions/github-script).


Updates `actions/checkout` from 4 to 7
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v4...v7)

Updates `actions/setup-python` from 5 to 7
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](actions/setup-python@v5...v7)

Updates `codecov/codecov-action` from 4 to 7
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](codecov/codecov-action@v4...v7)

Updates `actions/github-script` from 7 to 9
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](actions/github-script@v7...v9)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/setup-python
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: codecov/codecov-action
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/github-script
  dependency-version: '9'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
adaumsilva and others added 4 commits September 19, 2026 18:14
…tions/github-actions-9032fad1cb

chore(deps): bump the github-actions group with 4 updates
…me-contributing

docs: add pre-commit steps to README and PR checklist
Signed-off-by: Aditya Datta <crazyme07071996@gmail.com>
@UdayKumar9381

Copy link
Copy Markdown
Owner Author

Hi @adaumsilva,

I've completed the OpenAI LLM Generator implementation for Issue adaumsilva#8 and opened this draft PR.

The implementation includes:

  • OpenAIGenerator with configurable model, API key/env fallback, system prompt, and max tokens
  • Context formatting with numbered chunks
  • GeneratorError handling
  • Mocked unit tests
  • Package export
  • OpenAI RAG example
  • CHANGELOG update

Validation:

  • 93 tests passed
  • Ruff passed
  • Mypy passed
  • Example compilation passed

The PR is currently conflict-free and ready for your review.

Thanks!

JJJ-NONAME and others added 6 commits September 21, 2026 09:31
…line

fix: honor RAG pipeline configuration
…-validation

Thanks for the implementation and regression coverage. Batch validation now protects existing retriever state, dimension errors are descriptive, and the shared helper preserves FAISS behavior.

I verified all 55 in-memory and FAISS retriever tests locally, along with lint and formatting checks for the changed Python files. CI is green. Approved—ready to merge.
…t-loaders

Thanks for adding the CSV and JSONL loaders. The implementation meets issue adaumsilva#36’s requirements, with good coverage for selected fields, stable IDs, metadata, malformed records, and file errors.

I verified all 52 loader tests locally, plus lint and formatting checks. CI is green. Approved—I’ll handle the CHANGELOG.md conflict before merging.
@adaumsilva

Copy link
Copy Markdown

Hi @UdayKumar9381, thanks for picking this up! The implementation looks solid overall. A few things before I can review it properly:

1. The PR is opened against your fork, not this repo.
The base is UdayKumar9381/RAG-framework:main, so it doesn't show up here. Please close it and open a new one from the same branch with base repository: adaumsilva/RAG-framework, base: main. On the compare page, use the "base repository" dropdown.

2. Please sync with upstream first. Your fork is about 40 commits behind, and the branch currently conflicts with main in CHANGELOG.md and ragframework/generator/__init__.py (AnthropicGenerator has landed since you forked).

git remote add upstream https://github.com/adaumsilva/RAG-framework.git
git fetch upstream
git rebase upstream/main
git push --force-with-lease

When resolving: keep both exports in __init__.py, and move your changelog line under ## [Unreleased] → ### Added (0.2.0 is already released).

3. The import guard needs to be lazy (this breaks CI). openai.py raises ImportError at module import time, and generator/__init__.py imports it unconditionally. So without the openai extra installed, from ragframework.generator import EchoGenerator fails. CI doesn't install openai, so the whole generator test package errors out. Please move the from openai import OpenAI inside __init__, the same way ragframework/generator/anthropic.py does it.

4. Tests shouldn't need the real openai package. Right now they construct a real client and patch its methods. Please follow the pattern in tests/test_generator/test_anthropic.py (a fake module injected via sys.modules), so they pass in CI without the extra. While you're there, please add tests for (a) the missing-package ImportError and (b) a missing API key.

Smaller things:

  • Validate the API key up front and raise a clear GeneratorError ("Pass api_key or set OPENAI_API_KEY"), like AnthropicGenerator does.
  • Add a trailing newline to examples/openai_rag.py and generator/__init__.py, and run ruff format on the new files.
  • Update the roadmap row in README.md for the OpenAI generator.

Once that's up against this repo with CI green, I'll review it right away. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAI LLM Generator

7 participants