diff --git a/.github/workflows/ci-images.yml b/.github/workflows/ci-images.yml index 273d3dea..b96bac0f 100644 --- a/.github/workflows/ci-images.yml +++ b/.github/workflows/ci-images.yml @@ -15,7 +15,7 @@ on: jobs: build: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b05a4a0c..57235cc1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: jobs: bats: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: install bats @@ -25,7 +25,7 @@ jobs: make bats bats-nocontainer: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: install bats @@ -41,7 +41,7 @@ jobs: make bats-nocontainer docker: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: install bats @@ -77,7 +77,7 @@ jobs: make bats-docker macos: - runs-on: macos-14 + runs-on: macos-latest steps: - uses: actions/checkout@v4 - name: install golang diff --git a/.github/workflows/latest.yml b/.github/workflows/latest.yml index 232d7c0a..8e77c730 100644 --- a/.github/workflows/latest.yml +++ b/.github/workflows/latest.yml @@ -6,7 +6,7 @@ on: jobs: linux: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Free Disk Space Linux @@ -41,7 +41,7 @@ jobs: run: make test macos: - runs-on: macos-14 + runs-on: macos-latest steps: - uses: actions/checkout@v4 - name: install golang @@ -52,7 +52,7 @@ jobs: run: make test build: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest needs: [linux, macos] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 49726b28..96186e28 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -6,7 +6,7 @@ on: jobs: linux: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Free Disk Space Linux @@ -36,7 +36,7 @@ jobs: run: make test macos: - runs-on: macos-14 + runs-on: macos-latest steps: - uses: actions/checkout@v4 - name: install golang @@ -47,7 +47,7 @@ jobs: run: make test build: - runs-on: ubuntu-24.04 + runs-on: ubuntu-latest needs: [linux, macos] steps: - uses: actions/checkout@v4 diff --git a/docs/ramalama-info.1.md b/docs/ramalama-info.1.md index 5664848e..d6ad6143 100644 --- a/docs/ramalama-info.1.md +++ b/docs/ramalama-info.1.md @@ -1,7 +1,7 @@ % ramalama-info 1 ## NAME -ramalama\-info - Display RamaLama configuration information +ramalama\-info - display RamaLama configuration information ## SYNOPSIS diff --git a/docs/ramalama-rag.1.md b/docs/ramalama-rag.1.md new file mode 100644 index 00000000..a6bfa7cf --- /dev/null +++ b/docs/ramalama-rag.1.md @@ -0,0 +1,28 @@ +% ramalama-rag 1 + +## NAME +ramalama\-rag - generate rag (Retrieval Augmented Generation) data from provided documents and convert into an OCI Image + +## SYNOPSIS +**ramalama rag** [options] [path ...] image + + +## DESCRIPTION +Generate rag data from provided documents and convert into an OCI Image + +positional arguments: + path Files/Directory containing PDF, DOCX, PPTX, XLSX, HTML, AsciiDoc & Markdown formatted files to be processed. Can be specified multiple times. + + image OCI Image name to contain processed rag data + + +## OPTIONS + +#### **--help**, **-h** +Print usage message + +## SEE ALSO +**[ramalama(1)](ramalama.1.md)** + +## HISTORY +Dec 2024, Originally compiled by Dan Walsh diff --git a/docs/ramalama.1.md b/docs/ramalama.1.md index 6f575d92..c450b096 100644 --- a/docs/ramalama.1.md +++ b/docs/ramalama.1.md @@ -129,7 +129,8 @@ The default can be overridden in the ramalama.conf file. | Command | Description | | ------------------------------------------------- | ---------------------------------------------------------- | | [ramalama-containers(1)](ramalama-containers.1.md)| list all RamaLama containers | -| [ramalama-info(1)](ramalama-info.1.md) | Display RamaLama configuration information | +| [ramalama-rag(1)](ramalama-rag.1.md) | generate rag (Retrieval Augmented Generation) data from provided documents and convert into an OCI Image | +| [ramalama-info(1)](ramalama-info.1.md) | display RamaLama configuration information | | [ramalama-list(1)](ramalama-list.1.md) | list all downloaded AI Models | | [ramalama-login(1)](ramalama-login.1.md) | login to remote registry | | [ramalama-logout(1)](ramalama-logout.1.md) | logout from remote registry | diff --git a/ramalama/cli.py b/ramalama/cli.py index 12f139fe..44014aea 100644 --- a/ramalama/cli.py +++ b/ramalama/cli.py @@ -6,6 +6,7 @@ import subprocess import time import ramalama.oci +import ramalama.rag from ramalama.huggingface import Huggingface from ramalama.common import ( @@ -15,6 +16,7 @@ perror, run_cmd, ) + from ramalama.model import model_types from ramalama.oci import OCI from ramalama.ollama import Ollama @@ -232,6 +234,7 @@ def configure_subcommands(parser): logout_parser(subparsers) pull_parser(subparsers) push_parser(subparsers) + rag_parser(subparsers) rm_parser(subparsers) run_parser(subparsers) serve_parser(subparsers) @@ -405,7 +408,7 @@ def list_containers(args): def info_parser(subparsers): - parser = subparsers.add_parser("info", help="Display information pertaining to setup of RamaLama.") + parser = subparsers.add_parser("info", help="display information pertaining to setup of RamaLama.") parser.add_argument("--container", default=False, action="store_false", help=argparse.SUPPRESS) parser.set_defaults(func=info_cli) @@ -730,6 +733,26 @@ def version_parser(subparsers): parser.set_defaults(func=print_version) +def rag_parser(subparsers): + parser = subparsers.add_parser( + "rag", + help="generate rag (Retrieval Augmented Generation) data from provided documents and convert into an OCI Image", + ) + parser.add_argument( + "PATH", + nargs="*", + help="""\ +Files/Directory containing PDF, DOCX, PPTX, XLSX, HTML, AsciiDoc & Markdown +formatted files to be processed""", + ) + parser.add_argument("IMAGE", help="OCI Image name to contain processed rag data") + parser.set_defaults(func=rag_cli) + + +def rag_cli(args): + ramalama.rag.generate(args) + + def rm_parser(subparsers): parser = subparsers.add_parser("rm", help="remove AI Model from local storage") parser.add_argument("--container", default=False, action="store_false", help=argparse.SUPPRESS) diff --git a/ramalama/rag.py b/ramalama/rag.py new file mode 100644 index 00000000..a4530217 --- /dev/null +++ b/ramalama/rag.py @@ -0,0 +1,3 @@ +def generate(args): + print(args.PATH) + print(args.IMAGE)