Full Code of zylon-ai/private-gpt for AI

main 7effd57c845a cached
159 files
438.5 KB
109.7k tokens
327 symbols
1 requests
Download .txt
Showing preview only (477K chars total). Download the full file or copy to clipboard to get everything.
Repository: zylon-ai/private-gpt
Branch: main
Commit: 7effd57c845a
Files: 159
Total size: 438.5 KB

Directory structure:
gitextract_oevz0y2u/

├── .docker/
│   └── router.yml
├── .dockerignore
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug.yml
│   │   ├── config.yml
│   │   ├── docs.yml
│   │   ├── feature.yml
│   │   └── question.yml
│   ├── pull_request_template.md
│   ├── release_please/
│   │   ├── .release-please-config.json
│   │   └── .release-please-manifest.json
│   └── workflows/
│       ├── actions/
│       │   └── install_dependencies/
│       │       └── action.yml
│       ├── fern-check.yml
│       ├── generate-release.yml
│       ├── preview-docs.yml
│       ├── publish-docs.yml
│       ├── release-please.yml
│       ├── stale.yml
│       └── tests.yml
├── .gitignore
├── .pre-commit-config.yaml
├── CHANGELOG.md
├── CITATION.cff
├── Dockerfile.llamacpp-cpu
├── Dockerfile.ollama
├── LICENSE
├── Makefile
├── README.md
├── docker-compose.yaml
├── fern/
│   ├── README.md
│   ├── docs/
│   │   └── pages/
│   │       ├── api-reference/
│   │       │   ├── api-reference.mdx
│   │       │   └── sdks.mdx
│   │       ├── installation/
│   │       │   ├── concepts.mdx
│   │       │   ├── installation.mdx
│   │       │   └── troubleshooting.mdx
│   │       ├── manual/
│   │       │   ├── ingestion-reset.mdx
│   │       │   ├── ingestion.mdx
│   │       │   ├── llms.mdx
│   │       │   ├── nodestore.mdx
│   │       │   ├── reranker.mdx
│   │       │   ├── settings.mdx
│   │       │   └── vectordb.mdx
│   │       ├── overview/
│   │       │   └── welcome.mdx
│   │       ├── quickstart/
│   │       │   └── quickstart.mdx
│   │       ├── recipes/
│   │       │   ├── quickstart.mdx
│   │       │   └── summarize.mdx
│   │       └── ui/
│   │           ├── alternatives.mdx
│   │           └── gradio.mdx
│   ├── docs.yml
│   ├── fern.config.json
│   ├── generators.yml
│   └── openapi/
│       └── openapi.json
├── local_data/
│   └── .gitignore
├── models/
│   └── .gitignore
├── private_gpt/
│   ├── __init__.py
│   ├── __main__.py
│   ├── components/
│   │   ├── __init__.py
│   │   ├── embedding/
│   │   │   ├── __init__.py
│   │   │   ├── custom/
│   │   │   │   ├── __init__.py
│   │   │   │   └── sagemaker.py
│   │   │   └── embedding_component.py
│   │   ├── ingest/
│   │   │   ├── __init__.py
│   │   │   ├── ingest_component.py
│   │   │   └── ingest_helper.py
│   │   ├── llm/
│   │   │   ├── __init__.py
│   │   │   ├── custom/
│   │   │   │   ├── __init__.py
│   │   │   │   └── sagemaker.py
│   │   │   ├── llm_component.py
│   │   │   └── prompt_helper.py
│   │   ├── node_store/
│   │   │   ├── __init__.py
│   │   │   └── node_store_component.py
│   │   └── vector_store/
│   │       ├── __init__.py
│   │       ├── batched_chroma.py
│   │       └── vector_store_component.py
│   ├── constants.py
│   ├── di.py
│   ├── launcher.py
│   ├── main.py
│   ├── open_ai/
│   │   ├── __init__.py
│   │   ├── extensions/
│   │   │   ├── __init__.py
│   │   │   └── context_filter.py
│   │   └── openai_models.py
│   ├── paths.py
│   ├── server/
│   │   ├── __init__.py
│   │   ├── chat/
│   │   │   ├── __init__.py
│   │   │   ├── chat_router.py
│   │   │   └── chat_service.py
│   │   ├── chunks/
│   │   │   ├── __init__.py
│   │   │   ├── chunks_router.py
│   │   │   └── chunks_service.py
│   │   ├── completions/
│   │   │   ├── __init__.py
│   │   │   └── completions_router.py
│   │   ├── embeddings/
│   │   │   ├── __init__.py
│   │   │   ├── embeddings_router.py
│   │   │   └── embeddings_service.py
│   │   ├── health/
│   │   │   ├── __init__.py
│   │   │   └── health_router.py
│   │   ├── ingest/
│   │   │   ├── __init__.py
│   │   │   ├── ingest_router.py
│   │   │   ├── ingest_service.py
│   │   │   ├── ingest_watcher.py
│   │   │   └── model.py
│   │   ├── recipes/
│   │   │   └── summarize/
│   │   │       ├── __init__.py
│   │   │       ├── summarize_router.py
│   │   │       └── summarize_service.py
│   │   └── utils/
│   │       ├── __init__.py
│   │       └── auth.py
│   ├── settings/
│   │   ├── __init__.py
│   │   ├── settings.py
│   │   ├── settings_loader.py
│   │   └── yaml.py
│   ├── ui/
│   │   ├── __init__.py
│   │   ├── images.py
│   │   └── ui.py
│   └── utils/
│       ├── __init__.py
│       ├── eta.py
│       ├── ollama.py
│       ├── retry.py
│       └── typing.py
├── pyproject.toml
├── scripts/
│   ├── __init__.py
│   ├── extract_openapi.py
│   ├── ingest_folder.py
│   ├── setup
│   └── utils.py
├── settings-azopenai.yaml
├── settings-docker.yaml
├── settings-gemini.yaml
├── settings-local.yaml
├── settings-mock.yaml
├── settings-ollama-pg.yaml
├── settings-ollama.yaml
├── settings-openai.yaml
├── settings-sagemaker.yaml
├── settings-test.yaml
├── settings-vllm.yaml
├── settings.yaml
├── tests/
│   ├── __init__.py
│   ├── conftest.py
│   ├── fixtures/
│   │   ├── __init__.py
│   │   ├── auto_close_qdrant.py
│   │   ├── fast_api_test_client.py
│   │   ├── ingest_helper.py
│   │   └── mock_injector.py
│   ├── server/
│   │   ├── chat/
│   │   │   └── test_chat_routes.py
│   │   ├── chunks/
│   │   │   ├── chunk_test.txt
│   │   │   └── test_chunk_routes.py
│   │   ├── embeddings/
│   │   │   └── test_embedding_routes.py
│   │   ├── ingest/
│   │   │   ├── test.txt
│   │   │   ├── test_ingest_routes.py
│   │   │   └── test_local_ingest.py
│   │   ├── recipes/
│   │   │   └── test_summarize_router.py
│   │   └── utils/
│   │       ├── test_auth.py
│   │       └── test_simple_auth.py
│   ├── settings/
│   │   ├── test_settings.py
│   │   └── test_settings_loader.py
│   ├── test_prompt_helper.py
│   └── ui/
│       └── test_ui.py
├── tiktoken_cache/
│   └── .gitignore
└── version.txt

================================================
FILE CONTENTS
================================================

================================================
FILE: .docker/router.yml
================================================
http:
  services:
    ollama:
      loadBalancer:
        healthCheck:
          interval: 5s
          path: /
        servers:
          - url: http://ollama-cpu:11434
          - url: http://ollama-cuda:11434
          - url: http://host.docker.internal:11434

  routers:
    ollama-router:
      rule: "PathPrefix(`/`)"
      service: ollama

================================================
FILE: .dockerignore
================================================
.venv
models
.github
.vscode
.DS_Store
.mypy_cache
.ruff_cache
local_data
terraform
tests
Dockerfile
Dockerfile.*

================================================
FILE: .github/ISSUE_TEMPLATE/bug.yml
================================================
name: Bug Report
description: Report a bug or issue with the project.
title: "[BUG] "
labels: ["bug"]

body:
  - type: markdown
    attributes:
      value: |
        **Please describe the bug you encountered.**

  - type: checkboxes
    id: pre-check
    attributes:
      label: Pre-check
      description: Please confirm that you have searched for duplicate issues before creating this one.
      options:
        - label: I have searched the existing issues and none cover this bug.
          required: true

  - type: textarea
    id: description
    attributes:
      label: Description
      description: Provide a detailed description of the bug.
      placeholder: "Detailed description of the bug"
    validations:
      required: true

  - type: textarea
    id: steps
    attributes:
      label: Steps to Reproduce
      description: Provide the steps to reproduce the bug.
      placeholder: "1. Step one\n2. Step two\n3. Step three"
    validations:
      required: true

  - type: input
    id: expected
    attributes:
      label: Expected Behavior
      description: Describe what you expected to happen.
      placeholder: "Expected behavior"
    validations:
      required: true

  - type: input
    id: actual
    attributes:
      label: Actual Behavior
      description: Describe what actually happened.
      placeholder: "Actual behavior"
    validations:
      required: true

  - type: input
    id: environment
    attributes:
      label: Environment
      description: Provide details about your environment (e.g., OS, GPU, profile, etc.).
      placeholder: "Environment details"
    validations:
      required: true

  - type: input
    id: additional
    attributes:
      label: Additional Information
      description: Provide any additional information that may be relevant (e.g., logs, screenshots).
      placeholder: "Any additional information that may be relevant"

  - type: input
    id: version
    attributes:
      label: Version
      description: Provide the version of the project where you encountered the bug.
      placeholder: "Version number"

  - type: markdown
    attributes:
      value: |
        **Please ensure the following setup checklist has been reviewed before submitting the bug report.**

  - type: checkboxes
    id: general-setup-checklist
    attributes:
      label: Setup Checklist
      description: Verify the following general aspects of your setup.
      options:
        - label: Confirm that you have followed the installation instructions in the project’s documentation.
        - label: Check that you are using the latest version of the project.
        - label: Verify disk space availability for model storage and data processing.
        - label: Ensure that you have the necessary permissions to run the project.

  - type: checkboxes
    id: nvidia-setup-checklist
    attributes:
      label: NVIDIA GPU Setup Checklist
      description: Verify the following aspects of your NVIDIA GPU setup.
      options:
        - label: Check that the all CUDA dependencies are installed and are compatible with your GPU (refer to [CUDA's documentation](https://docs.nvidia.com/deploy/cuda-compatibility/#frequently-asked-questions))
        - label: Ensure an NVIDIA GPU is installed and recognized by the system (run `nvidia-smi` to verify).
        - label: Ensure proper permissions are set for accessing GPU resources.
        - label: Docker users - Verify that the NVIDIA Container Toolkit is configured correctly (e.g. run `sudo docker run --rm --gpus all nvidia/cuda:11.0.3-base-ubuntu20.04 nvidia-smi`)


================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
  - name: Documentation
    url: https://docs.privategpt.dev
    about: Please refer to our documentation for more details and guidance.
  - name: Discord
    url: https://discord.gg/bK6mRVpErU
    about: Join our Discord community to ask questions and get help.


================================================
FILE: .github/ISSUE_TEMPLATE/docs.yml
================================================
name: Documentation
description: Suggest a change or addition to the documentation.
title: "[DOCS] "
labels: ["documentation"]

body:
  - type: markdown
    attributes:
      value: |
        **Please describe the documentation change or addition you would like to suggest.**

  - type: textarea
    id: description
    attributes:
      label: Description
      description: Provide a detailed description of the documentation change.
      placeholder: "Detailed description of the documentation change"
    validations:
      required: true


================================================
FILE: .github/ISSUE_TEMPLATE/feature.yml
================================================
name: Enhancement
description: Suggest an enhancement or improvement to the project.
title: "[FEATURE] "
labels: ["enhancement"]

body:
  - type: markdown
    attributes:
      value: |
        **Please describe the enhancement or improvement you would like to suggest.**

  - type: textarea
    id: feature_description
    attributes:
      label: Feature Description
      description: Provide a detailed description of the enhancement.
      placeholder: "Detailed description of the enhancement"
    validations:
      required: true

  - type: textarea
    id: reason
    attributes:
      label: Reason
      description: Explain the reason for this enhancement.
      placeholder: "Reason for the enhancement"
    validations:
      required: true

  - type: textarea
    id: value
    attributes:
      label: Value of Feature
      description: Describe the value or benefits this feature will bring.
      placeholder: "Value or benefits of the feature"
    validations:
      required: true


================================================
FILE: .github/ISSUE_TEMPLATE/question.yml
================================================
name: Question
description: Ask a question about the project.
title: "[QUESTION] "
labels: ["question"]

body:
  - type: markdown
    attributes:
      value: |
        **Please describe your question in detail.**

  - type: textarea
    id: question
    attributes:
      label: Question
      description: Provide a detailed description of your question.
      placeholder: "Detailed description of the question"
    validations:
      required: true


================================================
FILE: .github/pull_request_template.md
================================================
# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

## Type of Change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

- [ ] Added new unit/integration tests
- [ ] I stared at the code and made sure it makes sense

**Test Configuration**:
* Firmware version:
* Hardware:
* Toolchain:
* SDK:

## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules
- [ ] I ran `make check; make test` to ensure mypy and tests pass

================================================
FILE: .github/release_please/.release-please-config.json
================================================
{
    "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
    "release-type": "simple",
    "version-file": "version.txt",
    "extra-files": [
      {
        "type": "toml",
        "path": "pyproject.toml",
        "jsonpath": "$.tool.poetry.version"
      },
      {
        "type": "generic",
        "path": "docker-compose.yaml"
      }
    ],
    "packages": {
      ".": {}
    }
  }

================================================
FILE: .github/release_please/.release-please-manifest.json
================================================
{
  ".": "0.6.2"
}

================================================
FILE: .github/workflows/actions/install_dependencies/action.yml
================================================
name: "Install Dependencies"
description: "Action to build the project dependencies from the main versions"
inputs:
  python_version:
    required: true
    type: string
    default: "3.11.4"
  poetry_version:
    required: true
    type: string
    default: "1.8.3"

runs:
  using: composite
  steps:
    - name: Install Poetry
      uses: snok/install-poetry@v1
      with:
        version: ${{ inputs.poetry_version }}
        virtualenvs-create: true
        virtualenvs-in-project: false
        installer-parallel: true
    - uses: actions/setup-python@v4
      with:
        python-version: ${{ inputs.python_version }}
        cache: "poetry"
    - name: Install Dependencies
      run: poetry install --extras "ui vector-stores-qdrant" --no-root
      shell: bash



================================================
FILE: .github/workflows/fern-check.yml
================================================
name: fern check

on:
  pull_request:
    branches:
      - main
    paths:
      - "fern/**"
      
jobs:
  fern-check:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4

      - name: Install Fern
        run:  npm install -g fern-api

      - name: Check Fern API is valid
        run: fern check

================================================
FILE: .github/workflows/generate-release.yml
================================================
name: generate-release

on:
  release:
    types: [ published ]
  workflow_dispatch:

env:
  REGISTRY: docker.io
  IMAGE_NAME: zylonai/private-gpt
  platforms: linux/amd64,linux/arm64
  DEFAULT_TYPE: "ollama"

jobs:
  build-and-push-image:
    runs-on: ubuntu-latest

    strategy:
      matrix:
        type: [ llamacpp-cpu, ollama ]

    permissions:
      contents: read
      packages: write

    outputs:
      version: ${{ steps.version.outputs.version }}

    steps:
      - name: Free Disk Space (Ubuntu)
        uses: jlumbroso/free-disk-space@main
        with:
          tool-cache: false
          android: true
          dotnet: true
          haskell: true
          large-packages: true
          docker-images: false
          swap-storage: true

      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Log in to Docker Hub
        uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}

      - name: Extract metadata (tags, labels) for Docker
        id: meta
        uses: docker/metadata-action@v5
        with:
          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
          tags: |
            type=semver,pattern={{version}},enable=${{ matrix.type == env.DEFAULT_TYPE }}
            type=semver,pattern={{version}}-${{ matrix.type }}
            type=semver,pattern={{major}}.{{minor}},enable=${{ matrix.type == env.DEFAULT_TYPE }}
            type=semver,pattern={{major}}.{{minor}}-${{ matrix.type }}
            type=raw,value=latest,enable=${{ matrix.type == env.DEFAULT_TYPE }}
            type=sha
          flavor: |
            latest=false

      - name: Build and push Docker image
        uses: docker/build-push-action@v6
        with:
          context: .
          file: Dockerfile.${{ matrix.type }}
          platforms: ${{ env.platforms }}
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}

      - name: Version output
        id: version
        run: echo "version=${{ steps.meta.outputs.version }}" >> "$GITHUB_OUTPUT"

================================================
FILE: .github/workflows/preview-docs.yml
================================================
name: deploy preview docs

on:
  pull_request_target:
    branches:
      - main
    paths:
      - "fern/**"

jobs:
  preview-docs:
    runs-on: ubuntu-latest

    permissions:
      contents: read
      pull-requests: write

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          ref: refs/pull/${{ github.event.pull_request.number }}/merge

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "18"

      - name: Install Fern
        run: npm install -g fern-api

      - name: Generate Documentation Preview with Fern
        id: generate_docs
        env:
          FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
        run: |
          output=$(fern generate --docs --preview --log-level debug)
          echo "$output"
          # Extract the URL
          preview_url=$(echo "$output" | grep -oP '(?<=Published docs to )https://[^\s]*')
          # Set the output for the step
          echo "::set-output name=preview_url::$preview_url"
      - name: Comment PR with URL using github-actions bot
        uses: actions/github-script@v7
        if: ${{ steps.generate_docs.outputs.preview_url }}
        with:
          script: |
            const preview_url = '${{ steps.generate_docs.outputs.preview_url }}';
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: `Published docs preview URL: ${preview_url}`
            })


================================================
FILE: .github/workflows/publish-docs.yml
================================================
name: publish docs

on: 
  push: 
    branches: 
      - main
    paths:
      - "fern/**"

jobs:
  publish-docs:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repo
        uses: actions/checkout@v4

      - name: Setup node
        uses: actions/setup-node@v3

      - name: Download Fern
        run: npm install -g fern-api

      - name: Generate and Publish Docs
        env:
          FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
        run: fern generate --docs --log-level debug


================================================
FILE: .github/workflows/release-please.yml
================================================
name: release-please

on:
  push:
    branches:
      - main

permissions:
  contents: write
  pull-requests: write

jobs:
  release-please:
    runs-on: ubuntu-latest
    steps:
      - uses: google-github-actions/release-please-action@v4
        id: release
        with:
          config-file: .github/release_please/.release-please-config.json
          manifest-file: .github/release_please/.release-please-manifest.json


================================================
FILE: .github/workflows/stale.yml
================================================
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests

on:
  schedule:
  - cron: '42 5 * * *'

jobs:
  stale:

    runs-on: ubuntu-latest
    permissions:
      issues: write
      pull-requests: write

    steps:
    - uses: actions/stale@v8
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        days-before-stale: 15
        stale-issue-message: 'Stale issue'
        stale-pr-message: 'Stale pull request'
        stale-issue-label: 'stale'
        stale-pr-label: 'stale'
        exempt-issue-labels: 'autorelease: pending'
        exempt-pr-labels: 'autorelease: pending'


================================================
FILE: .github/workflows/tests.yml
================================================
name: tests

on:
  push:
    branches:
      - main
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.head_ref || github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
  setup:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/workflows/actions/install_dependencies

  checks:
    needs: setup
    runs-on: ubuntu-latest
    name: ${{ matrix.quality-command }}
    strategy:
      matrix:
        quality-command:
          - black
          - ruff
          - mypy
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/workflows/actions/install_dependencies
      - name: run ${{ matrix.quality-command }}
        run: make ${{ matrix.quality-command }}

  test:
    needs: setup
    runs-on: ubuntu-latest
    name: test
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/workflows/actions/install_dependencies
      - name: run test
        run: make test-coverage
      # Run even if make test fails for coverage reports
      # TODO: select a better xml results displayer
      - name: Archive test results coverage results
        uses: actions/upload-artifact@v3
        if: always()
        with:
          name: test_results
          path: tests-results.xml
      - name: Archive code coverage results
        uses: actions/upload-artifact@v3
        if: always()
        with:
          name: code-coverage-report
          path: htmlcov/

  all_checks_passed:
    # Used to easily force requirements checks in GitHub
    needs:
      - checks
      - test
    runs-on: ubuntu-latest
    steps:
      - run: echo "All checks passed"


================================================
FILE: .gitignore
================================================
.venv
.env
venv

settings-me.yaml

.ruff_cache
.pytest_cache
.mypy_cache

# byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# unit tests / coverage reports
/tests-results.xml
/.coverage
/coverage.xml
/htmlcov/

# pyenv
/.python-version

# IDE
.idea/
.vscode/
/.run/
.fleet/

# macOS
.DS_Store


================================================
FILE: .pre-commit-config.yaml
================================================
default_install_hook_types:
# Mandatory to install both pre-commit and pre-push hooks (see https://pre-commit.com/#top_level-default_install_hook_types)
# Add new hook types here to ensure automatic installation when running `pre-commit install`
- pre-commit
- pre-push
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
  rev: v4.3.0
  hooks:
  - id: trailing-whitespace
  - id: end-of-file-fixer
  - id: check-yaml
  - id: check-json
  - id: check-added-large-files

- repo: local
  hooks:
  - id: black
    name: Formatting (black)
    entry: black
    language: system
    types: [python]
    stages: [commit]
  - id: ruff
    name: Linter (ruff)
    entry: ruff
    language: system
    types: [python]
    stages: [commit]
  - id: mypy
    name: Type checking (mypy)
    entry: make mypy
    pass_filenames: false
    language: system
    types: [python]
    stages: [commit]
  - id: test
    name: Unit tests (pytest)
    entry: make test
    pass_filenames: false
    language: system
    types: [python]
    stages: [push]

================================================
FILE: CHANGELOG.md
================================================
# Changelog

## [0.6.2](https://github.com/zylon-ai/private-gpt/compare/v0.6.1...v0.6.2) (2024-08-08)


### Bug Fixes

* add numpy issue to troubleshooting ([#2048](https://github.com/zylon-ai/private-gpt/issues/2048)) ([4ca6d0c](https://github.com/zylon-ai/private-gpt/commit/4ca6d0cb556be7a598f7d3e3b00d2a29214ee1e8))
* auto-update version ([#2052](https://github.com/zylon-ai/private-gpt/issues/2052)) ([7fefe40](https://github.com/zylon-ai/private-gpt/commit/7fefe408b4267684c6e3c1a43c5dc2b73ec61fe4))
* publish image name ([#2043](https://github.com/zylon-ai/private-gpt/issues/2043)) ([b1acf9d](https://github.com/zylon-ai/private-gpt/commit/b1acf9dc2cbca2047cd0087f13254ff5cda6e570))
* update matplotlib to 3.9.1-post1 to fix win install ([b16abbe](https://github.com/zylon-ai/private-gpt/commit/b16abbefe49527ac038d235659854b98345d5387))

## [0.6.1](https://github.com/zylon-ai/private-gpt/compare/v0.6.0...v0.6.1) (2024-08-05)


### Bug Fixes

* add built image from DockerHub ([#2042](https://github.com/zylon-ai/private-gpt/issues/2042)) ([f09f6dd](https://github.com/zylon-ai/private-gpt/commit/f09f6dd2553077d4566dbe6b48a450e05c2f049e))
* Adding azopenai to model list ([#2035](https://github.com/zylon-ai/private-gpt/issues/2035)) ([1c665f7](https://github.com/zylon-ai/private-gpt/commit/1c665f7900658144f62814b51f6e3434a6d7377f))
* **deploy:** generate docker release when new version is released ([#2038](https://github.com/zylon-ai/private-gpt/issues/2038)) ([1d4c14d](https://github.com/zylon-ai/private-gpt/commit/1d4c14d7a3c383c874b323d934be01afbaca899e))
* **deploy:** improve Docker-Compose and quickstart on Docker ([#2037](https://github.com/zylon-ai/private-gpt/issues/2037)) ([dae0727](https://github.com/zylon-ai/private-gpt/commit/dae0727a1b4abd35d2b0851fe30e0a4ed67e0fbb))

## [0.6.0](https://github.com/zylon-ai/private-gpt/compare/v0.5.0...v0.6.0) (2024-08-02)


### Features

* bump dependencies ([#1987](https://github.com/zylon-ai/private-gpt/issues/1987)) ([b687dc8](https://github.com/zylon-ai/private-gpt/commit/b687dc852413404c52d26dcb94536351a63b169d))
* **docs:** add privategpt-ts sdk ([#1924](https://github.com/zylon-ai/private-gpt/issues/1924)) ([d13029a](https://github.com/zylon-ai/private-gpt/commit/d13029a046f6e19e8ee65bef3acd96365c738df2))
* **docs:** Fix setup docu ([#1926](https://github.com/zylon-ai/private-gpt/issues/1926)) ([067a5f1](https://github.com/zylon-ai/private-gpt/commit/067a5f144ca6e605c99d7dbe9ca7d8207ac8808d))
* **docs:** update doc for ipex-llm ([#1968](https://github.com/zylon-ai/private-gpt/issues/1968)) ([19a7c06](https://github.com/zylon-ai/private-gpt/commit/19a7c065ef7f42b37f289dd28ac945f7afc0e73a))
* **docs:** update documentation and fix preview-docs ([#2000](https://github.com/zylon-ai/private-gpt/issues/2000)) ([4523a30](https://github.com/zylon-ai/private-gpt/commit/4523a30c8f004aac7a7ae224671e2c45ec0cb973))
* **llm:** add progress bar when ollama is pulling models ([#2031](https://github.com/zylon-ai/private-gpt/issues/2031)) ([cf61bf7](https://github.com/zylon-ai/private-gpt/commit/cf61bf780f8d122e4057d002abf03563bb45614a))
* **llm:** autopull ollama models ([#2019](https://github.com/zylon-ai/private-gpt/issues/2019)) ([20bad17](https://github.com/zylon-ai/private-gpt/commit/20bad17c9857809158e689e9671402136c1e3d84))
* **llm:** Support for Google Gemini LLMs and Embeddings ([#1965](https://github.com/zylon-ai/private-gpt/issues/1965)) ([fc13368](https://github.com/zylon-ai/private-gpt/commit/fc13368bc72d1f4c27644677431420ed77731c03))
* make llama3.1 as default ([#2022](https://github.com/zylon-ai/private-gpt/issues/2022)) ([9027d69](https://github.com/zylon-ai/private-gpt/commit/9027d695c11fbb01e62424b855665de71d513417))
* prompt_style applied to all LLMs + extra LLM params. ([#1835](https://github.com/zylon-ai/private-gpt/issues/1835)) ([e21bf20](https://github.com/zylon-ai/private-gpt/commit/e21bf20c10938b24711d9f2c765997f44d7e02a9))
* **recipe:** add our first recipe  `Summarize` ([#2028](https://github.com/zylon-ai/private-gpt/issues/2028)) ([8119842](https://github.com/zylon-ai/private-gpt/commit/8119842ae6f1f5ecfaf42b06fa0d1ffec675def4))
* **vectordb:** Milvus vector db Integration ([#1996](https://github.com/zylon-ai/private-gpt/issues/1996)) ([43cc31f](https://github.com/zylon-ai/private-gpt/commit/43cc31f74015f8d8fcbf7a8ea7d7d9ecc66cf8c9))
* **vectorstore:** Add clickhouse support as vectore store ([#1883](https://github.com/zylon-ai/private-gpt/issues/1883)) ([2612928](https://github.com/zylon-ai/private-gpt/commit/26129288394c7483e6fc0496a11dc35679528cc1))


### Bug Fixes

* "no such group" error in Dockerfile, added docx2txt and cryptography deps ([#1841](https://github.com/zylon-ai/private-gpt/issues/1841)) ([947e737](https://github.com/zylon-ai/private-gpt/commit/947e737f300adf621d2261d527192f36f3387f8e))
* **config:** make tokenizer optional and include a troubleshooting doc ([#1998](https://github.com/zylon-ai/private-gpt/issues/1998)) ([01b7ccd](https://github.com/zylon-ai/private-gpt/commit/01b7ccd0648be032846647c9a184925d3682f612))
* **docs:** Fix concepts.mdx referencing to installation page ([#1779](https://github.com/zylon-ai/private-gpt/issues/1779)) ([dde0224](https://github.com/zylon-ai/private-gpt/commit/dde02245bcd51a7ede7b6789c82ae217cac53d92))
* **docs:** Update installation.mdx ([#1866](https://github.com/zylon-ai/private-gpt/issues/1866)) ([c1802e7](https://github.com/zylon-ai/private-gpt/commit/c1802e7cf0e56a2603213ec3b6a4af8fadb8a17a))
* ffmpy dependency ([#2020](https://github.com/zylon-ai/private-gpt/issues/2020)) ([dabf556](https://github.com/zylon-ai/private-gpt/commit/dabf556dae9cb00fe0262270e5138d982585682e))
* light mode ([#2025](https://github.com/zylon-ai/private-gpt/issues/2025)) ([1020cd5](https://github.com/zylon-ai/private-gpt/commit/1020cd53288af71a17882781f392512568f1b846))
* **LLM:** mistral ignoring assistant messages ([#1954](https://github.com/zylon-ai/private-gpt/issues/1954)) ([c7212ac](https://github.com/zylon-ai/private-gpt/commit/c7212ac7cc891f9e3c713cc206ae9807c5dfdeb6))
* **llm:** special tokens and leading space ([#1831](https://github.com/zylon-ai/private-gpt/issues/1831)) ([347be64](https://github.com/zylon-ai/private-gpt/commit/347be643f7929c56382a77c3f45f0867605e0e0a))
* make embedding_api_base match api_base when on docker ([#1859](https://github.com/zylon-ai/private-gpt/issues/1859)) ([2a432bf](https://github.com/zylon-ai/private-gpt/commit/2a432bf9c5582a94eb4052b1e80cabdb118d298e))
* nomic embeddings ([#2030](https://github.com/zylon-ai/private-gpt/issues/2030)) ([5465958](https://github.com/zylon-ai/private-gpt/commit/54659588b5b109a3dd17cca835e275240464d275))
* prevent to ingest local files (by default) ([#2010](https://github.com/zylon-ai/private-gpt/issues/2010)) ([e54a8fe](https://github.com/zylon-ai/private-gpt/commit/e54a8fe0433252808d0a60f6a08a43c9f5a42f3b))
* Replacing unsafe `eval()` with `json.loads()` ([#1890](https://github.com/zylon-ai/private-gpt/issues/1890)) ([9d0d614](https://github.com/zylon-ai/private-gpt/commit/9d0d614706581a8bfa57db45f62f84ab23d26f15))
* **settings:** enable cors by default so it will work when using ts sdk (spa) ([#1925](https://github.com/zylon-ai/private-gpt/issues/1925)) ([966af47](https://github.com/zylon-ai/private-gpt/commit/966af4771dbe5cf3fdf554b5fdf8f732407859c4))
* **ui:** gradio bug fixes ([#2021](https://github.com/zylon-ai/private-gpt/issues/2021)) ([d4375d0](https://github.com/zylon-ai/private-gpt/commit/d4375d078f18ba53562fd71651159f997fff865f))
* unify embedding models ([#2027](https://github.com/zylon-ai/private-gpt/issues/2027)) ([40638a1](https://github.com/zylon-ai/private-gpt/commit/40638a18a5713d60fec8fe52796dcce66d88258c))

## [0.5.0](https://github.com/zylon-ai/private-gpt/compare/v0.4.0...v0.5.0) (2024-04-02)


### Features

* **code:** improve concat of strings in ui ([#1785](https://github.com/zylon-ai/private-gpt/issues/1785)) ([bac818a](https://github.com/zylon-ai/private-gpt/commit/bac818add51b104cda925b8f1f7b51448e935ca1))
* **docker:** set default Docker to use Ollama ([#1812](https://github.com/zylon-ai/private-gpt/issues/1812)) ([f83abff](https://github.com/zylon-ai/private-gpt/commit/f83abff8bc955a6952c92cc7bcb8985fcec93afa))
* **docs:** Add guide Llama-CPP Linux AMD GPU support ([#1782](https://github.com/zylon-ai/private-gpt/issues/1782)) ([8a836e4](https://github.com/zylon-ai/private-gpt/commit/8a836e4651543f099c59e2bf497ab8c55a7cd2e5))
* **docs:** Feature/upgrade docs ([#1741](https://github.com/zylon-ai/private-gpt/issues/1741)) ([5725181](https://github.com/zylon-ai/private-gpt/commit/572518143ac46532382db70bed6f73b5082302c1))
* **docs:** upgrade fern ([#1596](https://github.com/zylon-ai/private-gpt/issues/1596)) ([84ad16a](https://github.com/zylon-ai/private-gpt/commit/84ad16af80191597a953248ce66e963180e8ddec))
* **ingest:** Created a faster ingestion mode - pipeline ([#1750](https://github.com/zylon-ai/private-gpt/issues/1750)) ([134fc54](https://github.com/zylon-ai/private-gpt/commit/134fc54d7d636be91680dc531f5cbe2c5892ac56))
* **llm - embed:** Add support for Azure OpenAI ([#1698](https://github.com/zylon-ai/private-gpt/issues/1698)) ([1efac6a](https://github.com/zylon-ai/private-gpt/commit/1efac6a3fe19e4d62325e2c2915cd84ea277f04f))
* **llm:** adds serveral settings for llamacpp and ollama ([#1703](https://github.com/zylon-ai/private-gpt/issues/1703)) ([02dc83e](https://github.com/zylon-ai/private-gpt/commit/02dc83e8e9f7ada181ff813f25051bbdff7b7c6b))
* **llm:** Ollama LLM-Embeddings decouple + longer keep_alive settings ([#1800](https://github.com/zylon-ai/private-gpt/issues/1800)) ([b3b0140](https://github.com/zylon-ai/private-gpt/commit/b3b0140e244e7a313bfaf4ef10eb0f7e4192710e))
* **llm:** Ollama timeout setting ([#1773](https://github.com/zylon-ai/private-gpt/issues/1773)) ([6f6c785](https://github.com/zylon-ai/private-gpt/commit/6f6c785dac2bbad37d0b67fda215784298514d39))
* **local:** tiktoken cache within repo for offline ([#1467](https://github.com/zylon-ai/private-gpt/issues/1467)) ([821bca3](https://github.com/zylon-ai/private-gpt/commit/821bca32e9ee7c909fd6488445ff6a04463bf91b))
* **nodestore:** add Postgres for the doc and index store ([#1706](https://github.com/zylon-ai/private-gpt/issues/1706)) ([68b3a34](https://github.com/zylon-ai/private-gpt/commit/68b3a34b032a08ca073a687d2058f926032495b3))
* **rag:** expose similarity_top_k and similarity_score to settings ([#1771](https://github.com/zylon-ai/private-gpt/issues/1771)) ([087cb0b](https://github.com/zylon-ai/private-gpt/commit/087cb0b7b74c3eb80f4f60b47b3a021c81272ae1))
* **RAG:** Introduce SentenceTransformer Reranker ([#1810](https://github.com/zylon-ai/private-gpt/issues/1810)) ([83adc12](https://github.com/zylon-ai/private-gpt/commit/83adc12a8ef0fa0c13a0dec084fa596445fc9075))
* **scripts:** Wipe qdrant and obtain db Stats command ([#1783](https://github.com/zylon-ai/private-gpt/issues/1783)) ([ea153fb](https://github.com/zylon-ai/private-gpt/commit/ea153fb92f1f61f64c0d04fff0048d4d00b6f8d0))
* **ui:** Add Model Information to ChatInterface label ([f0b174c](https://github.com/zylon-ai/private-gpt/commit/f0b174c097c2d5e52deae8ef88de30a0d9013a38))
* **ui:** add sources check to not repeat identical sources ([#1705](https://github.com/zylon-ai/private-gpt/issues/1705)) ([290b9fb](https://github.com/zylon-ai/private-gpt/commit/290b9fb084632216300e89bdadbfeb0380724b12))
* **UI:** Faster startup and document listing ([#1763](https://github.com/zylon-ai/private-gpt/issues/1763)) ([348df78](https://github.com/zylon-ai/private-gpt/commit/348df781b51606b2f9810bcd46f850e54192fd16))
* **ui:** maintain score order when curating sources ([#1643](https://github.com/zylon-ai/private-gpt/issues/1643)) ([410bf7a](https://github.com/zylon-ai/private-gpt/commit/410bf7a71f17e77c4aec723ab80c233b53765964))
* unify settings for vector and nodestore connections to PostgreSQL ([#1730](https://github.com/zylon-ai/private-gpt/issues/1730)) ([63de7e4](https://github.com/zylon-ai/private-gpt/commit/63de7e4930ac90dd87620225112a22ffcbbb31ee))
* wipe per storage type ([#1772](https://github.com/zylon-ai/private-gpt/issues/1772)) ([c2d6948](https://github.com/zylon-ai/private-gpt/commit/c2d694852b4696834962a42fde047b728722ad74))


### Bug Fixes

* **docs:** Minor documentation amendment ([#1739](https://github.com/zylon-ai/private-gpt/issues/1739)) ([258d02d](https://github.com/zylon-ai/private-gpt/commit/258d02d87c5cb81d6c3a6f06aa69339b670dffa9))
* Fixed docker-compose ([#1758](https://github.com/zylon-ai/private-gpt/issues/1758)) ([774e256](https://github.com/zylon-ai/private-gpt/commit/774e2560520dc31146561d09a2eb464c68593871))
* **ingest:** update script label ([#1770](https://github.com/zylon-ai/private-gpt/issues/1770)) ([7d2de5c](https://github.com/zylon-ai/private-gpt/commit/7d2de5c96fd42e339b26269b3155791311ef1d08))
* **settings:** set default tokenizer to avoid running make setup fail ([#1709](https://github.com/zylon-ai/private-gpt/issues/1709)) ([d17c34e](https://github.com/zylon-ai/private-gpt/commit/d17c34e81a84518086b93605b15032e2482377f7))

## [0.4.0](https://github.com/imartinez/privateGPT/compare/v0.3.0...v0.4.0) (2024-03-06)


### Features

* Upgrade to LlamaIndex to 0.10 ([#1663](https://github.com/imartinez/privateGPT/issues/1663)) ([45f0571](https://github.com/imartinez/privateGPT/commit/45f05711eb71ffccdedb26f37e680ced55795d44))
* **Vector:** support pgvector ([#1624](https://github.com/imartinez/privateGPT/issues/1624)) ([cd40e39](https://github.com/imartinez/privateGPT/commit/cd40e3982b780b548b9eea6438c759f1c22743a8))

## [0.3.0](https://github.com/imartinez/privateGPT/compare/v0.2.0...v0.3.0) (2024-02-16)


### Features

* add mistral + chatml prompts ([#1426](https://github.com/imartinez/privateGPT/issues/1426)) ([e326126](https://github.com/imartinez/privateGPT/commit/e326126d0d4cd7e46a79f080c442c86f6dd4d24b))
* Add stream information to generate SDKs ([#1569](https://github.com/imartinez/privateGPT/issues/1569)) ([24fae66](https://github.com/imartinez/privateGPT/commit/24fae660e6913aac6b52745fb2c2fe128ba2eb79))
* **API:** Ingest plain text ([#1417](https://github.com/imartinez/privateGPT/issues/1417)) ([6eeb95e](https://github.com/imartinez/privateGPT/commit/6eeb95ec7f17a618aaa47f5034ee5bccae02b667))
* **bulk-ingest:** Add --ignored Flag to Exclude Specific Files and Directories During Ingestion ([#1432](https://github.com/imartinez/privateGPT/issues/1432)) ([b178b51](https://github.com/imartinez/privateGPT/commit/b178b514519550e355baf0f4f3f6beb73dca7df2))
* **llm:** Add openailike llm mode ([#1447](https://github.com/imartinez/privateGPT/issues/1447)) ([2d27a9f](https://github.com/imartinez/privateGPT/commit/2d27a9f956d672cb1fe715cf0acdd35c37f378a5)), closes [#1424](https://github.com/imartinez/privateGPT/issues/1424)
* **llm:** Add support for Ollama LLM ([#1526](https://github.com/imartinez/privateGPT/issues/1526)) ([6bbec79](https://github.com/imartinez/privateGPT/commit/6bbec79583b7f28d9bea4b39c099ebef149db843))
* **settings:** Configurable context_window and tokenizer ([#1437](https://github.com/imartinez/privateGPT/issues/1437)) ([4780540](https://github.com/imartinez/privateGPT/commit/47805408703c23f0fd5cab52338142c1886b450b))
* **settings:** Update default model to TheBloke/Mistral-7B-Instruct-v0.2-GGUF ([#1415](https://github.com/imartinez/privateGPT/issues/1415)) ([8ec7cf4](https://github.com/imartinez/privateGPT/commit/8ec7cf49f40701a4f2156c48eb2fad9fe6220629))
* **ui:** make chat area stretch to fill the screen ([#1397](https://github.com/imartinez/privateGPT/issues/1397)) ([c71ae7c](https://github.com/imartinez/privateGPT/commit/c71ae7cee92463bbc5ea9c434eab9f99166e1363))
* **UI:** Select file to Query or Delete + Delete ALL ([#1612](https://github.com/imartinez/privateGPT/issues/1612)) ([aa13afd](https://github.com/imartinez/privateGPT/commit/aa13afde07122f2ddda3942f630e5cadc7e4e1ee))


### Bug Fixes

* Adding an LLM param to fix broken generator from llamacpp ([#1519](https://github.com/imartinez/privateGPT/issues/1519)) ([869233f](https://github.com/imartinez/privateGPT/commit/869233f0e4f03dc23e5fae43cf7cb55350afdee9))
* **deploy:** fix local and external dockerfiles ([fde2b94](https://github.com/imartinez/privateGPT/commit/fde2b942bc03688701ed563be6d7d597c75e4e4e))
* **docker:** docker broken copy ([#1419](https://github.com/imartinez/privateGPT/issues/1419)) ([059f358](https://github.com/imartinez/privateGPT/commit/059f35840adbc3fb93d847d6decf6da32d08670c))
* **docs:** Update quickstart doc and set version in pyproject.toml to 0.2.0 ([0a89d76](https://github.com/imartinez/privateGPT/commit/0a89d76cc5ed4371ffe8068858f23dfbb5e8cc37))
* minor bug in chat stream output - python error being serialized ([#1449](https://github.com/imartinez/privateGPT/issues/1449)) ([6191bcd](https://github.com/imartinez/privateGPT/commit/6191bcdbd6e92b6f4d5995967dc196c9348c5954))
* **settings:** correct yaml multiline string ([#1403](https://github.com/imartinez/privateGPT/issues/1403)) ([2564f8d](https://github.com/imartinez/privateGPT/commit/2564f8d2bb8c4332a6a0ab6d722a2ac15006b85f))
* **tests:** load the test settings only when running tests ([d3acd85](https://github.com/imartinez/privateGPT/commit/d3acd85fe34030f8cfd7daf50b30c534087bdf2b))
* **UI:** Updated ui.py. Frees up the CPU to not be bottlenecked. ([24fb80c](https://github.com/imartinez/privateGPT/commit/24fb80ca38f21910fe4fd81505d14960e9ed4faa))

## [0.2.0](https://github.com/imartinez/privateGPT/compare/v0.1.0...v0.2.0) (2023-12-10)


### Features

* **llm:** drop default_system_prompt ([#1385](https://github.com/imartinez/privateGPT/issues/1385)) ([a3ed14c](https://github.com/imartinez/privateGPT/commit/a3ed14c58f77351dbd5f8f2d7868d1642a44f017))
* **ui:** Allows User to Set System Prompt via "Additional Options" in Chat Interface ([#1353](https://github.com/imartinez/privateGPT/issues/1353)) ([145f3ec](https://github.com/imartinez/privateGPT/commit/145f3ec9f41c4def5abf4065a06fb0786e2d992a))

## [0.1.0](https://github.com/imartinez/privateGPT/compare/v0.0.2...v0.1.0) (2023-11-30)


### Features

* Disable Gradio Analytics ([#1165](https://github.com/imartinez/privateGPT/issues/1165)) ([6583dc8](https://github.com/imartinez/privateGPT/commit/6583dc84c082773443fc3973b1cdf8095fa3fec3))
* Drop loguru and use builtin `logging` ([#1133](https://github.com/imartinez/privateGPT/issues/1133)) ([64c5ae2](https://github.com/imartinez/privateGPT/commit/64c5ae214a9520151c9c2d52ece535867d799367))
* enable resume download for hf_hub_download ([#1249](https://github.com/imartinez/privateGPT/issues/1249)) ([4197ada](https://github.com/imartinez/privateGPT/commit/4197ada6267c822f32c1d7ba2be6e7ce145a3404))
* move torch and transformers to local group ([#1172](https://github.com/imartinez/privateGPT/issues/1172)) ([0d677e1](https://github.com/imartinez/privateGPT/commit/0d677e10b970aec222ec04837d0f08f1631b6d4a))
* Qdrant support ([#1228](https://github.com/imartinez/privateGPT/issues/1228)) ([03d1ae6](https://github.com/imartinez/privateGPT/commit/03d1ae6d70dffdd2411f0d4e92f65080fff5a6e2))


### Bug Fixes

* Docker and sagemaker setup ([#1118](https://github.com/imartinez/privateGPT/issues/1118)) ([895588b](https://github.com/imartinez/privateGPT/commit/895588b82a06c2bc71a9e22fb840c7f6442a3b5b))
* fix pytorch version to avoid wheel bug ([#1123](https://github.com/imartinez/privateGPT/issues/1123)) ([24cfddd](https://github.com/imartinez/privateGPT/commit/24cfddd60f74aadd2dade4c63f6012a2489938a1))
* Remove global state ([#1216](https://github.com/imartinez/privateGPT/issues/1216)) ([022bd71](https://github.com/imartinez/privateGPT/commit/022bd718e3dfc197027b1e24fb97e5525b186db4))
* sagemaker config and chat methods ([#1142](https://github.com/imartinez/privateGPT/issues/1142)) ([a517a58](https://github.com/imartinez/privateGPT/commit/a517a588c4927aa5c5c2a93e4f82a58f0599d251))
* typo in README.md ([#1091](https://github.com/imartinez/privateGPT/issues/1091)) ([ba23443](https://github.com/imartinez/privateGPT/commit/ba23443a70d323cd4f9a242b33fd9dce1bacd2db))
* Windows 11 failing to auto-delete tmp file ([#1260](https://github.com/imartinez/privateGPT/issues/1260)) ([0d52002](https://github.com/imartinez/privateGPT/commit/0d520026a3d5b08a9b8487be992d3095b21e710c))
* Windows permission error on ingest service tmp files ([#1280](https://github.com/imartinez/privateGPT/issues/1280)) ([f1cbff0](https://github.com/imartinez/privateGPT/commit/f1cbff0fb7059432d9e71473cbdd039032dab60d))

## [0.0.2](https://github.com/imartinez/privateGPT/compare/v0.0.1...v0.0.2) (2023-10-20)


### Bug Fixes

* chromadb max batch size ([#1087](https://github.com/imartinez/privateGPT/issues/1087)) ([f5a9bf4](https://github.com/imartinez/privateGPT/commit/f5a9bf4e374b2d4c76438cf8a97cccf222ec8e6f))

## 0.0.1 (2023-10-20)

### Miscellaneous Chores

* Initial version ([490d93f](https://github.com/imartinez/privateGPT/commit/490d93fdc1977443c92f6c42e57a1c585aa59430))


================================================
FILE: CITATION.cff
================================================
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: PrivateGPT
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - name: Zylon by PrivateGPT
    address: hello@zylon.ai
    website: 'https://www.zylon.ai/'
repository-code: 'https://github.com/zylon-ai/private-gpt'
license: Apache-2.0
date-released: '2023-05-02'


================================================
FILE: Dockerfile.llamacpp-cpu
================================================
### IMPORTANT, THIS IMAGE CAN ONLY BE RUN IN LINUX DOCKER
### You will run into a segfault in mac
FROM python:3.11.6-slim-bookworm AS base

# Install poetry
RUN pip install pipx
RUN python3 -m pipx ensurepath
RUN pipx install poetry==1.8.3
ENV PATH="/root/.local/bin:$PATH"
ENV PATH=".venv/bin/:$PATH"

# Dependencies to build llama-cpp
RUN apt update && apt install -y \
  libopenblas-dev\
  ninja-build\
  build-essential\
  pkg-config\
  wget

# https://python-poetry.org/docs/configuration/#virtualenvsin-project
ENV POETRY_VIRTUALENVS_IN_PROJECT=true

FROM base AS dependencies
WORKDIR /home/worker/app
COPY pyproject.toml poetry.lock ./

ARG POETRY_EXTRAS="ui embeddings-huggingface llms-llama-cpp vector-stores-qdrant"
RUN poetry install --no-root --extras "${POETRY_EXTRAS}"

FROM base AS app

ENV PYTHONUNBUFFERED=1
ENV PORT=8080
ENV APP_ENV=prod
ENV PYTHONPATH="$PYTHONPATH:/home/worker/app/private_gpt/"
EXPOSE 8080

# Prepare a non-root user
# More info about how to configure UIDs and GIDs in Docker:
# https://github.com/systemd/systemd/blob/main/docs/UIDS-GIDS.md

# Define the User ID (UID) for the non-root user
# UID 100 is chosen to avoid conflicts with existing system users
ARG UID=100

# Define the Group ID (GID) for the non-root user
# GID 65534 is often used for the 'nogroup' or 'nobody' group
ARG GID=65534

RUN adduser --system --gid ${GID} --uid ${UID} --home /home/worker worker
WORKDIR /home/worker/app

RUN chown worker /home/worker/app
RUN mkdir local_data && chown worker local_data
RUN mkdir models && chown worker models
COPY --chown=worker --from=dependencies /home/worker/app/.venv/ .venv
COPY --chown=worker private_gpt/ private_gpt
COPY --chown=worker *.yaml ./
COPY --chown=worker scripts/ scripts

USER worker
ENTRYPOINT python -m private_gpt

================================================
FILE: Dockerfile.ollama
================================================
FROM python:3.11.6-slim-bookworm AS base

# Install poetry
RUN pip install pipx
RUN python3 -m pipx ensurepath
RUN pipx install poetry==1.8.3
ENV PATH="/root/.local/bin:$PATH"
ENV PATH=".venv/bin/:$PATH"

# https://python-poetry.org/docs/configuration/#virtualenvsin-project
ENV POETRY_VIRTUALENVS_IN_PROJECT=true

FROM base AS dependencies
WORKDIR /home/worker/app
COPY pyproject.toml poetry.lock ./

ARG POETRY_EXTRAS="ui vector-stores-qdrant llms-ollama embeddings-ollama"
RUN poetry install --no-root --extras "${POETRY_EXTRAS}"

FROM base AS app
ENV PYTHONUNBUFFERED=1
ENV PORT=8080
ENV APP_ENV=prod
ENV PYTHONPATH="$PYTHONPATH:/home/worker/app/private_gpt/"
EXPOSE 8080

# Prepare a non-root user
# More info about how to configure UIDs and GIDs in Docker:
# https://github.com/systemd/systemd/blob/main/docs/UIDS-GIDS.md

# Define the User ID (UID) for the non-root user
# UID 100 is chosen to avoid conflicts with existing system users
ARG UID=100

# Define the Group ID (GID) for the non-root user
# GID 65534 is often used for the 'nogroup' or 'nobody' group
ARG GID=65534

RUN adduser --system --gid ${GID} --uid ${UID} --home /home/worker worker
WORKDIR /home/worker/app

RUN chown worker /home/worker/app
RUN mkdir local_data && chown worker local_data
RUN mkdir models && chown worker models
COPY --chown=worker --from=dependencies /home/worker/app/.venv/ .venv
COPY --chown=worker private_gpt/ private_gpt
COPY --chown=worker *.yaml .
COPY --chown=worker scripts/ scripts

USER worker
ENTRYPOINT python -m private_gpt


================================================
FILE: LICENSE
================================================
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: Makefile
================================================
# Any args passed to the make script, use with $(call args, default_value)
args = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}`

########################################################################################################################
# Quality checks
########################################################################################################################

test:
	PYTHONPATH=. poetry run pytest tests

test-coverage:
	PYTHONPATH=. poetry run pytest tests --cov private_gpt --cov-report term --cov-report=html --cov-report xml --junit-xml=tests-results.xml

black:
	poetry run black . --check

ruff:
	poetry run ruff check private_gpt tests

format:
	poetry run black .
	poetry run ruff check private_gpt tests --fix

mypy:
	poetry run mypy private_gpt

check:
	make format
	make mypy

########################################################################################################################
# Run
########################################################################################################################

run:
	poetry run python -m private_gpt

dev-windows:
	(set PGPT_PROFILES=local & poetry run python -m uvicorn private_gpt.main:app --reload --port 8001)

dev:
	PYTHONUNBUFFERED=1 PGPT_PROFILES=local poetry run python -m uvicorn private_gpt.main:app --reload --port 8001

########################################################################################################################
# Misc
########################################################################################################################

api-docs:
	PGPT_PROFILES=mock poetry run python scripts/extract_openapi.py private_gpt.main:app --out fern/openapi/openapi.json

ingest:
	@poetry run python scripts/ingest_folder.py $(call args)

stats:
	poetry run python scripts/utils.py stats

wipe:
	poetry run python scripts/utils.py wipe

setup:
	poetry run python scripts/setup

list:
	@echo "Available commands:"
	@echo "  test            : Run tests using pytest"
	@echo "  test-coverage   : Run tests with coverage report"
	@echo "  black           : Check code format with black"
	@echo "  ruff            : Check code with ruff"
	@echo "  format          : Format code with black and ruff"
	@echo "  mypy            : Run mypy for type checking"
	@echo "  check           : Run format and mypy commands"
	@echo "  run             : Run the application"
	@echo "  dev-windows     : Run the application in development mode on Windows"
	@echo "  dev             : Run the application in development mode"
	@echo "  api-docs        : Generate API documentation"
	@echo "  ingest          : Ingest data using specified script"
	@echo "  wipe            : Wipe data using specified script"
	@echo "  setup           : Setup the application"


================================================
FILE: README.md
================================================
# PrivateGPT 

<a href="https://trendshift.io/repositories/2601" target="_blank"><img src="https://trendshift.io/api/badge/repositories/2601" alt="imartinez%2FprivateGPT | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>

[![Tests](https://github.com/zylon-ai/private-gpt/actions/workflows/tests.yml/badge.svg)](https://github.com/zylon-ai/private-gpt/actions/workflows/tests.yml?query=branch%3Amain)
[![Website](https://img.shields.io/website?up_message=check%20it&down_message=down&url=https%3A%2F%2Fdocs.privategpt.dev%2F&label=Documentation)](https://docs.privategpt.dev/)
[![Discord](https://img.shields.io/discord/1164200432894234644?logo=discord&label=PrivateGPT)](https://discord.gg/bK6mRVpErU)
[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/ZylonPrivateGPT)](https://twitter.com/ZylonPrivateGPT)

![Gradio UI](/fern/docs/assets/ui.png?raw=true)

PrivateGPT -built by Zylon- is a production-ready AI project that allows you to ask questions about your documents using the power
of Large Language Models (LLMs), even in scenarios without an Internet connection. 100% private, no data leaves your
execution environment at any point.

>[!TIP]
> If you are looking for an **enterprise-ready, fully private AI platform for regulated industries** like financial services (banks, insurance, investment), defense, critical infrastructure services, government and healthcare,
> check out [Zylon's website](https://zylon.ai)  or [request a demo](https://cal.com/zylon/demo?source=pgpt-readme).
> **Zylon** is an enterprise AI platform delivering private generative AI and on-premise AI software for regulated industries, enabling secure deployment inside enterprise infrastructure without external cloud dependencies.

The project provides an API offering all the primitives required to build private, context-aware AI applications.
It follows and extends the [OpenAI API standard](https://openai.com/blog/openai-api),
and supports both normal and streaming responses.

The API is divided into two logical blocks:

**High-level API**, which abstracts all the complexity of a RAG (Retrieval Augmented Generation)
pipeline implementation:
- Ingestion of documents: internally managing document parsing,
splitting, metadata extraction, embedding generation and storage.
- Chat & Completions using context from ingested documents:
abstracting the retrieval of context, the prompt engineering and the response generation.

**Low-level API**, which allows advanced users to implement their own complex pipelines:
- Embeddings generation: based on a piece of text.
- Contextual chunks retrieval: given a query, returns the most relevant chunks of text from the ingested documents.

In addition to this, a working [Gradio UI](https://www.gradio.app/)
client is provided to test the API, together with a set of useful tools such as bulk model
download script, ingestion script, documents folder watch, etc.

## 🎞️ Overview
>[!WARNING]
>  This README is not updated as frequently as the [documentation](https://docs.privategpt.dev/).
>  Please check it out for the latest updates!

### Motivation behind PrivateGPT
Generative AI is a game changer for our society, but adoption in companies of all sizes and data-sensitive
domains like healthcare or legal is limited by a clear concern: **privacy**.
Not being able to ensure that your data is fully under your control when using third-party AI tools
is a risk those industries cannot take.

### Primordial version
The first version of PrivateGPT was launched in May 2023 as a novel approach to address the privacy
concerns by using LLMs in a complete offline way.

That version, which rapidly became a go-to project for privacy-sensitive setups and served as the seed
for thousands of local-focused generative AI projects, was the foundation of what PrivateGPT is becoming nowadays;
thus a simpler and more educational implementation to understand the basic concepts required
to build a fully local -and therefore, private- chatGPT-like tool.

If you want to keep experimenting with it, we have saved it in the
[primordial branch](https://github.com/zylon-ai/private-gpt/tree/primordial) of the project.

> It is strongly recommended to do a clean clone and install of this new version of
PrivateGPT if you come from the previous, primordial version.

### Present and Future of PrivateGPT
PrivateGPT is now evolving towards becoming a gateway to generative AI models and primitives, including
completions, document ingestion, RAG pipelines and other low-level building blocks.
We want to make it easier for any developer to build AI applications and experiences, as well as provide
a suitable extensive architecture for the community to keep contributing.

Stay tuned to our [releases](https://github.com/zylon-ai/private-gpt/releases) to check out all the new features and changes included.

## 📄 Documentation
Full documentation on installation, dependencies, configuration, running the server, deployment options,
ingesting local documents, API details and UI features can be found here: https://docs.privategpt.dev/

## 🧩 Architecture
Conceptually, PrivateGPT is an API that wraps a RAG pipeline and exposes its
primitives.
* The API is built using [FastAPI](https://fastapi.tiangolo.com/) and follows
  [OpenAI's API scheme](https://platform.openai.com/docs/api-reference).
* The RAG pipeline is based on [LlamaIndex](https://www.llamaindex.ai/).

The design of PrivateGPT allows to easily extend and adapt both the API and the
RAG implementation. Some key architectural decisions are:
* Dependency Injection, decoupling the different components and layers.
* Usage of LlamaIndex abstractions such as `LLM`, `BaseEmbedding` or `VectorStore`,
  making it immediate to change the actual implementations of those abstractions.
* Simplicity, adding as few layers and new abstractions as possible.
* Ready to use, providing a full implementation of the API and RAG
  pipeline.

Main building blocks:
* APIs are defined in `private_gpt:server:<api>`. Each package contains an
  `<api>_router.py` (FastAPI layer) and an `<api>_service.py` (the
  service implementation). Each *Service* uses LlamaIndex base abstractions instead
  of specific implementations,
  decoupling the actual implementation from its usage.
* Components are placed in
  `private_gpt:components:<component>`. Each *Component* is in charge of providing
  actual implementations to the base abstractions used in the Services - for example
  `LLMComponent` is in charge of providing an actual implementation of an `LLM`
  (for example `LlamaCPP` or `OpenAI`).

## 💡 Contributing
Contributions are welcomed! To ensure code quality we have enabled several format and
typing checks, just run `make check` before committing to make sure your code is ok.
Remember to test your code! You'll find a tests folder with helpers, and you can run
tests using `make test` command.

Don't know what to contribute? Here is the public 
[Project Board](https://github.com/users/imartinez/projects/3) with several ideas. 

Head over to Discord 
#contributors channel and ask for write permissions on that GitHub project.

## 💬 Community
Join the conversation around PrivateGPT on our:
- [Twitter (aka X)](https://twitter.com/PrivateGPT_AI)
- [Discord](https://discord.gg/bK6mRVpErU)

## 📖 Citation
If you use PrivateGPT in a paper, check out the [Citation file](CITATION.cff) for the correct citation.  
You can also use the "Cite this repository" button in this repo to get the citation in different formats.

Here are a couple of examples:

#### BibTeX
```bibtex
@software{Zylon_PrivateGPT_2023,
author = {Zylon by PrivateGPT},
license = {Apache-2.0},
month = may,
title = {{PrivateGPT}},
url = {https://github.com/zylon-ai/private-gpt},
year = {2023}
}
```

#### APA
```
Zylon by PrivateGPT (2023). PrivateGPT [Computer software]. https://github.com/zylon-ai/private-gpt
```

## 🤗 Partners & Supporters
PrivateGPT is actively supported by the teams behind:
* [Qdrant](https://qdrant.tech/), providing the default vector database
* [Fern](https://buildwithfern.com/), providing Documentation and SDKs
* [LlamaIndex](https://www.llamaindex.ai/), providing the base RAG framework and abstractions

This project has been strongly influenced and supported by other amazing projects like 
[LangChain](https://github.com/hwchase17/langchain),
[GPT4All](https://github.com/nomic-ai/gpt4all),
[LlamaCpp](https://github.com/ggerganov/llama.cpp),
[Chroma](https://www.trychroma.com/)
and [SentenceTransformers](https://www.sbert.net/).


================================================
FILE: docker-compose.yaml
================================================
services:

  #-----------------------------------
  #---- Private-GPT services ---------
  #-----------------------------------

  # Private-GPT service for the Ollama CPU and GPU modes
  # This service builds from an external Dockerfile and runs the Ollama mode.
  private-gpt-ollama:
    image: ${PGPT_IMAGE:-zylonai/private-gpt}:${PGPT_TAG:-0.6.2}-ollama  # x-release-please-version
    user: root
    build:
      context: .
      dockerfile: Dockerfile.ollama
    volumes:
      - ./local_data:/home/worker/app/local_data
    ports:
      - "8001:8001"
    environment:
      PORT: 8001
      PGPT_PROFILES: docker
      PGPT_MODE: ollama
      PGPT_EMBED_MODE: ollama
      PGPT_OLLAMA_API_BASE: http://ollama:11434
      HF_TOKEN: ${HF_TOKEN:-}
    profiles:
      - ""
      - ollama-cpu
      - ollama-cuda
      - ollama-api
    depends_on:
      ollama:
        condition: service_healthy

  # Private-GPT service for the local mode
  # This service builds from a local Dockerfile and runs the application in local mode.
  private-gpt-llamacpp-cpu:
    image: ${PGPT_IMAGE:-zylonai/private-gpt}:${PGPT_TAG:-0.6.2}-llamacpp-cpu # x-release-please-version
    user: root
    build:
      context: .
      dockerfile: Dockerfile.llamacpp-cpu
    volumes:
      - ./local_data/:/home/worker/app/local_data
      - ./models/:/home/worker/app/models
    entrypoint: sh -c ".venv/bin/python scripts/setup && .venv/bin/python -m private_gpt"
    ports:
      - "8001:8001"
    environment:
      PORT: 8001
      PGPT_PROFILES: local
      HF_TOKEN: ${HF_TOKEN:-}
    profiles:
      - llamacpp-cpu

  #-----------------------------------
  #---- Ollama services --------------
  #-----------------------------------

  # Traefik reverse proxy for the Ollama service
  # This will route requests to the Ollama service based on the profile.
  ollama:
    image: traefik:v2.10
    healthcheck:
      test: ["CMD", "sh", "-c", "wget -q --spider http://ollama:11434 || exit 1"]
      interval: 10s
      retries: 3
      start_period: 5s
      timeout: 5s
    ports:
      - "8080:8080"
    command:
      - "--providers.file.filename=/etc/router.yml"
      - "--log.level=ERROR"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:11434"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./.docker/router.yml:/etc/router.yml:ro
    extra_hosts:
      - "host.docker.internal:host-gateway"
    profiles:
      - ""
      - ollama-cpu
      - ollama-cuda
      - ollama-api

  # Ollama service for the CPU mode
  ollama-cpu:
    image: ollama/ollama:latest
    ports:
      - "11434:11434"
    volumes:
      - ./models:/root/.ollama
    profiles:
      - ""
      - ollama-cpu

  # Ollama service for the CUDA mode
  ollama-cuda:
    image: ollama/ollama:latest
    ports:
      - "11434:11434"
    volumes:
      - ./models:/root/.ollama
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]
    profiles:
      - ollama-cuda


================================================
FILE: fern/README.md
================================================
# Documentation of PrivateGPT

The documentation of this project is being rendered thanks to [fern](https://github.com/fern-api/fern).

Fern is basically transforming your `.md` and `.mdx` files into a static website: your documentation.

The configuration of your documentation is done in the `./docs.yml` file.
There, you can configure the navbar, tabs, sections and pages being rendered.

The documentation of fern (and the syntax of its configuration `docs.yml`) is 
available there [docs.buildwithfern.com](https://docs.buildwithfern.com/).

## How to run fern

**You cannot render your documentation locally without fern credentials.**

To see how your documentation looks like, you **have to** use the CICD of this
repository (by opening a PR, CICD job will be executed, and a preview of 
your PR's documentation will be deployed in vercel automatically, through fern).

The only thing you can do locally, is to run `fern check`, which check the syntax of
your `docs.yml` file.

## How to add a new page
Add in the `docs.yml` a new `page`, with the following syntax:

```yml
navigation:
  # ...
  - tab: my-existing-tab
    layout:
      # ...
      - section: My Existing Section
        contents:
          # ...
          - page: My new page display name
            # The path of the page, relative to `fern/`
            path: ./docs/pages/my-existing-tab/new-page-content.mdx
```

================================================
FILE: fern/docs/pages/api-reference/api-reference.mdx
================================================
# API Reference

The API is divided in two logical blocks:

1. High-level API, abstracting all the complexity of a RAG (Retrieval Augmented Generation) pipeline implementation:
    - Ingestion of documents: internally managing document parsing, splitting, metadata extraction,
      embedding generation and storage.
    - Chat & Completions using context from ingested documents: abstracting the retrieval of context, the prompt
      engineering and the response generation.

2. Low-level API, allowing advanced users to implement their own complex pipelines:
    - Embeddings generation: based on a piece of text.
    - Contextual chunks retrieval: given a query, returns the most relevant chunks of text from the ingested
      documents.

================================================
FILE: fern/docs/pages/api-reference/sdks.mdx
================================================
We use [Fern](www.buildwithfern.com) to offer API clients for Node.js, Python, Go, and Java.
We recommend using these clients to interact with our endpoints.
The clients are kept up to date automatically, so we encourage you to use the latest version.

## SDKs

*Coming soon!*

<Cards>
  <Card
    title="TypeScript"
    icon="fa-brands fa-node"
    href="https://github.com/zylon-ai/privategpt-ts"
  />
  <Card
    title="Python"
    icon="fa-brands fa-python"
    href="https://github.com/zylon-ai/pgpt-python"
  />
  <br />
</Cards>

<br />

<Cards>
  <Card
    title="Java - WIP"
    icon="fa-brands fa-java"
    href="https://github.com/zylon-ai/private-gpt-java"
  />
  <Card
    title="Go - WIP"
    icon="fa-brands fa-golang"
    href="https://github.com/zylon-ai/private-gpt-go"
  />
</Cards>

<br />


================================================
FILE: fern/docs/pages/installation/concepts.mdx
================================================
PrivateGPT is a service that wraps a set of AI RAG primitives in a comprehensive set of APIs providing a private, secure, customizable and easy to use GenAI development framework.

It uses FastAPI and LLamaIndex as its core frameworks. Those can be customized by changing the codebase itself.

It supports a variety of LLM providers, embeddings providers, and vector stores, both local and remote. Those can be easily changed without changing the codebase.

# Different Setups support

## Setup configurations available
You get to decide the setup for these 3 main components:
- **LLM**: the large language model provider used for inference. It can be local, or remote, or even OpenAI.
- **Embeddings**: the embeddings provider used to encode the input, the documents and the users' queries. Same as the LLM, it can be local, or remote, or even OpenAI.
- **Vector store**: the store used to index and retrieve the documents.

There is an extra component that can be enabled or disabled: the UI. It is a Gradio UI that allows to interact with the API in a more user-friendly way.

<Callout intent = "warning">
A working **Gradio UI client** is provided to test the API, together with a set of useful tools such as bulk
model download script, ingestion script, documents folder watch, etc. Please refer to the [UI alternatives](/manual/user-interface/alternatives) page for more UI alternatives.
</Callout>

### Setups and Dependencies
Your setup will be the combination of the different options available. You'll find recommended setups in the [installation](./installation) section.
PrivateGPT uses poetry to manage its dependencies. You can install the dependencies for the different setups by running `poetry install --extras "<extra1> <extra2>..."`.
Extras are the different options available for each component. For example, to install the dependencies for a a local setup with UI and qdrant as vector database, Ollama as LLM and local embeddings, you would run:

```bash
poetry install --extras "ui vector-stores-qdrant llms-ollama embeddings-ollama"
```

Refer to the [installation](./installation) section for more details.

### Setups and Configuration
PrivateGPT uses yaml to define its configuration in files named `settings-<profile>.yaml`.
Different configuration files can be created in the root directory of the project.
PrivateGPT will load the configuration at startup from the profile specified in the `PGPT_PROFILES` environment variable.
For example, running:
```bash
PGPT_PROFILES=ollama make run
```
will load the configuration from `settings.yaml` and `settings-ollama.yaml`.
- `settings.yaml` is always loaded and contains the default configuration.
- `settings-ollama.yaml` is loaded if the `ollama` profile is specified in the `PGPT_PROFILES` environment variable. It can override configuration from the default `settings.yaml`

## About Fully Local Setups
In order to run PrivateGPT in a fully local setup, you will need to run the LLM, Embeddings and Vector Store locally.

### LLM
For local LLM there are two options:
* (Recommended) You can use the 'ollama' option in PrivateGPT, which will connect to your local Ollama instance. Ollama simplifies a lot the installation of local LLMs.
* You can use the 'llms-llama-cpp' option in PrivateGPT, which will use LlamaCPP. It works great on Mac with Metal most of the times (leverages Metal GPU), but it can be tricky in certain Linux and Windows distributions, depending on the GPU. In the installation document you'll find guides and troubleshooting.

In order for LlamaCPP powered LLM to work (the second option), you need to download the LLM model to the `models` folder. You can do so by running the `setup` script:
```bash
poetry run python scripts/setup
```
### Embeddings
For local Embeddings there are two options:
* (Recommended) You can use the 'ollama' option in PrivateGPT, which will connect to your local Ollama instance. Ollama simplifies a lot the installation of local LLMs.
* You can use the 'embeddings-huggingface' option in PrivateGPT, which will use HuggingFace.

In order for HuggingFace LLM to work (the second option), you need to download the embeddings model to the `models` folder. You can do so by running the `setup` script:
```bash
poetry run python scripts/setup
```
### Vector stores
The vector stores supported (Qdrant, Milvus, ChromaDB and Postgres) run locally by default.

================================================
FILE: fern/docs/pages/installation/installation.mdx
================================================
It is important that you review the [Main Concepts](../concepts) section to understand the different components of PrivateGPT and how they interact with each other.

## Base requirements to run PrivateGPT

### 1. Clone the PrivateGPT Repository
Clone the repository and navigate to it:
```bash
git clone https://github.com/zylon-ai/private-gpt
cd private-gpt
```

### 2. Install Python 3.11
If you do not have Python 3.11 installed, install it using a Python version manager like `pyenv`. Earlier Python versions are not supported.
#### macOS/Linux
Install and set Python 3.11 using [pyenv](https://github.com/pyenv/pyenv):
```bash
pyenv install 3.11
pyenv local 3.11
```
#### Windows
Install and set Python 3.11 using [pyenv-win](https://github.com/pyenv-win/pyenv-win):
```bash
pyenv install 3.11
pyenv local 3.11
```

### 3. Install `Poetry`
Install [Poetry](https://python-poetry.org/docs/#installing-with-the-official-installer) for dependency management:
Follow the instructions on the official Poetry website to install it.

<Callout intent="warning">
A bug exists in Poetry versions 1.7.0 and earlier. We strongly recommend upgrading to a tested version.
To upgrade Poetry to latest tested version, run `poetry self update 1.8.3` after installing it.
</Callout>

### 4. Optional: Install `make`
To run various scripts, you need to install `make`. Follow the instructions for your operating system:
#### macOS
(Using Homebrew):
```bash
brew install make
```
#### Windows
(Using Chocolatey):
```bash
choco install make
```

## Install and Run Your Desired Setup

PrivateGPT allows customization of the setup, from fully local to cloud-based, by deciding the modules to use. To install only the required dependencies, PrivateGPT offers different `extras` that can be combined during the installation process:

```bash
poetry install --extras "<extra1> <extra2>..."
```
Where `<extra>` can be any of the following options described below.

### Available Modules

You need to choose one option per category (LLM, Embeddings, Vector Stores, UI). Below are the tables listing the available options for each category.

#### LLM

| **Option**   | **Description**                                                        | **Extra**           |
|--------------|------------------------------------------------------------------------|---------------------|
| **ollama**   | Adds support for Ollama LLM, requires Ollama running locally           | llms-ollama         |
| llama-cpp    | Adds support for local LLM using LlamaCPP                              | llms-llama-cpp      |
| sagemaker    | Adds support for Amazon Sagemaker LLM, requires Sagemaker endpoints    | llms-sagemaker      |
| openai       | Adds support for OpenAI LLM, requires OpenAI API key                   | llms-openai         |
| openailike   | Adds support for 3rd party LLM providers compatible with OpenAI's API  | llms-openai-like    |
| azopenai     | Adds support for Azure OpenAI LLM, requires Azure endpoints            | llms-azopenai       |
| gemini       | Adds support for Gemini LLM, requires Gemini API key                   | llms-gemini         |

#### Embeddings

| **Option**       | **Description**                                                                | **Extra**               |
|------------------|--------------------------------------------------------------------------------|-------------------------|
| **ollama**       | Adds support for Ollama Embeddings, requires Ollama running locally            | embeddings-ollama       |
| huggingface      | Adds support for local Embeddings using HuggingFace                            | embeddings-huggingface  |
| openai           | Adds support for OpenAI Embeddings, requires OpenAI API key                    | embeddings-openai       |
| sagemaker        | Adds support for Amazon Sagemaker Embeddings, requires Sagemaker endpoints     | embeddings-sagemaker    |
| azopenai         | Adds support for Azure OpenAI Embeddings, requires Azure endpoints             | embeddings-azopenai     |
| gemini           | Adds support for Gemini Embeddings, requires Gemini API key                    | embeddings-gemini       |

#### Vector Stores

| **Option**       | **Description**                         | **Extra**               |
|------------------|-----------------------------------------|-------------------------|
| **qdrant**       | Adds support for Qdrant vector store    | vector-stores-qdrant    |
| milvus           | Adds support for Milvus vector store    | vector-stores-milvus    |
| chroma           | Adds support for Chroma DB vector store | vector-stores-chroma    |
| postgres         | Adds support for Postgres vector store  | vector-stores-postgres  |
| clickhouse       | Adds support for Clickhouse vector store| vector-stores-clickhouse|

#### UI

| **Option**   | **Description**                          | **Extra** |
|--------------|------------------------------------------|-----------|
| Gradio       | Adds support for UI using Gradio         | ui        |

<Callout intent = "warning">
A working **Gradio UI client** is provided to test the API, together with a set of useful tools such as bulk
model download script, ingestion script, documents folder watch, etc. Please refer to the [UI alternatives](/manual/user-interface/alternatives) page for more UI alternatives.
</Callout>

## Recommended Setups

There are just some examples of recommended setups. You can mix and match the different options to fit your needs.
You'll find more information in the Manual section of the documentation.

> **Important for Windows**: In the examples below or how to run PrivateGPT with `make run`, `PGPT_PROFILES` env var is being set inline following Unix command line syntax (works on MacOS and Linux).
If you are using Windows, you'll need to set the env var in a different way, for example:

```powershell
# Powershell
$env:PGPT_PROFILES="ollama"
make run
```

or

```cmd
# CMD
set PGPT_PROFILES=ollama
make run
```

Refer to the [troubleshooting](./troubleshooting) section for specific issues you might encounter.

### Local, Ollama-powered setup - RECOMMENDED

**The easiest way to run PrivateGPT fully locally** is to depend on Ollama for the LLM. Ollama provides local LLM and Embeddings super easy to install and use, abstracting the complexity of GPU support. It's the recommended setup for local development.

Go to [ollama.ai](https://ollama.ai/) and follow the instructions to install Ollama on your machine.

After the installation, make sure the Ollama desktop app is closed.

Now, start Ollama service (it will start a local inference server, serving both the LLM and the Embeddings):
```bash
ollama serve
```

Install the models to be used, the default settings-ollama.yaml is configured to user llama3.1 8b LLM (~4GB) and nomic-embed-text Embeddings (~275MB)

By default, PGPT will automatically pull models as needed. This behavior can be changed by modifying the `ollama.autopull_models` property.

In any case, if you want to manually pull models, run the following commands:

```bash
ollama pull llama3.1
ollama pull nomic-embed-text
```

Once done, on a different terminal, you can install PrivateGPT with the following command:
```bash
poetry install --extras "ui llms-ollama embeddings-ollama vector-stores-qdrant"
```

Once installed, you can run PrivateGPT. Make sure you have a working Ollama running locally before running the following command.

```bash
PGPT_PROFILES=ollama make run
```

PrivateGPT will use the already existing `settings-ollama.yaml` settings file, which is already configured to use Ollama LLM and Embeddings, and Qdrant. Review it and adapt it to your needs (different models, different Ollama port, etc.)

The UI will be available at http://localhost:8001

### Private, Sagemaker-powered setup

If you need more performance, you can run a version of PrivateGPT that relies on powerful AWS Sagemaker machines to serve the LLM and Embeddings.

You need to have access to sagemaker inference endpoints for the LLM and / or the embeddings, and have AWS credentials properly configured.

Edit the `settings-sagemaker.yaml` file to include the correct Sagemaker endpoints.

Then, install PrivateGPT with the following command:
```bash
poetry install --extras "ui llms-sagemaker embeddings-sagemaker vector-stores-qdrant"
```

Once installed, you can run PrivateGPT. Make sure you have a working Ollama running locally before running the following command.

```bash
PGPT_PROFILES=sagemaker make run
```

PrivateGPT will use the already existing `settings-sagemaker.yaml` settings file, which is already configured to use Sagemaker LLM and Embeddings endpoints, and Qdrant.

The UI will be available at http://localhost:8001

### Non-Private, OpenAI-powered test setup

If you want to test PrivateGPT with OpenAI's LLM and Embeddings -taking into account your data is going to OpenAI!- you can run the following command:

You need an OPENAI API key to run this setup.

Edit the `settings-openai.yaml` file to include the correct API KEY. Never commit it! It's a secret! As an alternative to editing `settings-openai.yaml`, you can just set the env var OPENAI_API_KEY.

Then, install PrivateGPT with the following command:
```bash
poetry install --extras "ui llms-openai embeddings-openai vector-stores-qdrant"
```

Once installed, you can run PrivateGPT.

```bash
PGPT_PROFILES=openai make run
```

PrivateGPT will use the already existing `settings-openai.yaml` settings file, which is already configured to use OpenAI LLM and Embeddings endpoints, and Qdrant.

The UI will be available at http://localhost:8001

### Non-Private, Azure OpenAI-powered test setup

If you want to test PrivateGPT with Azure OpenAI's LLM and Embeddings -taking into account your data is going to Azure OpenAI!- you can run the following command:

You need to have access to Azure OpenAI inference endpoints for the LLM and / or the embeddings, and have Azure OpenAI credentials properly configured.

Edit the `settings-azopenai.yaml` file to include the correct Azure OpenAI endpoints.

Then, install PrivateGPT with the following command:
```bash
poetry install --extras "ui llms-azopenai embeddings-azopenai vector-stores-qdrant"
```

Once installed, you can run PrivateGPT.

```bash
PGPT_PROFILES=azopenai make run
```

PrivateGPT will use the already existing `settings-azopenai.yaml` settings file, which is already configured to use Azure OpenAI LLM and Embeddings endpoints, and Qdrant.

The UI will be available at http://localhost:8001

### Local, Llama-CPP powered setup

If you want to run PrivateGPT fully locally without relying on Ollama, you can run the following command:

```bash
poetry install --extras "ui llms-llama-cpp embeddings-huggingface vector-stores-qdrant"
```

In order for local LLM and embeddings to work, you need to download the models to the `models` folder. You can do so by running the `setup` script:
```bash
poetry run python scripts/setup
```

Once installed, you can run PrivateGPT with the following command:

```bash
PGPT_PROFILES=local make run
```

PrivateGPT will load the already existing `settings-local.yaml` file, which is already configured to use LlamaCPP LLM, HuggingFace embeddings and Qdrant.

The UI will be available at http://localhost:8001

#### Llama-CPP support

For PrivateGPT to run fully locally without Ollama, Llama.cpp is required and in
particular [llama-cpp-python](https://github.com/abetlen/llama-cpp-python)
is used.

You'll need to have a valid C++ compiler like gcc installed. See [Troubleshooting: C++ Compiler](#troubleshooting-c-compiler) for more details.

> It's highly encouraged that you fully read llama-cpp and llama-cpp-python documentation relevant to your platform.
> Running into installation issues is very likely, and you'll need to troubleshoot them yourself.

##### Llama-CPP OSX GPU support

You will need to build [llama.cpp](https://github.com/ggerganov/llama.cpp) with metal support.

To do that, you need to install `llama.cpp` python's binding `llama-cpp-python` through pip, with the compilation flag
that activate `METAL`: you have to pass `-DLLAMA_METAL=on` to the CMake command tha `pip` runs for you (see below).

In other words, one should simply run:
```bash
CMAKE_ARGS="-DLLAMA_METAL=on" pip install --force-reinstall --no-cache-dir llama-cpp-python
```

The above command will force the re-installation of `llama-cpp-python` with `METAL` support by compiling
`llama.cpp` locally with your `METAL` libraries (shipped by default with your macOS).

More information is available in the documentation of the libraries themselves:
* [llama-cpp-python](https://github.com/abetlen/llama-cpp-python#installation-with-hardware-acceleration)
* [llama-cpp-python's documentation](https://llama-cpp-python.readthedocs.io/en/latest/#installation-with-hardware-acceleration)
* [llama.cpp](https://github.com/ggerganov/llama.cpp#build)

##### Llama-CPP Windows NVIDIA GPU support

Windows GPU support is done through CUDA.
Follow the instructions on the original [llama.cpp](https://github.com/ggerganov/llama.cpp) repo to install the required
dependencies.

Some tips to get it working with an NVIDIA card and CUDA (Tested on Windows 10 with CUDA 11.5 RTX 3070):

* Install latest VS2022 (and build tools) https://visualstudio.microsoft.com/vs/community/
* Install CUDA toolkit https://developer.nvidia.com/cuda-downloads
* Verify your installation is correct by running `nvcc --version` and `nvidia-smi`, ensure your CUDA version is up to
  date and your GPU is detected.
* [Optional] Install CMake to troubleshoot building issues by compiling llama.cpp directly https://cmake.org/download/

If you have all required dependencies properly configured running the
following powershell command should succeed.

```powershell
$env:CMAKE_ARGS='-DLLAMA_CUBLAS=on'; poetry run pip install --force-reinstall --no-cache-dir llama-cpp-python numpy==1.26.0
```

If your installation was correct, you should see a message similar to the following next
time you start the server `BLAS = 1`. If there is some issue, please refer to the
[troubleshooting](/installation/getting-started/troubleshooting#building-llama-cpp-with-nvidia-gpu-support) section.

```console
llama_new_context_with_model: total VRAM used: 4857.93 MB (model: 4095.05 MB, context: 762.87 MB)
AVX = 1 | AVX2 = 1 | AVX512 = 0 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | FMA = 1 | NEON = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 1 | SSE3 = 1 | SSSE3 = 0 | VSX = 0 |
```

Note that llama.cpp offloads matrix calculations to the GPU but the performance is
still hit heavily due to latency between CPU and GPU communication. You might need to tweak
batch sizes and other parameters to get the best performance for your particular system.

##### Llama-CPP Linux NVIDIA GPU support and Windows-WSL

Linux GPU support is done through CUDA.
Follow the instructions on the original [llama.cpp](https://github.com/ggerganov/llama.cpp) repo to install the required
external
dependencies.

Some tips:

* Make sure you have an up-to-date C++ compiler
* Install CUDA toolkit https://developer.nvidia.com/cuda-downloads
* Verify your installation is correct by running `nvcc --version` and `nvidia-smi`, ensure your CUDA version is up to
  date and your GPU is detected.

After that running the following command in the repository will install llama.cpp with GPU support:

```bash
CMAKE_ARGS='-DLLAMA_CUBLAS=on' poetry run pip install --force-reinstall --no-cache-dir llama-cpp-python numpy==1.26.0
```

If your installation was correct, you should see a message similar to the following next
time you start the server `BLAS = 1`. If there is some issue, please refer to the
[troubleshooting](/installation/getting-started/troubleshooting#building-llama-cpp-with-nvidia-gpu-support) section.

```
llama_new_context_with_model: total VRAM used: 4857.93 MB (model: 4095.05 MB, context: 762.87 MB)
AVX = 1 | AVX2 = 1 | AVX512 = 0 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | FMA = 1 | NEON = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 1 | SSE3 = 1 | SSSE3 = 0 | VSX = 0 |
```

##### Llama-CPP Linux AMD GPU support

Linux GPU support is done through ROCm.
Some tips:
* Install ROCm from [quick-start install guide](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/tutorial/quick-start.html)
* [Install PyTorch for ROCm](https://rocm.docs.amd.com/projects/radeon/en/latest/docs/install/install-pytorch.html)
```bash
wget https://repo.radeon.com/rocm/manylinux/rocm-rel-6.0/torch-2.1.1%2Brocm6.0-cp311-cp311-linux_x86_64.whl
poetry run pip install --force-reinstall --no-cache-dir torch-2.1.1+rocm6.0-cp311-cp311-linux_x86_64.whl
```
* Install bitsandbytes for ROCm
```bash
PYTORCH_ROCM_ARCH=gfx900,gfx906,gfx908,gfx90a,gfx1030,gfx1100,gfx1101,gfx940,gfx941,gfx942
BITSANDBYTES_VERSION=62353b0200b8557026c176e74ac48b84b953a854
git clone https://github.com/arlo-phoenix/bitsandbytes-rocm-5.6
cd bitsandbytes-rocm-5.6
git checkout ${BITSANDBYTES_VERSION}
make hip ROCM_TARGET=${PYTORCH_ROCM_ARCH} ROCM_HOME=/opt/rocm/
pip install . --extra-index-url https://download.pytorch.org/whl/nightly
```

After that running the following command in the repository will install llama.cpp with GPU support:
```bash
LLAMA_CPP_PYTHON_VERSION=0.2.56
DAMDGPU_TARGETS=gfx900;gfx906;gfx908;gfx90a;gfx1030;gfx1100;gfx1101;gfx940;gfx941;gfx942
CMAKE_ARGS="-DLLAMA_HIPBLAS=ON -DCMAKE_C_COMPILER=/opt/rocm/llvm/bin/clang -DCMAKE_CXX_COMPILER=/opt/rocm/llvm/bin/clang++ -DAMDGPU_TARGETS=${DAMDGPU_TARGETS}" poetry run pip install --force-reinstall --no-cache-dir llama-cpp-python==${LLAMA_CPP_PYTHON_VERSION}
```

If your installation was correct, you should see a message similar to the following next time you start the server `BLAS = 1`.

```
AVX = 1 | AVX_VNNI = 0 | AVX2 = 1 | AVX512 = 0 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | FMA = 1 | NEON = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 1 | SSE3 = 1 | SSSE3 = 1 | VSX = 0 | MATMUL_INT8 = 0 |
```

##### Llama-CPP Known issues and Troubleshooting

Execution of LLMs locally still has a lot of sharp edges, specially when running on non Linux platforms.
You might encounter several issues:

* Performance: RAM or VRAM usage is very high, your computer might experience slowdowns or even crashes.
* GPU Virtualization on Windows and OSX: Simply not possible with docker desktop, you have to run the server directly on
  the host.
* Building errors: Some of PrivateGPT dependencies need to build native code, and they might fail on some platforms.
  Most likely you are missing some dev tools in your machine (updated C++ compiler, CUDA is not on PATH, etc.).
  If you encounter any of these issues, please open an issue and we'll try to help.

One of the first reflex to adopt is: get more information.
If, during your installation, something does not go as planned, retry in *verbose* mode, and see what goes wrong.

For example, when installing packages with `pip install`, you can add the option `-vvv` to show the details of the installation.

##### Llama-CPP Troubleshooting: C++ Compiler

If you encounter an error while building a wheel during the `pip install` process, you may need to install a C++
compiler on your computer.

**For Windows 10/11**

To install a C++ compiler on Windows 10/11, follow these steps:

1. Install Visual Studio 2022.
2. Make sure the following components are selected:
    * Universal Windows Platform development
    * C++ CMake tools for Windows
3. Download the MinGW installer from the [MinGW website](https://sourceforge.net/projects/mingw/).
4. Run the installer and select the `gcc` component.

**For OSX**

1. Check if you have a C++ compiler installed, `Xcode` should have done it for you. To install Xcode, go to the App
   Store and search for Xcode and install it. **Or** you can install the command line tools by running `xcode-select --install`.
2. If not, you can install clang or gcc with homebrew `brew install gcc`

##### Llama-CPP Troubleshooting: Mac Running Intel

When running a Mac with Intel hardware (not M1), you may run into _clang: error: the clang compiler does not support '
-march=native'_ during pip install.

If so set your archflags during pip install. eg: _ARCHFLAGS="-arch x86_64" pip3 install -r requirements.txt_


================================================
FILE: fern/docs/pages/installation/troubleshooting.mdx
================================================
# Downloading Gated and Private Models
Many models are gated or private, requiring special access to use them. Follow these steps to gain access and set up your environment for using these models.
## Accessing Gated Models
1. **Request Access:**
   Follow the instructions provided [here](https://huggingface.co/docs/hub/en/models-gated) to request access to the gated model.
2. **Generate a Token:**
   Once you have access, generate a token by following the instructions [here](https://huggingface.co/docs/hub/en/security-tokens).
3. **Set the Token:**
   Add the generated token to your `settings.yaml` file:
   ```yaml
   huggingface:
     access_token: <your-token>
   ```
   Alternatively, set the `HF_TOKEN` environment variable:
   ```bash
   export HF_TOKEN=<your-token>
   ```

# Tokenizer Setup
PrivateGPT uses the `AutoTokenizer` library to tokenize input text accurately. It connects to HuggingFace's API to download the appropriate tokenizer for the specified model.

## Configuring the Tokenizer
1. **Specify the Model:**
   In your `settings.yaml` file, specify the model you want to use:
   ```yaml
   llm:
     tokenizer: meta-llama/Meta-Llama-3.1-8B-Instruct
   ```
2. **Set Access Token for Gated Models:**
   If you are using a gated model, ensure the `access_token` is set as mentioned in the previous section.
This configuration ensures that PrivateGPT can download and use the correct tokenizer for the model you are working with.

# Embedding dimensions mismatch
If you encounter an error message like `Embedding dimensions mismatch`, it is likely due to the embedding model and
current vector dimension mismatch. To resolve this issue, ensure that the model and the input data have the same vector dimensions.

By default, PrivateGPT uses `nomic-embed-text` embeddings, which have a vector dimension of 768.
If you are using a different embedding model, ensure that the vector dimensions match the model's output.

<Callout intent = "warning">
In versions below to 0.6.0, the default embedding model was `BAAI/bge-small-en-v1.5` in `huggingface` setup.
If you plan to reuse the old generated embeddings, you need to update the `settings.yaml` file to use the correct embedding model:
```yaml
huggingface:
  embedding_hf_model_name: BAAI/bge-small-en-v1.5
embedding:
  embed_dim: 384
```
</Callout>

# Building Llama-cpp with NVIDIA GPU support

## Out-of-memory error

If you encounter an out-of-memory error while running `llama-cpp` with CUDA, you can try the following steps to resolve the issue:
1. **Set the next environment:**
    ```bash
    TOKENIZERS_PARALLELISM=true
    ```
2. **Run PrivateGPT:**
    ```bash
    poetry run python -m privategpt
    ```
Give thanks to [MarioRossiGithub](https://github.com/MarioRossiGithub) for providing the following solution.

================================================
FILE: fern/docs/pages/manual/ingestion-reset.mdx
================================================
# Reset Local documents database

When running in a local setup, you can remove all ingested documents by simply
deleting all contents of `local_data` folder (except .gitignore).

To simplify this process, you can use the command:
```bash
make wipe
```

# Advanced usage

You can actually delete your documents from your storage by using the
API endpoint `DELETE` in the Ingestion API.

================================================
FILE: fern/docs/pages/manual/ingestion.mdx
================================================
# Ingesting & Managing Documents

The ingestion of documents can be done in different ways:

* Using the `/ingest` API
* Using the Gradio UI
* Using the Bulk Local Ingestion functionality (check next section)

## Bulk Local Ingestion

You will need to activate `data.local_ingestion.enabled` in your setting file to use this feature. Additionally,
it is probably a good idea to set `data.local_ingestion.allow_ingest_from` to specify which folders are allowed to be ingested.

<Callout intent = "warning">
Be careful enabling this feature in a production environment, as it can be a security risk, as it allows users to
ingest any local file with permissions.
</Callout>

When you are running PrivateGPT in a fully local setup, you can ingest a complete folder for convenience (containing
pdf, text files, etc.)
and optionally watch changes on it with the command:

```bash
make ingest /path/to/folder -- --watch
```

To log the processed and failed files to an additional file, use:

```bash
make ingest /path/to/folder -- --watch --log-file /path/to/log/file.log
```

**Note for Windows Users:** Depending on your Windows version and whether you are using PowerShell to execute
PrivateGPT API calls, you may need to include the parameter name before passing the folder path for consumption:

```bash
make ingest arg=/path/to/folder -- --watch --log-file /path/to/log/file.log
```

After ingestion is complete, you should be able to chat with your documents
by navigating to http://localhost:8001 and using the option `Query documents`,
or using the completions / chat API.

## Ingestion troubleshooting

### Running out of memory

To do not run out of memory, you should ingest your documents without the LLM loaded in your (video) memory.
To do so, you should change your configuration to set `llm.mode: mock`.

You can also use the existing `PGPT_PROFILES=mock` that will set the following configuration for you:

```yaml
llm:
  mode: mock
embedding:
  mode: local
```

This configuration allows you to use hardware acceleration for creating embeddings while avoiding loading the full LLM into (video) memory.

Once your documents are ingested, you can set the `llm.mode` value back to `local` (or your previous custom value).

### Ingestion speed

The ingestion speed depends on the number of documents you are ingesting, and the size of each document.
To speed up the ingestion, you can change the ingestion mode in configuration.

The following ingestion mode exist:
* `simple`: historic behavior, ingest one document at a time, sequentially
* `batch`: read, parse, and embed multiple documents using batches (batch read, and then batch parse, and then batch embed)
* `parallel`: read, parse, and embed multiple documents in parallel. This is the fastest ingestion mode for local setup.
* `pipeline`: Alternative to parallel.
To change the ingestion mode, you can use the `embedding.ingest_mode` configuration value. The default value is `simple`.

To configure the number of workers used for parallel or batched ingestion, you can use
the `embedding.count_workers` configuration value. If you set this value too high, you might run out of
memory, so be mindful when setting this value. The default value is `2`.
For `batch` mode, you can easily set this value to your number of threads available on your CPU without
running out of memory. For `parallel` mode, you should be more careful, and set this value to a lower value.

The configuration below should be enough for users who want to stress more their hardware:
```yaml
embedding:
  ingest_mode: parallel
  count_workers: 4
```

If your hardware is powerful enough, and that you are loading heavy documents, you can increase the number of workers.
It is recommended to do your own tests to find the optimal value for your hardware.

If you have a `bash` shell, you can use this set of command to do your own benchmark:

```bash
# Wipe your local data, to put yourself in a clean state
# This will delete all your ingested documents
make wipe

time PGPT_PROFILES=mock python ./scripts/ingest_folder.py ~/my-dir/to-ingest/
```

## Supported file formats

PrivateGPT by default supports all the file formats that contains clear text (for example, `.txt` files, `.html`, etc.).
However, these text based file formats as only considered as text files, and are not pre-processed in any other way.

It also supports the following file formats:
* `.hwp`
* `.pdf`
* `.docx`
* `.pptx`
* `.ppt`
* `.pptm`
* `.jpg`
* `.png`
* `.jpeg`
* `.mp3`
* `.mp4`
* `.csv`
* `.epub`
* `.md`
* `.mbox`
* `.ipynb`
* `.json`

<Callout intent = "info">
While `PrivateGPT` supports these file formats, it **might** require additional
dependencies to be installed in your python's virtual environment.
For example, if you try to ingest `.epub` files, `PrivateGPT` might fail to do it, and will instead display an
explanatory error asking you to download the necessary dependencies to install this file format.
</Callout>

<Callout intent = "info">
**Other file formats might work**, but they will be considered as plain text
files (in other words, they will be ingested as `.txt` files).
</Callout>



================================================
FILE: fern/docs/pages/manual/llms.mdx
================================================
## Running the Server

PrivateGPT supports running with different LLMs & setups.

### Local models

Both the LLM and the Embeddings model will run locally.

Make sure you have followed the *Local LLM requirements* section before moving on.

This command will start PrivateGPT using the `settings.yaml` (default profile) together with the `settings-local.yaml`
configuration files. By default, it will enable both the API and the Gradio UI. Run:

```bash
PGPT_PROFILES=local make run
```

or

```bash
PGPT_PROFILES=local poetry run python -m private_gpt
```

When the server is started it will print a log *Application startup complete*.
Navigate to http://localhost:8001 to use the Gradio UI or to http://localhost:8001/docs (API section) to try the API
using Swagger UI.

#### Customizing low level parameters

Currently, not all the parameters of `llama.cpp` and `llama-cpp-python` are available at PrivateGPT's `settings.yaml` file.
In case you need to customize parameters such as the number of layers loaded into the GPU, you might change
these at the `llm_component.py` file under the `private_gpt/components/llm/llm_component.py`.

##### Available LLM config options

The `llm` section of the settings allows for the following configurations:

- `mode`: how to run your llm
- `max_new_tokens`: this lets you configure the number of new tokens the LLM will generate and add to the context window (by default Llama.cpp uses `256`)

Example:

```yaml
llm:
  mode: local
  max_new_tokens: 256
```

If you are getting an out of memory error, you might also try a smaller model or stick to the proposed
recommended models, instead of custom tuning the parameters.

### Using OpenAI

If you cannot run a local model (because you don't have a GPU, for example) or for testing purposes, you may
decide to run PrivateGPT using OpenAI as the LLM and Embeddings model.

In order to do so, create a profile `settings-openai.yaml` with the following contents:

```yaml
llm:
  mode: openai

openai:
  api_base: <openai-api-base-url> # Defaults to https://api.openai.com/v1
  api_key: <your_openai_api_key>  # You could skip this configuration and use the OPENAI_API_KEY env var instead
  model: <openai_model_to_use> # Optional model to use. Default is "gpt-3.5-turbo"
                               # Note: Open AI Models are listed here: https://platform.openai.com/docs/models
```

And run PrivateGPT loading that profile you just created:

`PGPT_PROFILES=openai make run`

or

`PGPT_PROFILES=openai poetry run python -m private_gpt`

When the server is started it will print a log *Application startup complete*.
Navigate to http://localhost:8001 to use the Gradio UI or to http://localhost:8001/docs (API section) to try the API.
You'll notice the speed and quality of response is higher, given you are using OpenAI's servers for the heavy
computations.

### Using OpenAI compatible API

Many tools, including [LocalAI](https://localai.io/) and [vLLM](https://docs.vllm.ai/en/latest/),
support serving local models with an OpenAI compatible API. Even when overriding the `api_base`,
using the `openai` mode doesn't allow you to use custom models. Instead, you should use the `openailike` mode:

```yaml
llm:
  mode: openailike
```

This mode uses the same settings as the `openai` mode.

As an example, you can follow the [vLLM quickstart guide](https://docs.vllm.ai/en/latest/getting_started/quickstart.html#openai-compatible-server)
to run an OpenAI compatible server. Then, you can run PrivateGPT using the `settings-vllm.yaml` profile:

`PGPT_PROFILES=vllm make run`

### Using Azure OpenAI

If you cannot run a local model (because you don't have a GPU, for example) or for testing purposes, you may
decide to run PrivateGPT using Azure OpenAI as the LLM and Embeddings model.

In order to do so, create a profile `settings-azopenai.yaml` with the following contents:

```yaml
llm:
  mode: azopenai

embedding:
  mode: azopenai

azopenai:
  api_key: <your_azopenai_api_key>  # You could skip this configuration and use the AZ_OPENAI_API_KEY env var instead
  azure_endpoint: <your_azopenai_endpoint> # You could skip this configuration and use the AZ_OPENAI_ENDPOINT env var instead
  api_version: <api_version> # The API version to use. Default is "2023_05_15"
  embedding_deployment_name: <your_embedding_deployment_name> # You could skip this configuration and use the AZ_OPENAI_EMBEDDING_DEPLOYMENT_NAME env var instead
  embedding_model: <openai_embeddings_to_use> # Optional model to use. Default is "text-embedding-ada-002" 
  llm_deployment_name: <your_model_deployment_name> # You could skip this configuration and use the AZ_OPENAI_LLM_DEPLOYMENT_NAME env var instead
  llm_model: <openai_model_to_use> # Optional model to use. Default is "gpt-35-turbo"
```

And run PrivateGPT loading that profile you just created:

`PGPT_PROFILES=azopenai make run`

or

`PGPT_PROFILES=azopenai poetry run python -m private_gpt`

When the server is started it will print a log *Application startup complete*.
Navigate to http://localhost:8001 to use the Gradio UI or to http://localhost:8001/docs (API section) to try the API.
You'll notice the speed and quality of response is higher, given you are using Azure OpenAI's servers for the heavy
computations.

### Using AWS Sagemaker

For a fully private & performant setup, you can choose to have both your LLM and Embeddings model deployed using Sagemaker.

Note: how to deploy models on Sagemaker is out of the scope of this documentation.

In order to do so, create a profile `settings-sagemaker.yaml` with the following contents (remember to
update the values of the llm_endpoint_name and embedding_endpoint_name to yours):

```yaml
llm:
  mode: sagemaker

sagemaker:
  llm_endpoint_name: huggingface-pytorch-tgi-inference-2023-09-25-19-53-32-140
  embedding_endpoint_name: huggingface-pytorch-inference-2023-11-03-07-41-36-479
```

And run PrivateGPT loading that profile you just created:

`PGPT_PROFILES=sagemaker make run`

or

`PGPT_PROFILES=sagemaker poetry run python -m private_gpt`

When the server is started it will print a log *Application startup complete*.
Navigate to http://localhost:8001 to use the Gradio UI or to http://localhost:8001/docs (API section) to try the API.

### Using Ollama

Another option for a fully private setup is using [Ollama](https://ollama.ai/).

Note: how to deploy Ollama and pull models onto it is out of the scope of this documentation.

In order to do so, create a profile `settings-ollama.yaml` with the following contents:

```yaml
llm:
  mode: ollama

ollama:
  model: <ollama_model_to_use> # Required Model to use.
                               # Note: Ollama Models are listed here: https://ollama.ai/library
                               #       Be sure to pull the model to your Ollama server
  api_base: <ollama-api-base-url> # Defaults to http://localhost:11434
```

And run PrivateGPT loading that profile you just created:

`PGPT_PROFILES=ollama make run`

or

`PGPT_PROFILES=ollama poetry run python -m private_gpt`

When the server is started it will print a log *Application startup complete*.
Navigate to http://localhost:8001 to use the Gradio UI or to http://localhost:8001/docs (API section) to try the API.

### Using IPEX-LLM

For a fully private setup on Intel GPUs (such as a local PC with an iGPU, or discrete GPUs like Arc, Flex, and Max), you can use [IPEX-LLM](https://github.com/intel-analytics/ipex-llm).

To deploy Ollama and pull models using IPEX-LLM, please refer to [this guide](https://ipex-llm.readthedocs.io/en/latest/doc/LLM/Quickstart/ollama_quickstart.html). Then, follow the same steps outlined in the [Using Ollama](#using-ollama) section to create a `settings-ollama.yaml` profile and run the private-GPT server.

### Using Gemini

If you cannot run a local model (because you don't have a GPU, for example) or for testing purposes, you may
decide to run PrivateGPT using Gemini as the LLM and Embeddings model. In addition, you will benefit from
multimodal inputs, such as text and images, in a very large contextual window.

In order to do so, create a profile `settings-gemini.yaml` with the following contents:

```yaml
llm:
  mode: gemini

embedding:
  mode: gemini

gemini:
  api_key: <your_gemini_api_key>                # You could skip this configuration and use the GEMINI_API_KEY env var instead
  model: <gemini_model_to_use>                  # Optional model to use. Default is models/gemini-pro"
  embedding_model: <gemini_embeddings_to_use>   # Optional model to use. Default is "models/embedding-001"
```

And run PrivateGPT loading that profile you just created:

`PGPT_PROFILES=gemini make run`

or

`PGPT_PROFILES=gemini poetry run python -m private_gpt`

When the server is started it will print a log *Application startup complete*.
Navigate to http://localhost:8001 to use the Gradio UI or to http://localhost:8001/docs (API section) to try the API.



================================================
FILE: fern/docs/pages/manual/nodestore.mdx
================================================
## NodeStores
PrivateGPT supports **Simple** and [Postgres](https://www.postgresql.org/) providers. Simple being the default.

In order to select one or the other, set the `nodestore.database` property in the `settings.yaml` file to `simple` or `postgres`.

```yaml
nodestore:
  database: simple
```

### Simple Document Store

Setting up simple document store: Persist data with in-memory and disk storage.

Enabling the simple document store is an excellent choice for small projects or proofs of concept where you need to persist data while maintaining minimal setup complexity. To get started, set the nodestore.database property in your settings.yaml file as follows:

```yaml
nodestore:
  database: simple
```
The beauty of the simple document store is its flexibility and ease of implementation. It provides a solid foundation for managing and retrieving data without the need for complex setup or configuration. The combination of in-memory processing and disk persistence ensures that you can efficiently handle small to medium-sized datasets while maintaining data consistency across runs.

### Postgres Document Store

To enable Postgres, set the `nodestore.database` property in the `settings.yaml` file to `postgres` and install the `storage-nodestore-postgres` extra.  Note: Vector Embeddings Storage in Postgres is configured separately

```bash
poetry install --extras storage-nodestore-postgres
```

The available configuration options are:
| Field         | Description                                               |
|---------------|-----------------------------------------------------------|
| **host**      | The server hosting the Postgres database. Default is `localhost` |
| **port**      | The port on which the Postgres database is accessible. Default is `5432` |
| **database**  | The specific database to connect to. Default is `postgres` |
| **user**      | The username for database access. Default is `postgres` |
| **password**  | The password for database access. (Required)            |
| **schema_name** | The database schema to use. Default is `private_gpt`       |

For example:
```yaml
nodestore:
  database: postgres

postgres:
  host: localhost
  port: 5432
  database: postgres
  user: postgres
  password: <PASSWORD>
  schema_name: private_gpt
```

Given the above configuration, Two PostgreSQL tables will be created upon successful connection: one for storing metadata related to the index and another for document data itself.

```
postgres=# \dt private_gpt.*
                  List of relations
   Schema    |      Name       | Type  |    Owner     
-------------+-----------------+-------+--------------
 private_gpt | data_docstore   | table | postgres
 private_gpt | data_indexstore | table | postgres

postgres=# 
```


================================================
FILE: fern/docs/pages/manual/reranker.mdx
================================================
## Enhancing Response Quality with Reranking

PrivateGPT offers a reranking feature aimed at optimizing response generation by filtering out irrelevant documents, potentially leading to faster response times and enhanced relevance of answers generated by the LLM.

### Enabling Reranking

Document reranking can significantly improve the efficiency and quality of the responses by pre-selecting the most relevant documents before generating an answer. To leverage this feature, ensure that it is enabled in the RAG settings and consider adjusting the parameters to best fit your use case.

#### Additional Requirements

Before enabling reranking, you must install additional dependencies:

```bash
poetry install --extras rerank-sentence-transformers
```

This command installs dependencies for the cross-encoder reranker from sentence-transformers, which is currently the only supported method by PrivateGPT for document reranking.

#### Configuration

To enable and configure reranking, adjust the `rag` section within the `settings.yaml` file. Here are the key settings to consider:

- `similarity_top_k`: Determines the number of documents to initially retrieve and consider for reranking. This value should be larger than `top_n`.
- `rerank`:
  - `enabled`: Set to `true` to activate the reranking feature.
  - `top_n`: Specifies the number of documents to use in the final answer generation process, chosen from the top-ranked documents provided by `similarity_top_k`.

Example configuration snippet:

```yaml
rag:
  similarity_top_k: 10  # Number of documents to retrieve and consider for reranking
  rerank:
    enabled: true
    top_n: 3  # Number of top-ranked documents to use for generating the answer
```

================================================
FILE: fern/docs/pages/manual/settings.mdx
================================================
# Settings and profiles for your private GPT

The configuration of your private GPT server is done thanks to `settings` files (more precisely `settings.yaml`).
These text files are written using the [YAML](https://en.wikipedia.org/wiki/YAML) syntax.

While PrivateGPT is distributing safe and universal configuration files, you might want to quickly customize your
PrivateGPT, and this can be done using the `settings` files.

This project is defining the concept of **profiles** (or configuration profiles).
This mechanism, using your environment variables, is giving you the ability to easily switch between
configuration you've made.

A typical use case of profile is to easily switch between LLM and embeddings.
To be a bit more precise, you can change the language (to French, Spanish, Italian, English, etc) by simply changing
the profile you've selected; no code changes required!

PrivateGPT is configured through *profiles* that are defined using yaml files, and selected through env variables.
The full list of properties configurable can be found in `settings.yaml`.

## How to know which profiles exist
Given that a profile `foo_bar` points to the file `settings-foo_bar.yaml` and vice-versa, you simply have to look
at the files starting with `settings` and ending in `.yaml`.

## How to use an existing profiles
**Please note that the syntax to set the value of an environment variables depends on your OS**.
You have to set environment variable `PGPT_PROFILES` to the name of the profile you want to use.

For example, on **linux and macOS**, this gives:
```bash
export PGPT_PROFILES=my_profile_name_here
```

Windows Command Prompt (cmd) has a different syntax:
```shell
set PGPT_PROFILES=my_profile_name_here
```

Windows Powershell has a different syntax:
```shell
$env:PGPT_PROFILES="my_profile_name_here"
```
If the above is not working, you might want to try other ways to set an env variable in your window's terminal.

---

Once you've set this environment variable to the desired profile, you can simply launch your PrivateGPT,
and it will run using your profile on top of the default configuration.

## Reference
Additional details on the profiles are described in this section

### Environment variable `PGPT_SETTINGS_FOLDER`

The location of the settings folder. Defaults to the root of the project.
Should contain the default `settings.yaml` and any other `settings-{profile}.yaml`.

### Environment variable `PGPT_PROFILES`

By default, the profile definition in `settings.yaml` is loaded.
Using this env var you can load additional profiles; format is a comma separated list of profile names.
This will merge `settings-{profile}.yaml` on top of the base settings file.

For example:
`PGPT_PROFILES=local,cuda` will load `settings-local.yaml`
and `settings-cuda.yaml`, their contents will be merged with
later profiles properties overriding values of earlier ones like `settings.yaml`.

During testing, the `test` profile will be active along with the default, therefore `settings-test.yaml`
file is required.

### Environment variables expansion

Configuration files can contain environment variables,
they will be expanded at runtime.

Expansion must follow the pattern `${VARIABLE_NAME:default_value}`.

For example, the following configuration will use the value of the `PORT`
environment variable or `8001` if it's not set.
Missing variables with no default will produce an error.

```yaml
server:
  port: ${PORT:8001}
```

================================================
FILE: fern/docs/pages/manual/vectordb.mdx
================================================
## Vectorstores
PrivateGPT supports [Qdrant](https://qdrant.tech/), [Milvus](https://milvus.io/), [Chroma](https://www.trychroma.com/), [PGVector](https://github.com/pgvector/pgvector) and [ClickHouse](https://github.com/ClickHouse/ClickHouse) as vectorstore providers. Qdrant being the default.

In order to select one or the other, set the `vectorstore.database` property in the `settings.yaml` file to `qdrant`, `milvus`, `chroma`, `postgres` and `clickhouse`.

```yaml
vectorstore:
  database: qdrant
```

### Qdrant configuration

To enable Qdrant, set the `vectorstore.database` property in the `settings.yaml` file to `qdrant`.

Qdrant settings can be configured by setting values to the `qdrant` property in the `settings.yaml` file.

The available configuration options are:
| Field        | Description |
|--------------|-------------|
| location     | If `:memory:` - use in-memory Qdrant instance. If `str` - use it as a `url` parameter.|
| url          | Either host or str of 'Optional[scheme], host, Optional[port], Optional[prefix]'. Eg. `http://localhost:6333` |
| port         | Port of the REST API interface. Default: `6333` |
| grpc_port    | Port of the gRPC interface. Default: `6334` |
| prefer_grpc  | If `true` - use gRPC interface whenever possible in custom methods. |
| https        | If `true` - use HTTPS(SSL) protocol.|
| api_key      | API key for authentication in Qdrant Cloud.|
| prefix       | If set, add `prefix` to the REST URL path. Example: `service/v1` will result in `http://localhost:6333/service/v1/{qdrant-endpoint}` for REST API.|
| timeout      | Timeout for REST and gRPC API requests. Default: 5.0 seconds for REST and unlimited for gRPC |
| host         | Host name of Qdrant service. If url and host are not set, defaults to 'localhost'.|
| path         | Persistence path for QdrantLocal. Eg. `local_data/private_gpt/qdrant`|
| force_disable_check_same_thread         | Force disable check_same_thread for QdrantLocal sqlite connection, defaults to True.|

By default Qdrant tries to connect to an instance of Qdrant server at `http://localhost:3000`.

To obtain a local setup (disk-based database) without running a Qdrant server, configure the `qdrant.path` value in settings.yaml:

```yaml
qdrant:
  path: local_data/private_gpt/qdrant
```

### Milvus configuration

To enable Milvus, set the `vectorstore.database` property in the `settings.yaml` file to `milvus` and install the `milvus` extra.

```bash
poetry install --extras vector-stores-milvus
```

The available configuration options are:
| Field        | Description |
|--------------|-------------|
| uri     | Default is set to "local_data/private_gpt/milvus/milvus_local.db" as a local file; you can also set up a more performant Milvus server on docker or k8s e.g.http://localhost:19530, as your uri; To use Zilliz Cloud, adjust the uri and token to Endpoint and Api key in Zilliz Cloud.|
| token          | Pair with Milvus server on docker or k8s or zilliz cloud api key.|
| collection_name         | The name of the collection, set to default "milvus_db".|
| overwrite    | Overwrite the data in collection if it existed, set to default as True. |

To obtain a local setup (disk-based database) without running a Milvus server, configure the uri value in settings.yaml, to store in local_data/private_gpt/milvus/milvus_local.db.

### Chroma configuration

To enable Chroma, set the `vectorstore.database` property in the `settings.yaml` file to `chroma` and install the `chroma` extra.

```bash
poetry install --extras chroma
```

By default `chroma` will use a disk-based database stored in local_data_path / "chroma_db" (being local_data_path defined in settings.yaml)

### PGVector
To use the PGVector store a [postgreSQL](https://www.postgresql.org/) database with the PGVector extension must be used.

To enable PGVector, set the `vectorstore.database` property in the `settings.yaml` file to `postgres` and install the `vector-stores-postgres` extra.

```bash
poetry install --extras vector-stores-postgres
```

PGVector settings can be configured by setting values to the `postgres` property in the `settings.yaml` file.

The available configuration options are:
| Field         | Description                                               |
|---------------|-----------------------------------------------------------|
| **host**      | The server hosting the Postgres database. Default is `localhost` |
| **port**      | The port on which the Postgres database is accessible. Default is `5432` |
| **database**  | The specific database to connect to. Default is `postgres` |
| **user**      | The username for database access. Default is `postgres` |
| **password**  | The password for database access. (Required)            |
| **schema_name** | The database schema to use. Default is `private_gpt`       |

For example:
```yaml
vectorstore:
  database: postgres

postgres:
  host: localhost
  port: 5432
  database: postgres
  user: postgres
  password: <PASSWORD>
  schema_name: private_gpt
```

The following table will be created in the database
```
postgres=# \d private_gpt.data_embeddings
                                      Table "private_gpt.data_embeddings"
  Column   |       Type        | Collation | Nullable |                         Default
-----------+-------------------+-----------+----------+---------------------------------------------------------
 id        | bigint            |           | not null | nextval('private_gpt.data_embeddings_id_seq'::regclass)
 text      | character varying |           | not null |
 metadata_ | json              |           |          |
 node_id   | character varying |           |          |
 embedding | vector(768)       |           |          |
Indexes:
    "data_embeddings_pkey" PRIMARY KEY, btree (id)

postgres=# 
```
The dimensions of the embeddings columns will be set based on the `embedding.embed_dim` value.  If the embedding model changes this table may need to be dropped and recreated to avoid a dimension mismatch.

### ClickHouse

To utilize ClickHouse as the vector store, a [ClickHouse](https://github.com/ClickHouse/ClickHouse) database must be employed.

To enable ClickHouse, set the `vectorstore.database` property in the `settings.yaml` file to `clickhouse` and install the `vector-stores-clickhouse` extra.

```bash
poetry install --extras vector-stores-clickhouse
```

ClickHouse settings can be configured by setting values to the `clickhouse` property in the `settings.yaml` file.

The available configuration options are:
| Field                | Description                                                    |
|----------------------|----------------------------------------------------------------|
| **host**             | The server hosting the ClickHouse database. Default is `localhost` |
| **port**             | The port on which the ClickHouse database is accessible. Default is `8123` |
| **username**         | The username for database access. Default is `default` |
| **password**         | The password for database access. (Optional) |
| **database**         | The specific database to connect to. Default is `__default__` |
| **secure**           | Use https/TLS for secure connection to the server. Default is `false` |
| **interface**        | The protocol used for the connection, either 'http' or 'https'. (Optional) |
| **settings**         | Specific ClickHouse server settings to be used with the session. (Optional) |
| **connect_timeout**  | Timeout in seconds for establishing a connection. (Optional) |
| **send_receive_timeout** | Read timeout in seconds for http connection. (Optional) |
| **verify**           | Verify the server certificate in secure/https mode. (Optional) |
| **ca_cert**          | Path to Certificate Authority root certificate (.pem format). (Optional) |
| **client_cert**      | Path to TLS Client certificate (.pem format). (Optional) |
| **client_cert_key**  | Path to the private key for the TLS Client certificate. (Optional) |
| **http_proxy**       | HTTP proxy address. (Optional) |
| **https_proxy**      | HTTPS proxy address. (Optional) |
| **server_host_name** | Server host name to be checked against the TLS certificate. (Optional) |

For example:
```yaml
vectorstore:
  database: clickhouse

clickhouse:
  host: localhost
  port: 8443
  username: admin
  password: <PASSWORD>
  database: embeddings
  secure: false
```

The following table will be created in the database:
```
clickhouse-client
:) \d embeddings.llama_index
                                   Table "llama_index"
  № |  name     | type                                         | default_type | default_expression | comment | codec_expression | ttl_expression
----|-----------|----------------------------------------------|--------------|--------------------|---------|------------------|---------------
  1 | id        | String                                       |              |                    |         |                  |
  2 | doc_id    | String                                       |              |                    |         |                  |
  3 | text      | String                                       |              |                    |         |                  |
  4 | vector    | Array(Float32)                               |              |                    |         |                  |
  5 | node_info | Tuple(start Nullable(UInt64), end Nullable(UInt64)) |       |                    |         |                  |
  6 | metadata  | String                                       |              |                    |         |                  |

clickhouse-client
```

The dimensions of the embeddings columns will be set based on the `embedding.embed_dim` value. If the embedding model changes, this table may need to be dropped and recreated to avoid a dimension mismatch.


================================================
FILE: fern/docs/pages/overview/welcome.mdx
================================================
PrivateGPT provides an **API** containing all the building blocks required to
build **private, context-aware AI applications**.

<Callout intent = "tip">
If you are looking for an **enterprise-ready, fully private AI workspace**
check out [Zylon's website](https://zylon.ai)  or [request a demo](https://cal.com/zylon/demo?source=pgpt-docs).
Crafted by the team behind PrivateGPT, Zylon is a best-in-class AI collaborative
workspace that can be easily deployed on-premise (data center, bare metal...) or in your private cloud (AWS, GCP, Azure...).
</Callout>

The API follows and extends OpenAI API standard, and supports both normal and streaming responses.
That means that, if you can use OpenAI API in one of your tools, you can use your own PrivateGPT API instead,
with no code changes, **and for free** if you are running PrivateGPT in a `local` setup.

Get started by understanding the [Main Concepts and Installation](/installation) and then dive into the [API Reference](/api-reference).

## Frequently Visited Resources

<Cards>
  <Card
    title="Main Concepts"
    icon="fa-solid fa-lines-leaning"
    href="/installation"
  />
  <Card
    title="API Reference"
    icon="fa-solid fa-code"
    href="/api-reference"
  />
  <Card
    title="Twitter"
    icon="fa-brands fa-twitter"
    href="https://twitter.com/PrivateGPT_AI"
  />
  <Card
    title="Discord Server"
    icon="fa-brands fa-discord"
    href="https://discord.gg/bK6mRVpErU"
  />
</Cards>

<br />

================================================
FILE: fern/docs/pages/quickstart/quickstart.mdx
================================================
This guide provides a quick start for running different profiles of PrivateGPT using Docker Compose.
The profiles cater to various environments, including Ollama setups (CPU, CUDA, MacOS), and a fully local setup.

By default, Docker Compose will download pre-built images from a remote registry when starting the services. However, you have the option to build the images locally if needed. Details on building Docker image locally are provided at the end of this guide.

If you want to run PrivateGPT locally without Docker, refer to the [Local Installation Guide](/installation).

## Prerequisites
- **Docker and Docker Compose:** Ensure both are installed on your system.
  [Installation Guide for Docker](https://docs.docker.com/get-docker/), [Installation Guide for Docker Compose](https://docs.docker.com/compose/install/).
- **Clone PrivateGPT Repository:** Clone the PrivateGPT repository to your machine and navigate to the directory:
  ```sh
  git clone https://github.com/zylon-ai/private-gpt.git
  cd private-gpt
  ```

## Setups

### Ollama Setups (Recommended)

#### 1. Default/Ollama CPU

**Description:**
This profile runs the Ollama service using CPU resources. It is the standard configuration for running Ollama-based Private-GPT services without GPU acceleration.

**Run:**
To start the services using pre-built images, run:
```sh
docker-compose up
```
or with a specific profile:
```sh
docker-compose --profile ollama-cpu up
```

#### 2. Ollama Nvidia CUDA

**Description:**
This profile leverages GPU acceleration with CUDA support, suitable for computationally intensive tasks that benefit from GPU resources.

**Requirements:**
Ensure that your system has compatible GPU hardware and the necessary NVIDIA drivers installed. The installation process is detailed [here](https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html).

**Run:**
To start the services with CUDA support using pre-built images, run:
```sh
docker-compose --profile ollama-cuda up
```

#### 3. Ollama External API

**Description:**
This profile is designed for running PrivateGPT using Ollama installed on the host machine. This setup is particularly useful for MacOS users, as Docker does not yet support Metal GPU.

**Requirements:**
Install Ollama on your machine by following the instructions at [ollama.ai](https://ollama.ai/).

**Run:**
To start the Ollama service, use:
```sh
OLLAMA_HOST=0.0.0.0 ollama serve
```
To start the services with the host configuration using pre-built images, run:
```sh
docker-compose --profile ollama-api up
```

### Fully Local Setups

#### 1. LlamaCPP CPU

**Description:**
This profile runs the Private-GPT services locally using `llama-cpp` and Hugging Face models.

**Requirements:**
A **Hugging Face Token (HF_TOKEN)** is required for accessing Hugging Face models. Obtain your token following [this guide](/installation/getting-started/troubleshooting#downloading-gated-and-private-models).

**Run:**
Start the services with your Hugging Face token using pre-built images:
```sh
HF_TOKEN=<your_hf_token> docker-compose --profile llamacpp-cpu up
```
Replace `<your_hf_token>` with your actual Hugging Face token.

## Building Locally

If you prefer to build Docker images locally, which is useful when making changes to the codebase or the Dockerfiles, follow these steps:

### Building Locally
To build the Docker images locally, navigate to the cloned repository directory and run:
```sh
docker-compose build
```
This command compiles the necessary Docker images based on the current codebase and Dockerfile configurations.

### Forcing a Rebuild with --build
If you have made changes and need to ensure these changes are reflected in the Docker images, you can force a rebuild before starting the services:
```sh
docker-compose up --build
```
or with a specific profile:
```sh
docker-compose --profile <profile_name> up --build
```
Replace `<profile_name>` with the desired profile.

================================================
FILE: fern/docs/pages/recipes/quickstart.mdx
================================================
# Recipes

Recipes are predefined use cases that help users solve very specific tasks using PrivateGPT.
They provide a streamlined approach to achieve common goals with the platform, offering both a starting point and inspiration for further exploration.
The main goal of Recipes is to empower the community to create and share solutions, expanding the capabilities of PrivateGPT.

## How to Create a New Recipe

1. **Identify the Task**: Define a specific task or problem that the Recipe will address.
2. **Develop the Solution**: Create a clear and concise guide, including any necessary code snippets or configurations.
3. **Submit a PR**: Fork the PrivateGPT repository, add your Recipe to the appropriate section, and submit a PR for review.

We encourage you to be creative and think outside the box! Your contributions help shape the future of PrivateGPT.

## Available Recipes

<Cards>
  <Card
    title="Summarize"
    icon="fa-solid fa-file-alt"
    href="/recipes/general-use-cases/summarize"
  />
</Cards>


================================================
FILE: fern/docs/pages/recipes/summarize.mdx
================================================
The Summarize Recipe provides a method to extract concise summaries from ingested documents or texts using PrivateGPT.
This tool is particularly useful for quickly understanding large volumes of information by distilling key points and main ideas.

## Use Case

The primary use case for the `Summarize` tool is to automate the summarization of lengthy documents,
making it easier for users to grasp the essential information without reading through entire texts.
This can be applied in various scenarios, such as summarizing research papers, news articles, or business reports.

## Key Features

1. **Ingestion-compatible**: The user provides the text to be summarized. The text can be directly inputted or retrieved from ingested documents within the system.
2. **Customization**: The summary generation can be influenced by providing specific `instructions` or a `prompt`. These inputs guide the model on how to frame the summary, allowing for customization according to user needs.
3. **Streaming Support**: The tool supports streaming, allowing for real-time summary generation, which can be particularly useful for handling large texts or providing immediate feedback.

## Contributing

If you have ideas for improving the Summarize or want to add new features, feel free to contribute!
You can submit your enhancements via a pull request on our [GitHub repository](https://github.com/zylon-ai/private-gpt).



================================================
FILE: fern/docs/pages/ui/alternatives.mdx
================================================

This page aims to present different user interface (UI) alternatives for integrating and using PrivateGPT. These alternatives range from demo applications to fully customizable UI setups that can be adapted to your specific needs.

**Do you have any working demo project using PrivateGPT?**

Please open a PR to add it to the list, and come on our Discord to tell us about it!

<Callout intent = "note">
WIP: This page provides an overview of one of the UI alternatives available for PrivateGPT. More alternatives will be added to this page as they become available.
</Callout>

## [PrivateGPT SDK Demo App](https://github.com/frgarciames/privategpt-react)

The PrivateGPT SDK demo app is a robust starting point for developers looking to integrate and customize PrivateGPT in their applications. Leveraging modern technologies like Tailwind, shadcn/ui, and Biomejs, it provides a smooth development experience and a highly customizable user interface. Refer to the [repository](https://github.com/frgarciames/privategpt-react) for more details and to get started.

**Tech Stack:**

- **Tailwind:** A utility-first CSS framework for rapid UI development.
- **shadcn/ui:** A set of high-quality, customizable UI components.
- **PrivateGPT Web SDK:** The core SDK for interacting with PrivateGPT.
- **Biomejs formatter/linter:** A tool for maintaining code quality and consistency.


================================================
FILE: fern/docs/pages/ui/gradio.mdx
================================================
## Gradio UI user manual

Gradio UI is a ready to use way of testing most of PrivateGPT API functionalities.

![Gradio PrivateGPT](https://github.com/zylon-ai/private-gpt/raw/main/fern/docs/assets/ui.png?raw=true)

<Callout intent = "warning">
A working **Gradio UI client** is provided to test the API, together with a set of useful tools such as bulk
model download script, ingestion script, documents folder watch, etc. Please refer to the [UI alternatives](/manual/user-interface/alternatives) page for more UI alternatives.
</Callout>

### Execution Modes

It has 3 modes of execution (you can select in the top-left):

* Query Docs: uses the context from the
  ingested documents to answer the questions posted in the chat. It also takes
  into account previous chat messages as context.
    * Makes use of `/chat/completions` API with `use_context=true` and no
      `context_filter`.
* Search in Docs: fast search that returns the 4 most related text
  chunks, together with their source document and page.
    * Makes use of `/chunks` API with no `context_filter`, `limit=4` and
      `prev_next_chunks=0`.
* LLM Chat: simple, non-contextual chat with the LLM. The ingested documents won't
  be taken into account, only the previous messages.
    * Makes use of `/chat/completions` API with `use_context=false`.

### Document Ingestion

Ingest documents by using the `Upload a File` button. You can check the progress of
the ingestion in the console logs of the server.

The list of ingested files is shown below the button.

If you want to delete the ingested documents, refer to *Reset Local documents
database* section in the documentation.

### Chat

Normal chat interface, self-explanatory ;)

#### System Prompt
You can view and change the system prompt being passed to the LLM by clicking "Additional Inputs"
in the chat interface. The system prompt is also logged on the server.

By default, the `Query Docs` mode uses the setting value `ui.default_query_system_prompt`.

The `LLM Chat` mode attempts to use the optional settings value `ui.default_chat_system_prompt`.

If no system prompt is entered, the UI will display the default system prompt being used
for the active mode.

##### System Prompt Examples:

The system prompt can effectively provide your chat bot specialized roles, and results tailored to the prompt
you have given the model. Examples of system prompts can be be found
[here](https://www.w3schools.com/gen_ai/chatgpt-3-5/chatgpt-3-5_roles.php).

Some interesting examples to try include:

* You are -X-. You have all the knowledge and personality of -X-. Answer as if you were -X- using
their manner of speaking and vocabulary.
    * Example: You are Shakespeare. You have all the knowledge and personality of Shakespeare.
    Answer as if you were Shakespeare using their manner of speaking and vocabulary.
* You are an expert (at) -role-. Answer all questions using your expertise on -specific domain topic-.
    * Example: You are an expert software engineer. Answer all questions using your expertise on Python.
* You are a -role- bot, respond with -response criteria needed-. If no -response criteria- is needed,
respond with -alternate response-.
    * Example: You are a grammar checking bot, respond with any grammatical corrections needed. If no corrections
    are needed, respond with "verified".

================================================
FILE: fern/docs.yml
================================================
# Main Fern configuration file
instances:
  - url: privategpt.docs.buildwithfern.com
    custom-domain: docs.privategpt.dev

title: PrivateGPT | Docs

# The tabs definition, in the top left corner
tabs:
  overview:
    display-name: Overview
    icon: "fa-solid fa-home"
  quickstart:
    display-name: Quickstart
    icon: "fa-solid fa-rocket"
  installation:
    display-name: Installation
    icon: "fa-solid fa-download"
  manual:
    display-name: Manual
    icon: "fa-solid fa-book"
  recipes:
    display-name: Recipes
    icon: "fa-solid fa-flask"
  api-reference:
    display-name: API Reference
    icon: "fa-solid fa-file-contract"

# Definition of tabs contents, will be displayed on the left side of the page, below all tabs
navigation:
  # The default tab
  - tab: overview
    layout:
      - section: Welcome
        contents:
          - page: Introduction
            path: ./docs/pages/overview/welcome.mdx
  - tab: quickstart
    layout:
      - section: Getting started
        contents:
          - page: Quickstart
            path: ./docs/pages/quickstart/quickstart.mdx
  # How to install PrivateGPT, with FAQ and troubleshooting
  - tab: installation
    layout:
      - section: Getting started
        contents:
          - page: Main Concepts
            path: ./docs/pages/installation/concepts.mdx
          - page: Installation
            path: ./docs/pages/installation/installation.mdx
          - page: Troubleshooting
            path: ./docs/pages/installation/troubleshooting.mdx
  # Manual of PrivateGPT: how to use it and configure it
  - tab: manual
    layout:
      - section: General configuration
        contents:
          - page: Configuration
            path: ./docs/pages/manual/settings.mdx
      - section: Document management
        contents:
          - page: Ingestion
            path: ./docs/pages/manual/ingestion.mdx
          - page: Deletion
            path: ./docs/pages/manual/ingestion-reset.mdx
      - section: Storage
        contents:
          - page: Vector Stores
            path: ./docs/pages/manual/vectordb.mdx
          - page: Node Stores
            path: ./docs/pages/manual/nodestore.mdx
      - section: Advanced Setup
        contents:
          - page: LLM Backends
            path: ./docs/pages/manual/llms.mdx
          - page: Reranking
            path: ./docs/pages/manual/reranker.mdx
      - section: User Interface
        contents:
          - page: Gradio Manual
            path: ./docs/pages/ui/gradio.mdx
          - page: Alternatives
            path: ./docs/pages/ui/alternatives.mdx
  - tab: recipes
    layout:
      - section: Getting started
        contents:
          - page: Quickstart
            path: ./docs/pages/recipes/quickstart.mdx
      - section: General use cases
        contents:
          - page: Summarize
            path: ./docs/pages/recipes/summarize.mdx
  # More advanced usage of PrivateGPT, by API
  - tab: api-reference
    layout:
      - section: Overview
        contents:
          - page : API Reference overview
            path: ./docs/pages/api-reference/api-reference.mdx
          - page: SDKs
            path: ./docs/pages/api-reference/sdks.mdx
      - api: API Reference

# Definition of the navbar, will be displayed in the top right corner.
# `type:primary` is always displayed at the most right side of the navbar
navbar-links:
  - type: secondary
    text: Contact us
    url: "mailto:hello@zylon.ai"
  - type: github
    value: "https://github.com/zylon-ai/private-gpt"
  - type: primary
    text: Join the Discord
    url: https://discord.com/invite/bK6mRVpErU

colors:
  accentPrimary:
    dark: "#C6BBFF"
    light: "#756E98"

logo:
  dark: ./docs/assets/logo_light.png
  light: ./docs/assets/logo_dark.png
  height: 50

favicon: ./docs/assets/favicon.ico


================================================
FILE: fern/fern.config.json
================================================
{
  "organization": "privategpt",
  "version": "0.31.17"
}

================================================
FILE: fern/generators.yml
================================================
groups:
  public:
    generators:
      - name: fernapi/fern-python-sdk
        version: 0.6.2
        output:
          location: local-file-system
          path: ../../pgpt-sdk/python


================================================
FILE: fern/openapi/openapi.json
================================================
{
  "openapi": "3.1.0",
  "info": {
    "title": "FastAPI",
    "version": "0.1.0"
  },
  "paths": {
    "/v1/completions": {
      "post": {
        "tags": [
          "Contextual Completions"
        ],
        "summary": "Completion",
        "description": "We recommend most users use our Chat completions API.\n\nGiven a prompt, the model will return one predicted completion.\n\nOptionally include a `system_prompt` to influence the way the LLM answers.\n\nIf `use_context`\nis set to `true`, the model will use context coming from the ingested documents\nto create the response. The documents being used can be filtered using the\n`context_filter` and passing the document IDs to be used. Ingested documents IDs\ncan be found using `/ingest/list` endpoint. If you want all ingested documents to\nbe used, remove `context_filter` altogether.\n\nWhen using `'include_sources': true`, the API will return the source Chunks used\nto create the response, which come from the context provided.\n\nWhen using `'stream': true`, the API will return data chunks following [OpenAI's\nstreaming model](https://platform.openai.com/docs/api-reference/chat/streaming):\n```\n{\"id\":\"12345\",\"object\":\"completion.chunk\",\"created\":1694268190,\n\"model\":\"private-gpt\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"Hello\"},\n\"finish_reason\":null}]}\n```",
        "operationId": "prompt_completion_v1_completions_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompletionsBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAICompletion"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-fern-streaming": {
          "stream-condition": "stream",
          "response": {
            "$ref": "#/components/schemas/OpenAICompletion"
          },
          "response-stream": {
            "$ref": "#/components/schemas/OpenAICompletion"
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "tags": [
          "Contextual Completions"
        ],
        "summary": "Chat Completion",
        "description": "Given a list of messages comprising a conversation, return a response.\n\nOptionally include an initial `role: system` message to influence the way\nthe LLM answers.\n\nIf `use_context` is set to `true`, the model will use context coming\nfrom the ingested documents to create the response. The documents being used can\nbe filtered using the `context_filter` and passing the document IDs to be used.\nIngested documents IDs can be found using `/ingest/list` endpoint. If you want\nall ingested documents to be used, remove `context_filter` altogether.\n\nWhen using `'include_sources': true`, the API will return the source Chunks used\nto create the response, which come from the context provided.\n\nWhen using `'stream': true`, the API will return data chunks following [OpenAI's\nstreaming model](https://platform.openai.com/docs/api-reference/chat/streaming):\n```\n{\"id\":\"12345\",\"object\":\"completion.chunk\",\"created\":1694268190,\n\"model\":\"private-gpt\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"Hello\"},\n\"finish_reason\":null}]}\n```",
        "operationId": "chat_completion_v1_chat_completions_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAICompletion"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "x-fern-streaming": {
          "stream-condition": "stream",
          "response": {
            "$ref": "#/components/schemas/OpenAICompletion"
          },
          "response-stream": {
            "$ref": "#/components/schemas/OpenAICompletion"
          }
        }
      }
    },
    "/v1/chunks": {
      "post": {
        "tags": [
          "Context Chunks"
        ],
        "summary": "Chunks Retrieval",
        "description": "Given a `text`, returns the most relevant chunks from the ingested documents.\n\nThe returned information can be used to generate prompts that can be\npassed to `/completions` or `/chat/completions` APIs. Note: it is usually a very\nfast API, because only the Embeddings model is involved, not the LLM. The\nreturned information contains the relevant chunk `text` together with the source\n`document` it is coming from. It also contains a score that can be used to\ncompare different results.\n\nThe max number of chunks to be returned is set using the `limit` param.\n\nPrevious and next chunks (pieces of text that appear right before or after in the\ndocument) can be fetched by using the `prev_next_chunks` field.\n\nThe documents being used can be filtered using the `context_filter` and passing\nthe document IDs to be used. Ingested documents IDs can be found using\n`/ingest/list` endpoint. If you want all ingested documents to be used,\nremove `context_filter` altogether.",
        "operationId": "chunks_retrieval_v1_chunks_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChunksBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChunksResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ingest": {
      "post": {
        "tags": [
          "Ingestion"
        ],
        "summary": "Ingest",
        "description": "Ingests and processes a file.\n\nDeprecated. Use ingest/file instead.",
        "operationId": "ingest_v1_ingest_post",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_ingest_v1_ingest_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "deprecated": true
      }
    },
    "/v1/ingest/file": {
      "post": {
        "tags": [
          "Ingestion"
        ],
        "summary": "Ingest File",
        "description": "Ingests and processes a file, storing its chunks to be used as context.\n\nThe context obtained from files is later used in\n`/chat/completions`, `/completions`, and `/chunks` APIs.\n\nMost common document\nformats are supported, but you may be prompted to install an extra dependency to\nmanage a specific file type.\n\nA file can generate different Documents (for example a PDF generates one Document\nper page). All Documents IDs are returned in the response, together with the\nextracted Metadata (which is later used to improve context retrieval). Those IDs\ncan be used to filter the context used to create responses in\n`/chat/completions`, `/completions`, and `/chunks` APIs.",
        "operationId": "ingest_file_v1_ingest_file_post",
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_ingest_file_v1_ingest_file_post"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ingest/text": {
      "post": {
        "tags": [
          "Ingestion"
        ],
        "summary": "Ingest Text",
        "description": "Ingests and processes a text, storing its chunks to be used as context.\n\nThe context obtained from files is later used in\n`/chat/completions`, `/completions`, and `/chunks` APIs.\n\nA Document will be generated with the given text. The Document\nID is returned in the response, together with the\nextracted Metadata (which is later used to improve context retrieval). That ID\ncan be used to filter the context used to create responses in\n`/chat/completions`, `/completions`, and `/chunks` APIs.",
        "operationId": "ingest_text_v1_ingest_text_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IngestTextBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ingest/list": {
      "get": {
        "tags": [
          "Ingestion"
        ],
        "summary": "List Ingested",
        "description": "Lists already ingested Documents including their Document ID and metadata.\n\nThose IDs can be used to filter the context used to create responses\nin `/chat/completions`, `/completions`, and `/chunks` APIs.",
        "operationId": "list_ingested_v1_ingest_list_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/ingest/{doc_id}": {
      "delete": {
        "tags": [
          "Ingestion"
        ],
        "summary": "Delete Ingested",
        "description": "Delete the specified ingested Document.\n\nThe `doc_id` can be obtained from the `GET /ingest/list` endpoint.\nThe document will be effectively deleted from your storage context.",
        "operationId": "delete_ingested_v1_ingest__doc_id__delete",
        "parameters": [
          {
            "name": "doc_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Doc Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/summarize": {
      "post": {
        "tags": [
          "Recipes"
        ],
        "summary": "Summarize",
        "description": "Given a text, the model will return a summary.\n\nOptionally include `instructions` to influence the way the summary is generated.\n\nIf `use_context`\nis set to `true`, the model will also use the content coming from the ingested\ndocuments in the summary. The documents being used can\nbe filtered by their metadata using the `context_filter`.\nIngested documents metadata can be found using `/ingest/list` endpoint.\nIf you want all ingested documents to be used, remove `context_filter` altogether.\n\nIf `prompt` is set, it will be used as the prompt for the summarization,\notherwise the default prompt will be used.\n\nWhen using `'stream': true`, the API will return data chunks following [OpenAI's\nstreaming model](https://platform.openai.com/docs/api-reference/chat/streaming):\n```\n{\"id\":\"12345\",\"object\":\"completion.chunk\",\"created\":1694268190,\n\"model\":\"private-gpt\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"Hello\"},\n\"finish_reason\":null}]}\n```",
        "operationId": "summarize_v1_summarize_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SummarizeBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SummarizeResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/embeddings": {
      "post": {
        "tags": [
          "Embeddings"
        ],
        "summary": "Embeddings Generation",
        "description": "Get a vector representation of a given input.\n\nThat vector representation can be easily consumed\nby machine learning models and algorithms.",
        "operationId": "embeddings_generation_v1_embeddings_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmbeddingsBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmbeddingsResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Health",
        "description": "Return ok if the system is up.",
        "operationId": "health_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Body_ingest_file_v1_ingest_file_post": {
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "title": "File"
          }
        },
        "type": "object",
        "required": [
          "file"
        ],
        "title": "Body_ingest_file_v1_ingest_file_post"
      },
      "Body_ingest_v1_ingest_post": {
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "title": "File"
          }
        },
        "type": "object",
        "required": [
          "file"
        ],
        "title": "Body_ingest_v1_ingest_post"
      },
      "ChatBody": {
        "properties": {
          "messages": {
            "items": {
              "$ref": "#/components/schemas/OpenAIMessage"
            },
            "type": "array",
            "title": "Messages"
          },
          "use_context": {
            "type": "boolean",
            "title": "Use Context",
            "default": false
          },
          "context_filter": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ContextFilter"
              },
              {
                "type": "null"
              }
            ]
          },
          "include_sources": {
            "type": "boolean",
            "title": "Include Sources",
            "default": true
          },
          "stream": {
            "type": "boolean",
            "title": "Stream",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "messages"
        ],
        "title": "ChatBody",
        "examples": [
          {
            "context_filter": {
              "docs_ids": [
                "c202d5e6-7b69-4869-81cc-dd574ee8ee11"
              ]
            },
            "include_sources": true,
            "messages": [
              {
                "content": "You are a rapper. Always answer with a rap.",
                "role": "system"
              },
              {
                "content": "How do you fry an egg?",
                "role": "user"
              }
            ],
            "stream": false,
            "use_context": true
          }
        ]
      },
      "Chunk": {
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "context.chunk"
            ],
            "const": "context.chunk",
            "title": "Object"
          },
          "score": {
            "type": "number",
            "title": "Score",
            "examples": [
              0.023
            ]
          },
          "document": {
            "$ref": "#/components/schemas/IngestedDoc"
          },
          "text": {
            "type": "string",
            "title": "Text",
            "examples": [
              "Outbound sales increased 20%, driven by new leads."
            ]
          },
          "previous_texts": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Previous Texts",
            "examples": [
              [
                "SALES REPORT 2023",
                "Inbound didn't show major changes."
              ]
            ]
          },
          "next_texts": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Texts",
            "examples": [
              [
                "New leads came from Google Ads campaign.",
                "The campaign was run by the Marketing Department"
              ]
            ]
          }
        },
        "type": "object",
        "required": [
          "object",
          "score",
          "document",
          "text"
        ],
        "title": "Chunk"
      },
      "ChunksBody": {
        "properties": {
          "text": {
            "type": "string",
            "title": "Text",
            "examples": [
              "Q3 2023 sales"
            ]
          },
          "context_filter": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ContextFilter"
              },
              {
                "type": "null"
              }
            ]
          },
          "limit": {
            "type": "integer",
            "title": "Limit",
            "default": 10
          },
          "prev_next_chunks": {
            "type": "integer",
            "title": "Prev Next Chunks",
            "default": 0,
            "examples": [
              2
            ]
          }
        },
        "type": "object",
        "required": [
          "text"
        ],
        "title": "ChunksBody"
      },
      "ChunksResponse": {
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ],
            "const": "list",
            "title": "Object"
          },
          "model": {
            "type": "string",
            "enum": [
              "private-gpt"
            ],
            "const": "private-gpt",
            "title": "Model"
          },
          "data": {
            "items": {
              "$ref": "#/components/schemas/Chunk"
            },
            "type": "array",
            "title": "Data"
          }
        },
        "type": "object",
        "required": [
          "object",
          "model",
          "data"
        ],
        "title": "ChunksResponse"
      },
      "CompletionsBody": {
        "properties": {
          "prompt": {
            "type": "string",
            "title": "Prompt"
          },
          "system_prompt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "System Prompt"
          },
          "use_context": {
            "type": "boolean",
            "title": "Use Context",
            "default": false
          },
          "context_filter": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ContextFilter"
              },
              {
                "type": "null"
              }
            ]
          },
          "include_sources": {
            "type": "boolean",
            "title": "Include Sources",
            "default": true
          },
          "stream": {
            "type": "boolean",
            "title": "Stream",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "prompt"
        ],
        "title": "CompletionsBody",
        "examples": [
          {
            "include_sources": false,
            "prompt": "How do you fry an egg?",
            "stream": false,
            "system_prompt": "You are a rapper. Always answer with a rap.",
            "use_context": false
          }
        ]
      },
      "ContextFilter": {
        "properties": {
          "docs_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Docs Ids",
            "examples": [
              [
                "c202d5e6-7b69-4869-81cc-dd574ee8ee11"
              ]
            ]
          }
        },
        "type": "object",
        "required": [
          "docs_ids"
        ],
        "title": "ContextFilter"
      },
      "Embedding": {
        "properties": {
          "index": {
            "type": "integer",
            "title": "Index"
          },
          "object": {
            "type": "string",
            "enum": [
              "embedding"
            ],
            "const": "embedding",
            "title": "Object"
          },
          "embedding": {
            "items": {
              "type": "number"
            },
            "type": "array",
            "title": "Embedding",
            "examples": [
              [
                0.0023064255,
                -0.009327292
              ]
            ]
          }
        },
        "type": "object",
        "required": [
          "index",
          "object",
          "embedding"
        ],
        "title": "Embedding"
      },
      "EmbeddingsBody": {
        "properties": {
          "input": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            ],
            "title": "Input"
          }
        },
        "type": "object",
        "required": [
          "input"
        ],
        "title": "EmbeddingsBody"
      },
      "EmbeddingsResponse": {
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ],
            "const": "list",
            "title": "Object"
          },
          "model": {
            "type": "string",
            "enum": [
              "private-gpt"
            ],
            "const": "private-gpt",
            "title": "Model"
          },
          "data": {
            "items": {
              "$ref": "#/components/schemas/Embedding"
            },
            "type": "array",
            "title": "Data"
          }
        },
        "type": "object",
        "required": [
          "object",
          "model",
          "data"
        ],
        "title": "EmbeddingsResponse"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "HealthResponse": {
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok"
            ],
            "const": "ok",
            "title": "Status",
            "default": "ok"
          }
        },
        "type": "object",
        "title": "HealthResponse"
      },
      "IngestResponse": {
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "list"
            ],
            "const": "list",
            "title": "Object"
          },
          "model": {
            "type": "string",
            "enum": [
              "private-gpt"
            ],
            "const": "private-gpt",
            "title": "Model"
          },
          "data": {
            "items": {
              "$ref": "#/components/schemas/IngestedDoc"
            },
            "type": "array",
            "title": "Data"
          }
        },
        "type": "object",
        "required": [
          "object",
          "model",
          "data"
        ],
        "title": "IngestResponse"
      },
      "IngestTextBody": {
        "properties": {
          "file_name": {
            "type": "string",
            "title": "File Name",
            "examples": [
              "Avatar: The Last Airbender"
            ]
          },
          "text": {
            "type": "string",
            "title": "Text",
            "examples": [
              "Avatar is set in an Asian and Arctic-inspired world in which some people can telekinetically manipulate one of the four elements\u2014water, earth, fire or air\u2014through practices known as 'bending', inspired by Chinese martial arts."
            ]
          }
        },
        "type": "object",
        "required": [
          "file_name",
          "text"
        ],
        "title": "IngestTextBody"
      },
      "IngestedDoc": {
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "ingest.document"
            ],
            "const": "ingest.document",
            "title": "Object"
          },
          "doc_id": {
            "type": "string",
            "title": "Doc Id",
            "examples": [
              "c202d5e6-7b69-4869-81cc-dd574ee8ee11"
            ]
          },
          "doc_metadata": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Doc Metadata",
            "examples": [
              {
                "file_name": "Sales Report Q3 2023.pdf",
                "page_label": "2"
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "object",
          "doc_id",
          "doc_metadata"
        ],
        "title": "IngestedDoc"
      },
      "OpenAIChoice": {
        "properties": {
          "finish_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finish Reason",
            "examples": [
              "stop"
            ]
          },
          "delta": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OpenAIDelta"
              },
              {
                "type": "null"
              }
            ]
          },
          "message": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OpenAIMessage"
              },
              {
                "type": "null"
              }
            ]
          },
          "sources": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/Chunk"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sources"
          },
          "index": {
            "type": "integer",
            "title": "Index",
            "default": 0
          }
        },
        "type": "object",
        "required": [
          "finish_reason"
        ],
        "title": "OpenAIChoice",
        "description": "Response from AI.\n\nEither the delta or the message will be present, but never both.\nSources used will be returned in case context retrieval was enabled."
      },
      "OpenAICompletion": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "object": {
            "type": "string",
            "enum": [
              "completion",
              "completion.chunk"
            ],
            "title": "Object",
            "default": "completion"
          },
          "created": {
            "type": "integer",
            "title": "Created",
            "examples": [
              1623340000
            ]
          },
          "model": {
            "type": "string",
            "enum": [
              "private-gpt"
            ],
            "const": "private-gpt",
            "title": "Model"
          },
          "choices": {
            "items": {
              "$ref": "#/components/schemas/OpenAIChoice"
            },
            "type": "array",
            "title": "Choices"
          }
        },
        "type": "object",
        "required": [
          "id",
          "created",
          "model",
          "choices"
        ],
        "title": "OpenAICompletion",
        "description": "Clone of OpenAI Completion model.\n\nFor more information see: https://platform.openai.com/docs/api-reference/chat/object"
      },
      "OpenAIDelta": {
        "properties": {
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content"
          }
        },
        "type": "object",
        "required": [
          "content"
        ],
        "title": "OpenAIDelta",
        "description": "A piece of completion that needs to be concatenated to get the full message."
      },
      "OpenAIMessage": {
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "assistant",
              "system",
              "user"
            ],
            "title": "Role",
            "default": "user"
          },
          "content": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Content"
          }
        },
        "type": "object",
        "required": [
          "content"
        ],
        "title": "OpenAIMessage",
        "description": "Inference result, with the source of the message.\n\nRole could be the assistant or system\n(providing a default response, not AI generated)."
      },
      "SummarizeBody": {
        "properties": {
          "text": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Text"
          },
          "use_context": {
            "type": "boolean",
            "title": "Use Context",
            "default": false
          },
          "context_filter": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ContextFilter"
              },
              {
                "type": "null"
              }
            ]
          },
          "prompt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Prompt"
          },
          "instructions": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Instructions"
          },
          "stream": {
            "type": "boolean",
            "title": "Stream",
            "default": false
          }
        },
        "type": "object",
        "title": "SummarizeBody"
      },
      "SummarizeResponse": {
        "properties": {
          "summary": {
            "type": "string",
            "title": "Summary"
          }
        },
        "type": "object",
        "required": [
          "summary"
        ],
        "title": "SummarizeResponse"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    }
  }
}

================================================
FILE: local_data/.gitignore
================================================
*
!.gitignore

================================================
FILE: models/.gitignore
================================================
*
!.gitignore

================================================
FILE: private_gpt/__init__.py
================================================
"""private-gpt."""

import logging
import os

# Set to 'DEBUG' to have extensive logging turned on, even for libraries
ROOT_LOG_LEVEL = "INFO"

PRETTY_LOG_FORMAT = (
    "%(asctime)s.%(msecs)03d [%(levelname)-8s] %(name)+25s - %(message)s"
)
logging.basicConfig(level=ROOT_LOG_LEVEL, format=PRETTY_LOG_FORMAT, datefmt="%H:%M:%S")
logging.captureWarnings(True)

# Disable gradio analytics
# This is done this way because gradio does not solely rely on what values are
# passed to gr.Blocks(enable_analytics=...) but also on the environment
# variable GRADIO_ANALYTICS_ENABLED. `gradio.strings` actually reads this env
# directly, so to fully disable gradio analytics we need to set this env var.
os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"

# Disable chromaDB telemetry
# It is already disabled, see PR#1144
# os.environ["ANONYMIZED_TELEMETRY"] = "False"

# adding tiktoken cache path within repo to be able to run in offline environment.
os.environ["TIKTOKEN_CACHE_DIR"] = "tiktoken_cache"


================================================
FILE: private_gpt/__main__.py
================================================
# start a fastapi server with uvicorn

import uvicorn

from private_gpt.main import app
from private_gpt.settings.settings import settings

# Set log_config=None to do not use the uvicorn logging configuration, and
# use ours instead. For reference, see below:
# https://github.com/tiangolo/fastapi/discussions/7457#discussioncomment-5141108
uvicorn.run(app, host="0.0.0.0", port=settings().server.port, log_config=None)


================================================
FILE: private_gpt/components/__init__.py
================================================


================================================
FILE: private_gpt/components/embedding/__init__.py
================================================


================================================
FILE: private_gpt/components/embedding/custom/__init__.py
================================================


================================================
FILE: private_gpt/components/embedding/custom/sagemaker.py
================================================
# mypy: ignore-errors
import json
from typing import Any

import boto3
from llama_index.core.base.embeddings.base import BaseEmbedding
from pydantic import Field, PrivateAttr


class SagemakerEmbedding(BaseEmbedding):
    """Sagemaker Embedding Endpoint.

    To use, you must supply the endpoint name from your deployed
    Sagemaker embedding model & the region where it is deployed.

    To authenticate, the AWS client uses the following methods to
    automatically load credentials:
    https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html

    If a specific credential profile should be used, you must pass
    the name of the profile from the ~/.aws/credentials file that is to be used.

    Make sure the credentials / roles used have the required policies to
    access the Sagemaker endpoint.
    See: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html
    """

    endpoint_name: str = Field(description="")

    _boto_client: Any = boto3.client(
        "sagemaker-runtime",
    )  # TODO make it an optional field

    _async_not_implemented_warned: bool = PrivateAttr(default=False)

    @classmethod
    def class_name(cls) -> str:
        return "SagemakerEmbedding"

    def _async_not_implemented_warn_once(self) -> None:
        if not self._async_not_implemented_warned:
            print("Async embedding not available, falling back to sync method.")
            self._async_not_implemented_warned = True

    def _embed(self, sentences: list[str]) -> list[list[float]]:
        request_params = {
            "inputs": sentences,
        }

        resp = self._boto_client.invoke_endpoint(
            EndpointName=self.endpoint_name,
            Body=json.dumps(request_params),
            ContentType="application/json",
        )

        response_body = resp["Body"]
        response_str = response_body.read().decode("utf-8")
        response_json = json.loads(response_str)

        return response_json["vectors"]

    def _get_query_embedding(self, query: str) -> list[float]:
        """Get query embedding."""
        return self._embed([query])[0]

    async def _aget_query_embedding(self, query: str) -> list[float]:
        # Warn the user that sync is being used
        self._async_not_implemented_warn_once()
        return self._get_query_embedding(query)

    async def _aget_text_embedding(self, text: str) -> list[float]:
        # Warn the user that sync is being used
        self._async_not_implemented_warn_once()
        return self._get_text_embedding(text)

    def _get_text_embedding(self, text: str) -> list[float]:
        """Get text embedding."""
        return self._embed([text])[0]

    def _get_text_embeddings(self, texts: list[str]) -> list[list[float]]:
        """Get text embeddings."""
        return self._embed(texts)


================================================
FILE: private_gpt/components/embedding/embedding_component.py
================================================
import logging

from injector import inject, singleton
from llama_index.core.embeddings import BaseEmbedding, MockEmbedding

from private_gpt.paths import models_cache_path
from private_gpt.settings.settings import Settings

logger = logging.getLogger(__name__)


@singleton
class EmbeddingComponent:
    embedding_model: BaseEmbedding

    @inject
    def __init__(self, settings: Settings) -> None:
        embedding_mode = settings.embedding.mode
        logger.info("Initializing the embedding model in mode=%s", embedding_mode)
        match embedding_mode:
            case "huggingface":
                try:
                    from llama_index.embeddings.huggingface import (  # type: ignore
                        HuggingFaceEmbedding,
                    )
                except ImportError as e:
                    raise ImportError(
                        "Local dependencies not found, install with `poetry install --extras embeddings-huggingface`"
                    ) from e

                self.embedding_model = HuggingFaceEmbedding(
                    model_name=settings.huggingface.embedding_hf_model_name,
                    cache_folder=str(models_cache_path),
                    trust_remote_code=settings.huggingface.trust_remote_code,
                )
            case "sagemaker":
                try:
                    from private_gpt.components.embedding.custom.sagemaker import (
                        SagemakerEmbedding,
                    )
                except ImportError as e:
                    raise ImportError(
                        "Sagemaker dependencies not found, install with `poetry install --extras embeddings-sagemaker`"
                    ) from e

                self.embedding_model = SagemakerEmbedding(
                    endpoint_name=settings.sagemaker.embedding_endpoint_name,
                )
            case "openai":
                try:
                    from llama_index.embeddings.openai import (  # type: ignore
                        OpenAIEmbedding,
                    )
                except ImportError as e:
                    raise ImportError(
                        "OpenAI dependencies
Download .txt
gitextract_oevz0y2u/

├── .docker/
│   └── router.yml
├── .dockerignore
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug.yml
│   │   ├── config.yml
│   │   ├── docs.yml
│   │   ├── feature.yml
│   │   └── question.yml
│   ├── pull_request_template.md
│   ├── release_please/
│   │   ├── .release-please-config.json
│   │   └── .release-please-manifest.json
│   └── workflows/
│       ├── actions/
│       │   └── install_dependencies/
│       │       └── action.yml
│       ├── fern-check.yml
│       ├── generate-release.yml
│       ├── preview-docs.yml
│       ├── publish-docs.yml
│       ├── release-please.yml
│       ├── stale.yml
│       └── tests.yml
├── .gitignore
├── .pre-commit-config.yaml
├── CHANGELOG.md
├── CITATION.cff
├── Dockerfile.llamacpp-cpu
├── Dockerfile.ollama
├── LICENSE
├── Makefile
├── README.md
├── docker-compose.yaml
├── fern/
│   ├── README.md
│   ├── docs/
│   │   └── pages/
│   │       ├── api-reference/
│   │       │   ├── api-reference.mdx
│   │       │   └── sdks.mdx
│   │       ├── installation/
│   │       │   ├── concepts.mdx
│   │       │   ├── installation.mdx
│   │       │   └── troubleshooting.mdx
│   │       ├── manual/
│   │       │   ├── ingestion-reset.mdx
│   │       │   ├── ingestion.mdx
│   │       │   ├── llms.mdx
│   │       │   ├── nodestore.mdx
│   │       │   ├── reranker.mdx
│   │       │   ├── settings.mdx
│   │       │   └── vectordb.mdx
│   │       ├── overview/
│   │       │   └── welcome.mdx
│   │       ├── quickstart/
│   │       │   └── quickstart.mdx
│   │       ├── recipes/
│   │       │   ├── quickstart.mdx
│   │       │   └── summarize.mdx
│   │       └── ui/
│   │           ├── alternatives.mdx
│   │           └── gradio.mdx
│   ├── docs.yml
│   ├── fern.config.json
│   ├── generators.yml
│   └── openapi/
│       └── openapi.json
├── local_data/
│   └── .gitignore
├── models/
│   └── .gitignore
├── private_gpt/
│   ├── __init__.py
│   ├── __main__.py
│   ├── components/
│   │   ├── __init__.py
│   │   ├── embedding/
│   │   │   ├── __init__.py
│   │   │   ├── custom/
│   │   │   │   ├── __init__.py
│   │   │   │   └── sagemaker.py
│   │   │   └── embedding_component.py
│   │   ├── ingest/
│   │   │   ├── __init__.py
│   │   │   ├── ingest_component.py
│   │   │   └── ingest_helper.py
│   │   ├── llm/
│   │   │   ├── __init__.py
│   │   │   ├── custom/
│   │   │   │   ├── __init__.py
│   │   │   │   └── sagemaker.py
│   │   │   ├── llm_component.py
│   │   │   └── prompt_helper.py
│   │   ├── node_store/
│   │   │   ├── __init__.py
│   │   │   └── node_store_component.py
│   │   └── vector_store/
│   │       ├── __init__.py
│   │       ├── batched_chroma.py
│   │       └── vector_store_component.py
│   ├── constants.py
│   ├── di.py
│   ├── launcher.py
│   ├── main.py
│   ├── open_ai/
│   │   ├── __init__.py
│   │   ├── extensions/
│   │   │   ├── __init__.py
│   │   │   └── context_filter.py
│   │   └── openai_models.py
│   ├── paths.py
│   ├── server/
│   │   ├── __init__.py
│   │   ├── chat/
│   │   │   ├── __init__.py
│   │   │   ├── chat_router.py
│   │   │   └── chat_service.py
│   │   ├── chunks/
│   │   │   ├── __init__.py
│   │   │   ├── chunks_router.py
│   │   │   └── chunks_service.py
│   │   ├── completions/
│   │   │   ├── __init__.py
│   │   │   └── completions_router.py
│   │   ├── embeddings/
│   │   │   ├── __init__.py
│   │   │   ├── embeddings_router.py
│   │   │   └── embeddings_service.py
│   │   ├── health/
│   │   │   ├── __init__.py
│   │   │   └── health_router.py
│   │   ├── ingest/
│   │   │   ├── __init__.py
│   │   │   ├── ingest_router.py
│   │   │   ├── ingest_service.py
│   │   │   ├── ingest_watcher.py
│   │   │   └── model.py
│   │   ├── recipes/
│   │   │   └── summarize/
│   │   │       ├── __init__.py
│   │   │       ├── summarize_router.py
│   │   │       └── summarize_service.py
│   │   └── utils/
│   │       ├── __init__.py
│   │       └── auth.py
│   ├── settings/
│   │   ├── __init__.py
│   │   ├── settings.py
│   │   ├── settings_loader.py
│   │   └── yaml.py
│   ├── ui/
│   │   ├── __init__.py
│   │   ├── images.py
│   │   └── ui.py
│   └── utils/
│       ├── __init__.py
│       ├── eta.py
│       ├── ollama.py
│       ├── retry.py
│       └── typing.py
├── pyproject.toml
├── scripts/
│   ├── __init__.py
│   ├── extract_openapi.py
│   ├── ingest_folder.py
│   ├── setup
│   └── utils.py
├── settings-azopenai.yaml
├── settings-docker.yaml
├── settings-gemini.yaml
├── settings-local.yaml
├── settings-mock.yaml
├── settings-ollama-pg.yaml
├── settings-ollama.yaml
├── settings-openai.yaml
├── settings-sagemaker.yaml
├── settings-test.yaml
├── settings-vllm.yaml
├── settings.yaml
├── tests/
│   ├── __init__.py
│   ├── conftest.py
│   ├── fixtures/
│   │   ├── __init__.py
│   │   ├── auto_close_qdrant.py
│   │   ├── fast_api_test_client.py
│   │   ├── ingest_helper.py
│   │   └── mock_injector.py
│   ├── server/
│   │   ├── chat/
│   │   │   └── test_chat_routes.py
│   │   ├── chunks/
│   │   │   ├── chunk_test.txt
│   │   │   └── test_chunk_routes.py
│   │   ├── embeddings/
│   │   │   └── test_embedding_routes.py
│   │   ├── ingest/
│   │   │   ├── test.txt
│   │   │   ├── test_ingest_routes.py
│   │   │   └── test_local_ingest.py
│   │   ├── recipes/
│   │   │   └── test_summarize_router.py
│   │   └── utils/
│   │       ├── test_auth.py
│   │       └── test_simple_auth.py
│   ├── settings/
│   │   ├── test_settings.py
│   │   └── test_settings_loader.py
│   ├── test_prompt_helper.py
│   └── ui/
│       └── test_ui.py
├── tiktoken_cache/
│   └── .gitignore
└── version.txt
Download .txt
SYMBOL INDEX (327 symbols across 56 files)

FILE: private_gpt/components/embedding/custom/sagemaker.py
  class SagemakerEmbedding (line 10) | class SagemakerEmbedding(BaseEmbedding):
    method class_name (line 37) | def class_name(cls) -> str:
    method _async_not_implemented_warn_once (line 40) | def _async_not_implemented_warn_once(self) -> None:
    method _embed (line 45) | def _embed(self, sentences: list[str]) -> list[list[float]]:
    method _get_query_embedding (line 62) | def _get_query_embedding(self, query: str) -> list[float]:
    method _aget_query_embedding (line 66) | async def _aget_query_embedding(self, query: str) -> list[float]:
    method _aget_text_embedding (line 71) | async def _aget_text_embedding(self, text: str) -> list[float]:
    method _get_text_embedding (line 76) | def _get_text_embedding(self, text: str) -> list[float]:
    method _get_text_embeddings (line 80) | def _get_text_embeddings(self, texts: list[str]) -> list[list[float]]:

FILE: private_gpt/components/embedding/embedding_component.py
  class EmbeddingComponent (line 13) | class EmbeddingComponent:
    method __init__ (line 17) | def __init__(self, settings: Settings) -> None:

FILE: private_gpt/components/ingest/ingest_component.py
  class BaseIngestComponent (line 28) | class BaseIngestComponent(abc.ABC):
    method __init__ (line 29) | def __init__(
    method ingest (line 43) | def ingest(self, file_name: str, file_data: Path) -> list[Document]:
    method bulk_ingest (line 47) | def bulk_ingest(self, files: list[tuple[str, Path]]) -> list[Document]:
    method delete (line 51) | def delete(self, doc_id: str) -> None:
  class BaseIngestComponentWithIndex (line 55) | class BaseIngestComponentWithIndex(BaseIngestComponent, abc.ABC):
    method __init__ (line 56) | def __init__(
    method _initialize_index (line 72) | def _initialize_index(self) -> BaseIndex[IndexDict]:
    method _save_index (line 97) | def _save_index(self) -> None:
    method delete (line 100) | def delete(self, doc_id: str) -> None:
  class SimpleIngestComponent (line 109) | class SimpleIngestComponent(BaseIngestComponentWithIndex):
    method __init__ (line 110) | def __init__(
    method ingest (line 120) | def ingest(self, file_name: str, file_data: Path) -> list[Document]:
    method bulk_ingest (line 129) | def bulk_ingest(self, files: list[tuple[str, Path]]) -> list[Document]:
    method _save_docs (line 138) | def _save_docs(self, documents: list[Document]) -> list[Document]:
  class BatchIngestComponent (line 150) | class BatchIngestComponent(BaseIngestComponentWithIndex):
    method __init__ (line 156) | def __init__(
    method ingest (line 178) | def ingest(self, file_name: str, file_data: Path) -> list[Document]:
    method bulk_ingest (line 187) | def bulk_ingest(self, files: list[tuple[str, Path]]) -> list[Document]:
    method _save_docs (line 202) | def _save_docs(self, documents: list[Document]) -> list[Document]:
  class ParallelizedIngestComponent (line 224) | class ParallelizedIngestComponent(BaseIngestComponentWithIndex):
    method __init__ (line 231) | def __init__(
    method ingest (line 260) | def ingest(self, file_name: str, file_data: Path) -> list[Document]:
    method bulk_ingest (line 273) | def bulk_ingest(self, files: list[tuple[str, Path]]) -> list[Document]:
    method _save_docs (line 284) | def _save_docs(self, documents: list[Document]) -> list[Document]:
    method __del__ (line 305) | def __del__(self) -> None:
  class PipelineIngestComponent (line 319) | class PipelineIngestComponent(BaseIngestComponentWithIndex):
    method __init__ (line 338) | def __init__(
    method _doc_to_node (line 377) | def _doc_to_node(self) -> None:
    method _doc_to_node_worker (line 398) | def _doc_to_node_worker(self, file_name: str, documents: list[Document...
    method _save_docs (line 411) | def _save_docs(
    method _write_nodes (line 433) | def _write_nodes(self) -> None:
    method _flush (line 456) | def _flush(self) -> None:
    method ingest (line 462) | def ingest(self, file_name: str, file_data: Path) -> list[Document]:
    method bulk_ingest (line 468) | def bulk_ingest(self, files: list[tuple[str, Path]]) -> list[Document]:
  function get_ingestion_component (line 483) | def get_ingestion_component(

FILE: private_gpt/components/ingest/ingest_helper.py
  function _try_loading_included_file_formats (line 13) | def _try_loading_included_file_formats() -> dict[str, type[BaseReader]]:
  class IngestionHelper (line 63) | class IngestionHelper:
    method transform_file_into_documents (line 71) | def transform_file_into_documents(
    method _load_file_to_documents (line 81) | def _load_file_to_documents(file_name: str, file_data: Path) -> list[D...
    method _exclude_metadata (line 104) | def _exclude_metadata(documents: list[Document]) -> None:

FILE: private_gpt/components/llm/custom/sagemaker.py
  class LineIterator (line 39) | class LineIterator:
    method __init__ (line 68) | def __init__(self, stream: Any) -> None:
    method __iter__ (line 74) | def __iter__(self) -> Any:
    method __next__ (line 78) | def __next__(self) -> Any:
  class SagemakerLLM (line 99) | class SagemakerLLM(CustomLLM):
    method __init__ (line 141) | def __init__(
    method inference_params (line 180) | def inference_params(self):
    method metadata (line 191) | def metadata(self) -> LLMMetadata:
    method complete (line 200) | def complete(self, prompt: str, **kwargs: Any) -> CompletionResponse:
    method stream_complete (line 228) | def stream_complete(self, prompt: str, **kwargs: Any) -> CompletionRes...
    method chat (line 265) | def chat(self, messages: Sequence[ChatMessage], **kwargs: Any) -> Chat...
    method stream_chat (line 271) | def stream_chat(

FILE: private_gpt/components/llm/llm_component.py
  class LLMComponent (line 19) | class LLMComponent:
    method __init__ (line 23) | def __init__(self, settings: Settings) -> None:

FILE: private_gpt/components/llm/prompt_helper.py
  class AbstractPromptStyle (line 11) | class AbstractPromptStyle(abc.ABC):
    method __init__ (line 27) | def __init__(self, *args: Any, **kwargs: Any) -> None:
    method _messages_to_prompt (line 31) | def _messages_to_prompt(self, messages: Sequence[ChatMessage]) -> str:
    method _completion_to_prompt (line 35) | def _completion_to_prompt(self, completion: str) -> str:
    method messages_to_prompt (line 38) | def messages_to_prompt(self, messages: Sequence[ChatMessage]) -> str:
    method completion_to_prompt (line 43) | def completion_to_prompt(self, prompt: str) -> str:
  class DefaultPromptStyle (line 50) | class DefaultPromptStyle(AbstractPromptStyle):
    method __init__ (line 57) | def __init__(self, *args: Any, **kwargs: Any) -> None:
    method _messages_to_prompt (line 65) | def _messages_to_prompt(self, messages: Sequence[ChatMessage]) -> str:
    method _completion_to_prompt (line 68) | def _completion_to_prompt(self, completion: str) -> str:
  class Llama2PromptStyle (line 72) | class Llama2PromptStyle(AbstractPromptStyle):
    method _messages_to_prompt (line 95) | def _messages_to_prompt(self, messages: Sequence[ChatMessage]) -> str:
    method _completion_to_prompt (line 133) | def _completion_to_prompt(self, completion: str) -> str:
  class Llama3PromptStyle (line 142) | class Llama3PromptStyle(AbstractPromptStyle):
    method _messages_to_prompt (line 172) | def _messages_to_prompt(self, messages: Sequence[ChatMessage]) -> str:
    method _completion_to_prompt (line 200) | def _completion_to_prompt(self, completion: str) -> str:
  class TagPromptStyle (line 208) | class TagPromptStyle(AbstractPromptStyle):
    method _messages_to_prompt (line 222) | def _messages_to_prompt(self, messages: Sequence[ChatMessage]) -> str:
    method _completion_to_prompt (line 235) | def _completion_to_prompt(self, completion: str) -> str:
  class MistralPromptStyle (line 241) | class MistralPromptStyle(AbstractPromptStyle):
    method _messages_to_prompt (line 242) | def _messages_to_prompt(self, messages: Sequence[ChatMessage]) -> str:
    method _completion_to_prompt (line 260) | def _completion_to_prompt(self, completion: str) -> str:
  class ChatMLPromptStyle (line 266) | class ChatMLPromptStyle(AbstractPromptStyle):
    method _messages_to_prompt (line 267) | def _messages_to_prompt(self, messages: Sequence[ChatMessage]) -> str:
    method _completion_to_prompt (line 282) | def _completion_to_prompt(self, completion: str) -> str:
  function get_prompt_style (line 288) | def get_prompt_style(

FILE: private_gpt/components/node_store/node_store_component.py
  class NodeStoreComponent (line 15) | class NodeStoreComponent:
    method __init__ (line 20) | def __init__(self, settings: Settings) -> None:

FILE: private_gpt/components/vector_store/batched_chroma.py
  function chunk_list (line 12) | def chunk_list(
  class BatchedChromaVectorStore (line 28) | class BatchedChromaVectorStore(ChromaVectorStore):  # type: ignore
    method __init__ (line 46) | def __init__(
    method add (line 66) | def add(self, nodes: Sequence[BaseNode], **add_kwargs: Any) -> list[str]:

FILE: private_gpt/components/vector_store/vector_store_component.py
  function _doc_id_metadata_filter (line 20) | def _doc_id_metadata_filter(
  class VectorStoreComponent (line 33) | class VectorStoreComponent:
    method __init__ (line 38) | def __init__(self, settings: Settings) -> None:
    method get_retriever (line 197) | def get_retriever(
    method close (line 215) | def close(self) -> None:

FILE: private_gpt/di.py
  function create_application_injector (line 6) | def create_application_injector() -> Injector:

FILE: private_gpt/launcher.py
  function create_app (line 24) | def create_app(root_injector: Injector) -> FastAPI:

FILE: private_gpt/open_ai/extensions/context_filter.py
  class ContextFilter (line 4) | class ContextFilter(BaseModel):

FILE: private_gpt/open_ai/openai_models.py
  class OpenAIDelta (line 12) | class OpenAIDelta(BaseModel):
  class OpenAIMessage (line 18) | class OpenAIMessage(BaseModel):
  class OpenAIChoice (line 29) | class OpenAIChoice(BaseModel):
  class OpenAICompletion (line 43) | class OpenAICompletion(BaseModel):
    method from_text (line 56) | def from_text(
    method json_from_delta (line 77) | def json_from_delta(
  function to_openai_response (line 101) | def to_openai_response(
  function to_openai_sse_stream (line 112) | def to_openai_sse_stream(

FILE: private_gpt/paths.py
  function _absolute_or_from_project_root (line 7) | def _absolute_or_from_project_root(path: str) -> Path:

FILE: private_gpt/server/chat/chat_router.py
  class ChatBody (line 19) | class ChatBody(BaseModel):
  function chat_completion (line 65) | def chat_completion(

FILE: private_gpt/server/chat/chat_service.py
  class Completion (line 34) | class Completion(BaseModel):
  class CompletionGen (line 39) | class CompletionGen(BaseModel):
  class ChatEngineInput (line 45) | class ChatEngineInput:
    method from_messages (line 51) | def from_messages(cls, messages: list[ChatMessage]) -> "ChatEngineInput":
  class ChatService (line 79) | class ChatService:
    method __init__ (line 83) | def __init__(
    method _chat_engine (line 108) | def _chat_engine(
    method stream_chat (line 149) | def stream_chat(
    method chat (line 185) | def chat(

FILE: private_gpt/server/chunks/chunks_router.py
  class ChunksBody (line 13) | class ChunksBody(BaseModel):
  class ChunksResponse (line 20) | class ChunksResponse(BaseModel):
  function chunks_retrieval (line 27) | def chunks_retrieval(request: Request, body: ChunksBody) -> ChunksResponse:

FILE: private_gpt/server/chunks/chunks_service.py
  class Chunk (line 22) | class Chunk(BaseModel):
    method from_node (line 42) | def from_node(cls: type["Chunk"], node: NodeWithScore) -> "Chunk":
  class ChunksService (line 57) | class ChunksService:
    method __init__ (line 59) | def __init__(
    method _get_sibling_nodes_text (line 75) | def _get_sibling_nodes_text(
    method retrieve_relevant (line 96) | def retrieve_relevant(

FILE: private_gpt/server/completions/completions_router.py
  class CompletionsBody (line 16) | class CompletionsBody(BaseModel):
  function prompt_completion (line 53) | def prompt_completion(

FILE: private_gpt/server/embeddings/embeddings_router.py
  class EmbeddingsBody (line 15) | class EmbeddingsBody(BaseModel):
  class EmbeddingsResponse (line 19) | class EmbeddingsResponse(BaseModel):
  function embeddings_generation (line 26) | def embeddings_generation(request: Request, body: EmbeddingsBody) -> Emb...

FILE: private_gpt/server/embeddings/embeddings_service.py
  class Embedding (line 9) | class Embedding(BaseModel):
  class EmbeddingsService (line 16) | class EmbeddingsService:
    method __init__ (line 18) | def __init__(self, embedding_component: EmbeddingComponent) -> None:
    method texts_embeddings (line 21) | def texts_embeddings(self, texts: list[str]) -> list[Embedding]:

FILE: private_gpt/server/health/health_router.py
  class HealthResponse (line 10) | class HealthResponse(BaseModel):
  function health (line 15) | def health() -> HealthResponse:

FILE: private_gpt/server/ingest/ingest_router.py
  class IngestTextBody (line 13) | class IngestTextBody(BaseModel):
  class IngestResponse (line 25) | class IngestResponse(BaseModel):
  function ingest (line 32) | def ingest(request: Request, file: UploadFile) -> IngestResponse:
  function ingest_file (line 41) | def ingest_file(request: Request, file: UploadFile) -> IngestResponse:
  function ingest_text (line 65) | def ingest_text(request: Request, body: IngestTextBody) -> IngestResponse:
  function list_ingested (line 85) | def list_ingested(request: Request) -> IngestResponse:
  function delete_ingested (line 97) | def delete_ingested(request: Request, doc_id: str) -> None:

FILE: private_gpt/server/ingest/ingest_service.py
  class IngestService (line 27) | class IngestService:
    method __init__ (line 29) | def __init__(
    method _ingest_data (line 51) | def _ingest_data(self, file_name: str, file_data: AnyStr) -> list[Inge...
    method ingest_file (line 68) | def ingest_file(self, file_name: str, file_data: Path) -> list[Ingeste...
    method ingest_text (line 74) | def ingest_text(self, file_name: str, text: str) -> list[IngestedDoc]:
    method ingest_bin_data (line 78) | def ingest_bin_data(
    method bulk_ingest (line 85) | def bulk_ingest(self, files: list[tuple[str, Path]]) -> list[IngestedD...
    method list_ingested (line 91) | def list_ingested(self) -> list[IngestedDoc]:
    method delete (line 117) | def delete(self, doc_id: str) -> None:

FILE: private_gpt/server/ingest/ingest_watcher.py
  class IngestWatcher (line 14) | class IngestWatcher:
    method __init__ (line 15) | def __init__(
    method start (line 35) | def start(self) -> None:
    method stop (line 43) | def stop(self) -> None:

FILE: private_gpt/server/ingest/model.py
  class IngestedDoc (line 7) | class IngestedDoc(BaseModel):
    method curate_metadata (line 20) | def curate_metadata(metadata: dict[str, Any]) -> dict[str, Any]:
    method from_document (line 27) | def from_document(document: Document) -> "IngestedDoc":

FILE: private_gpt/server/recipes/summarize/summarize_router.py
  class SummarizeBody (line 15) | class SummarizeBody(BaseModel):
  class SummarizeResponse (line 24) | class SummarizeResponse(BaseModel):
  function summarize (line 35) | def summarize(

FILE: private_gpt/server/recipes/summarize/summarize_service.py
  class SummarizeService (line 35) | class SummarizeService:
    method __init__ (line 37) | def __init__(
    method _filter_ref_docs (line 57) | def _filter_ref_docs(
    method _summarize (line 69) | def _summarize(
    method summarize (line 140) | def summarize(
    method stream_summarize (line 157) | def stream_summarize(

FILE: private_gpt/server/utils/auth.py
  function _simple_authentication (line 40) | def _simple_authentication(authorization: Annotated[str, Header()] = "")...
  function authenticated (line 54) | def authenticated() -> bool:
  function authenticated (line 62) | def authenticated(

FILE: private_gpt/settings/settings.py
  class CorsSettings (line 8) | class CorsSettings(BaseModel):
  class AuthSettings (line 45) | class AuthSettings(BaseModel):
  class IngestionSettings (line 62) | class IngestionSettings(BaseModel):
  class ServerSettings (line 83) | class ServerSettings(BaseModel):
  class DataSettings (line 97) | class DataSettings(BaseModel):
  class LLMSettings (line 108) | class LLMSettings(BaseModel):
  class VectorstoreSettings (line 155) | class VectorstoreSettings(BaseModel):
  class NodeStoreSettings (line 159) | class NodeStoreSettings(BaseModel):
  class LlamaCPPSettings (line 163) | class LlamaCPPSettings(BaseModel):
  class HuggingFaceSettings (line 184) | class HuggingFaceSettings(BaseModel):
  class EmbeddingSettings (line 198) | class EmbeddingSettings(BaseModel):
  class SagemakerSettings (line 241) | class SagemakerSettings(BaseModel):
  class OpenAISettings (line 246) | class OpenAISettings(BaseModel):
  class GeminiSettings (line 271) | class GeminiSettings(BaseModel):
  class OllamaSettings (line 283) | class OllamaSettings(BaseModel):
  class AzureOpenAISettings (line 338) | class AzureOpenAISettings(BaseModel):
  class UISettings (line 357) | class UISettings(BaseModel):
  class RerankSettings (line 383) | class RerankSettings(BaseModel):
  class RagSettings (line 398) | class RagSettings(BaseModel):
  class SummarizeSettings (line 410) | class SummarizeSettings(BaseModel):
  class ClickHouseSettings (line 417) | class ClickHouseSettings(BaseModel):
  class PostgresSettings (line 488) | class PostgresSettings(BaseModel):
  class QdrantSettings (line 515) | class QdrantSettings(BaseModel):
  class MilvusSettings (line 569) | class MilvusSettings(BaseModel):
  class Settings (line 590) | class Settings(BaseModel):
  function settings (line 628) | def settings() -> Settings:

FILE: private_gpt/settings/settings_loader.py
  function merge_settings (line 32) | def merge_settings(settings: Iterable[dict[str, Any]]) -> dict[str, Any]:
  function load_settings_from_profile (line 36) | def load_settings_from_profile(profile: str) -> dict[str, Any]:
  function load_active_settings (line 50) | def load_active_settings() -> dict[str, Any]:

FILE: private_gpt/settings/yaml.py
  function load_yaml_with_envvars (line 12) | def load_yaml_with_envvars(

FILE: private_gpt/ui/ui.py
  class Modes (line 40) | class Modes(str, Enum):
  class Source (line 55) | class Source(BaseModel):
    class Config (line 60) | class Config:
    method curate_sources (line 64) | def curate_sources(sources: list[Chunk]) -> list["Source"]:
  class PrivateGptUi (line 83) | class PrivateGptUi:
    method __init__ (line 85) | def __init__(
    method _chat (line 109) | def _chat(
    method _get_default_system_prompt (line 238) | def _get_default_system_prompt(mode: Modes) -> str:
    method _get_default_mode_explanation (line 256) | def _get_default_mode_explanation(mode: Modes) -> str:
    method _set_system_prompt (line 269) | def _set_system_prompt(self, system_prompt_input: str) -> None:
    method _set_explanatation_mode (line 273) | def _set_explanatation_mode(self, explanation_mode: str) -> None:
    method _set_current_mode (line 276) | def _set_current_mode(self, mode: Modes) -> Any:
    method _list_ingested_files (line 286) | def _list_ingested_files(self) -> list[list[str]]:
    method _upload_file (line 298) | def _upload_file(self, files: list[str]) -> None:
    method _delete_all_files (line 321) | def _delete_all_files(self) -> Any:
    method _delete_selected_file (line 333) | def _delete_selected_file(self) -> Any:
    method _deselect_selected_file (line 350) | def _deselect_selected_file(self) -> Any:
    method _selected_a_file (line 358) | def _selected_a_file(self, select_data: gr.SelectData) -> Any:
    method _build_ui_blocks (line 366) | def _build_ui_blocks(self) -> gr.Blocks:
    method get_ui_blocks (line 573) | def get_ui_blocks(self) -> gr.Blocks:
    method mount_in_app (line 578) | def mount_in_app(self, app: FastAPI, path: str) -> None:

FILE: private_gpt/utils/eta.py
  function human_time (line 11) | def human_time(*args: Any, **kwargs: Any) -> str:
  function eta (line 38) | def eta(iterator: list[Any]) -> Any:
  class ETA (line 50) | class ETA:
    method __init__ (line 53) | def __init__(self, total: int):
    method human_time (line 60) | def human_time(self) -> str:
    method update (line 65) | def update(self, count: int) -> None:
    method needReport (line 71) | def needReport(self, whenSecs: int) -> bool:
    method _calc (line 78) | def _calc(self) -> bool:

FILE: private_gpt/utils/ollama.py
  function check_connection (line 31) | def check_connection(client: Client) -> bool:
  function process_streaming (line 42) | def process_streaming(generator: Iterator[Mapping[str, Any]]) -> None:
  function pull_model (line 85) | def pull_model(client: Client, model_name: str, raise_error: bool = True...

FILE: private_gpt/utils/retry.py
  function retry (line 10) | def retry(

FILE: scripts/ingest_folder.py
  class LocalIngestWorker (line 15) | class LocalIngestWorker:
    method __init__ (line 16) | def __init__(self, ingest_service: IngestService, setting: Settings) -...
    method _validate_folder (line 27) | def _validate_folder(self, folder_path: Path) -> None:
    method _find_all_files_in_folder (line 42) | def _find_all_files_in_folder(self, root_path: Path, ignored: list[str...
    method ingest_folder (line 55) | def ingest_folder(self, folder_path: Path, ignored: list[str]) -> None:
    method _ingest_all (line 60) | def _ingest_all(self, files_to_ingest: list[Path]) -> None:
    method ingest_on_watch (line 64) | def ingest_on_watch(self, changed_path: Path) -> None:
    method _do_ingest_one (line 68) | def _do_ingest_one(self, changed_path: Path) -> None:

FILE: scripts/utils.py
  function wipe_file (line 10) | def wipe_file(file: str) -> None:
  function wipe_tree (line 16) | def wipe_tree(path: str) -> None:
  class Postgres (line 39) | class Postgres:
    method __init__ (line 45) | def __init__(self) -> None:
    method wipe (line 55) | def wipe(self, storetype: str) -> None:
    method stats (line 66) | def stats(self, store_type: str) -> None:
    method __del__ (line 87) | def __del__(self):
  class Simple (line 92) | class Simple:
    method wipe (line 93) | def wipe(self, store_type: str) -> None:
  class Chroma (line 106) | class Chroma:
    method wipe (line 107) | def wipe(self, store_type: str) -> None:
  class Qdrant (line 112) | class Qdrant:
    method __init__ (line 117) | def __init__(self) -> None:
    method wipe (line 124) | def wipe(self, store_type: str) -> None:
    method stats (line 132) | def stats(self, store_type: str) -> None:
  class Command (line 148) | class Command:
    method for_each_store (line 156) | def for_each_store(self, cmd: str):
    method execute (line 174) | def execute(self, cmd: str) -> None:

FILE: tests/conftest.py
  function _as_module (line 10) | def _as_module(fixture_path: str) -> str:

FILE: tests/fixtures/auto_close_qdrant.py
  function _auto_close_vector_store_client (line 10) | def _auto_close_vector_store_client(injector: MockInjector) -> None:

FILE: tests/fixtures/fast_api_test_client.py
  function test_client (line 9) | def test_client(request: pytest.FixtureRequest, injector: MockInjector) ...

FILE: tests/fixtures/ingest_helper.py
  class IngestHelper (line 9) | class IngestHelper:
    method __init__ (line 10) | def __init__(self, test_client: TestClient):
    method ingest_file (line 13) | def ingest_file(self, path: Path) -> IngestResponse:
  function ingest_helper (line 23) | def ingest_helper(test_client: TestClient) -> IngestHelper:

FILE: tests/fixtures/mock_injector.py
  class MockInjector (line 14) | class MockInjector:
    method __init__ (line 15) | def __init__(self) -> None:
    method bind_mock (line 18) | def bind_mock(
    method bind_settings (line 30) | def bind_settings(self, settings: dict[str, Any]) -> Settings:
    method get (line 36) | def get(self, interface: type[T]) -> T:
  function injector (line 41) | def injector() -> MockInjector:

FILE: tests/server/chat/test_chat_routes.py
  function test_chat_route_produces_a_stream (line 7) | def test_chat_route_produces_a_stream(test_client: TestClient) -> None:
  function test_chat_route_produces_a_single_value (line 25) | def test_chat_route_produces_a_single_value(test_client: TestClient) -> ...

FILE: tests/server/chunks/test_chunk_routes.py
  function test_chunks_retrieval (line 9) | def test_chunks_retrieval(test_client: TestClient, ingest_helper: Ingest...

FILE: tests/server/embeddings/test_embedding_routes.py
  function test_embeddings_generation (line 9) | def test_embeddings_generation(test_client: TestClient) -> None:

FILE: tests/server/ingest/test_ingest_routes.py
  function test_ingest_accepts_txt_files (line 10) | def test_ingest_accepts_txt_files(ingest_helper: IngestHelper) -> None:
  function test_ingest_accepts_pdf_files (line 16) | def test_ingest_accepts_pdf_files(ingest_helper: IngestHelper) -> None:
  function test_ingest_list_returns_something_after_ingestion (line 22) | def test_ingest_list_returns_something_after_ingestion(
  function test_ingest_plain_text (line 40) | def test_ingest_plain_text(test_client: TestClient) -> None:

FILE: tests/server/ingest/test_local_ingest.py
  function file_path (line 10) | def file_path() -> str:
  function create_test_file (line 14) | def create_test_file(file_path: str) -> None:
  function clear_log_file (line 19) | def clear_log_file(log_file_path: str) -> None:
  function read_log_file (line 24) | def read_log_file(log_file_path: str) -> str:
  function init_structure (line 29) | def init_structure(folder: str, file_path: str) -> None:
  function test_ingest_one_file_in_allowed_folder (line 35) | def test_ingest_one_file_in_allowed_folder(
  function test_ingest_disabled (line 59) | def test_ingest_disabled(file_path: str) -> None:

FILE: tests/server/recipes/test_summarize_router.py
  function test_summarize_route_produces_a_stream (line 9) | def test_summarize_route_produces_a_stream(test_client: TestClient) -> N...
  function test_summarize_route_produces_a_single_value (line 26) | def test_summarize_route_produces_a_single_value(test_client: TestClient...
  function test_summarize_with_document_context (line 38) | def test_summarize_with_document_context(test_client: TestClient) -> None:
  function test_summarize_with_non_existent_document_context_not_fails (line 65) | def test_summarize_with_non_existent_document_context_not_fails(
  function test_summarize_with_metadata_and_document_context (line 85) | def test_summarize_with_metadata_and_document_context(test_client: TestC...
  function test_summarize_with_prompt (line 133) | def test_summarize_with_prompt(test_client: TestClient) -> None:

FILE: tests/server/utils/test_auth.py
  function test_default_does_not_require_auth (line 4) | def test_default_does_not_require_auth(test_client: TestClient) -> None:

FILE: tests/server/utils/test_simple_auth.py
  function _copy_simple_authenticated (line 23) | def _copy_simple_authenticated(
  function _patch_authenticated_dependency (line 33) | def _patch_authenticated_dependency(test_client: TestClient):
  function test_default_auth_working_when_enabled_401 (line 45) | def test_default_auth_working_when_enabled_401(test_client: TestClient) ...
  function test_default_auth_working_when_enabled_200 (line 50) | def test_default_auth_working_when_enabled_200(test_client: TestClient) ...

FILE: tests/settings/test_settings.py
  function test_settings_are_loaded_and_merged (line 5) | def test_settings_are_loaded_and_merged() -> None:
  function test_settings_can_be_overriden (line 9) | def test_settings_can_be_overriden(injector: MockInjector) -> None:

FILE: tests/settings/test_settings_loader.py
  function test_environment_variables_are_loaded (line 9) | def test_environment_variables_are_loaded() -> None:
  function test_environment_defaults_variables_are_loaded (line 19) | def test_environment_defaults_variables_are_loaded() -> None:
  function test_environment_defaults_variables_are_loaded_with_duplicated_delimiters (line 27) | def test_environment_defaults_variables_are_loaded_with_duplicated_delim...
  function test_environment_without_defaults_fails (line 35) | def test_environment_without_defaults_fails() -> None:

FILE: tests/test_prompt_helper.py
  function test_get_prompt_style_success (line 25) | def test_get_prompt_style_success(prompt_style, expected_prompt_style):
  function test_get_prompt_style_failure (line 29) | def test_get_prompt_style_failure():
  function test_tag_prompt_style_format (line 36) | def test_tag_prompt_style_format():
  function test_tag_prompt_style_format_with_system_prompt (line 52) | def test_tag_prompt_style_format_with_system_prompt():
  function test_mistral_prompt_style_format (line 70) | def test_mistral_prompt_style_format():
  function test_chatml_prompt_style_format (line 89) | def test_chatml_prompt_style_format():
  function test_llama2_prompt_style_format (line 107) | def test_llama2_prompt_style_format():
  function test_llama2_prompt_style_with_system_prompt (line 125) | def test_llama2_prompt_style_with_system_prompt():
  function test_llama3_prompt_style_format (line 145) | def test_llama3_prompt_style_format():
  function test_llama3_prompt_style_with_default_system (line 163) | def test_llama3_prompt_style_with_default_system():
  function test_llama3_prompt_style_with_assistant_response (line 177) | def test_llama3_prompt_style_with_assistant_response():

FILE: tests/ui/test_ui.py
  function test_ui_starts_in_the_given_endpoint (line 8) | def test_ui_starts_in_the_given_endpoint(test_client: TestClient) -> None:
Condensed preview — 159 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (477K chars).
[
  {
    "path": ".docker/router.yml",
    "chars": 345,
    "preview": "http:\n  services:\n    ollama:\n      loadBalancer:\n        healthCheck:\n          interval: 5s\n          path: /\n        "
  },
  {
    "path": ".dockerignore",
    "chars": 113,
    "preview": ".venv\nmodels\n.github\n.vscode\n.DS_Store\n.mypy_cache\n.ruff_cache\nlocal_data\nterraform\ntests\nDockerfile\nDockerfile.*"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug.yml",
    "chars": 3596,
    "preview": "name: Bug Report\ndescription: Report a bug or issue with the project.\ntitle: \"[BUG] \"\nlabels: [\"bug\"]\n\nbody:\n  - type: m"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "chars": 306,
    "preview": "blank_issues_enabled: false\ncontact_links:\n  - name: Documentation\n    url: https://docs.privategpt.dev\n    about: Pleas"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/docs.yml",
    "chars": 544,
    "preview": "name: Documentation\ndescription: Suggest a change or addition to the documentation.\ntitle: \"[DOCS] \"\nlabels: [\"documenta"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature.yml",
    "chars": 1002,
    "preview": "name: Enhancement\ndescription: Suggest an enhancement or improvement to the project.\ntitle: \"[FEATURE] \"\nlabels: [\"enhan"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/question.yml",
    "chars": 453,
    "preview": "name: Question\ndescription: Ask a question about the project.\ntitle: \"[QUESTION] \"\nlabels: [\"question\"]\n\nbody:\n  - type:"
  },
  {
    "path": ".github/pull_request_template.md",
    "chars": 1495,
    "preview": "# Description\n\nPlease include a summary of the change and which issue is fixed. Please also include relevant motivation "
  },
  {
    "path": ".github/release_please/.release-please-config.json",
    "chars": 439,
    "preview": "{\n    \"$schema\": \"https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json\",\n    \"release-ty"
  },
  {
    "path": ".github/release_please/.release-please-manifest.json",
    "chars": 18,
    "preview": "{\n  \".\": \"0.6.2\"\n}"
  },
  {
    "path": ".github/workflows/actions/install_dependencies/action.yml",
    "chars": 774,
    "preview": "name: \"Install Dependencies\"\ndescription: \"Action to build the project dependencies from the main versions\"\ninputs:\n  py"
  },
  {
    "path": ".github/workflows/fern-check.yml",
    "chars": 349,
    "preview": "name: fern check\n\non:\n  pull_request:\n    branches:\n      - main\n    paths:\n      - \"fern/**\"\n      \njobs:\n  fern-check:"
  },
  {
    "path": ".github/workflows/generate-release.yml",
    "chars": 2302,
    "preview": "name: generate-release\n\non:\n  release:\n    types: [ published ]\n  workflow_dispatch:\n\nenv:\n  REGISTRY: docker.io\n  IMAGE"
  },
  {
    "path": ".github/workflows/preview-docs.yml",
    "chars": 1566,
    "preview": "name: deploy preview docs\n\non:\n  pull_request_target:\n    branches:\n      - main\n    paths:\n      - \"fern/**\"\n\njobs:\n  p"
  },
  {
    "path": ".github/workflows/publish-docs.yml",
    "chars": 496,
    "preview": "name: publish docs\n\non: \n  push: \n    branches: \n      - main\n    paths:\n      - \"fern/**\"\n\njobs:\n  publish-docs:\n    ru"
  },
  {
    "path": ".github/workflows/release-please.yml",
    "chars": 426,
    "preview": "name: release-please\n\non:\n  push:\n    branches:\n      - main\n\npermissions:\n  contents: write\n  pull-requests: write\n\njob"
  },
  {
    "path": ".github/workflows/stale.yml",
    "chars": 810,
    "preview": "# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.\n#\n# You c"
  },
  {
    "path": ".github/workflows/tests.yml",
    "chars": 1714,
    "preview": "name: tests\n\non:\n  push:\n    branches:\n      - main\n  pull_request:\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ gi"
  },
  {
    "path": ".gitignore",
    "chars": 307,
    "preview": ".venv\n.env\nvenv\n\nsettings-me.yaml\n\n.ruff_cache\n.pytest_cache\n.mypy_cache\n\n# byte-compiled / optimized / DLL files\n__pyca"
  },
  {
    "path": ".pre-commit-config.yaml",
    "chars": 1042,
    "preview": "default_install_hook_types:\n# Mandatory to install both pre-commit and pre-push hooks (see https://pre-commit.com/#top_l"
  },
  {
    "path": "CHANGELOG.md",
    "chars": 21028,
    "preview": "# Changelog\n\n## [0.6.2](https://github.com/zylon-ai/private-gpt/compare/v0.6.1...v0.6.2) (2024-08-08)\n\n\n### Bug Fixes\n\n*"
  },
  {
    "path": "CITATION.cff",
    "chars": 465,
    "preview": "# This CITATION.cff file was generated with cffinit.\n# Visit https://bit.ly/cffinit to generate yours today!\n\ncff-versio"
  },
  {
    "path": "Dockerfile.llamacpp-cpu",
    "chars": 1784,
    "preview": "### IMPORTANT, THIS IMAGE CAN ONLY BE RUN IN LINUX DOCKER\n### You will run into a segfault in mac\nFROM python:3.11.6-sli"
  },
  {
    "path": "Dockerfile.ollama",
    "chars": 1533,
    "preview": "FROM python:3.11.6-slim-bookworm AS base\n\n# Install poetry\nRUN pip install pipx\nRUN python3 -m pipx ensurepath\nRUN pipx "
  },
  {
    "path": "LICENSE",
    "chars": 11357,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "Makefile",
    "chars": 2800,
    "preview": "# Any args passed to the make script, use with $(call args, default_value)\nargs = `arg=\"$(filter-out $@,$(MAKECMDGOALS))"
  },
  {
    "path": "README.md",
    "chars": 8566,
    "preview": "# PrivateGPT \n\n<a href=\"https://trendshift.io/repositories/2601\" target=\"_blank\"><img src=\"https://trendshift.io/api/bad"
  },
  {
    "path": "docker-compose.yaml",
    "chars": 3152,
    "preview": "services:\n\n  #-----------------------------------\n  #---- Private-GPT services ---------\n  #----------------------------"
  },
  {
    "path": "fern/README.md",
    "chars": 1392,
    "preview": "# Documentation of PrivateGPT\n\nThe documentation of this project is being rendered thanks to [fern](https://github.com/f"
  },
  {
    "path": "fern/docs/pages/api-reference/api-reference.mdx",
    "chars": 742,
    "preview": "# API Reference\n\nThe API is divided in two logical blocks:\n\n1. High-level API, abstracting all the complexity of a RAG ("
  },
  {
    "path": "fern/docs/pages/api-reference/sdks.mdx",
    "chars": 810,
    "preview": "We use [Fern](www.buildwithfern.com) to offer API clients for Node.js, Python, Go, and Java.\nWe recommend using these cl"
  },
  {
    "path": "fern/docs/pages/installation/concepts.mdx",
    "chars": 4383,
    "preview": "PrivateGPT is a service that wraps a set of AI RAG primitives in a comprehensive set of APIs providing a private, secure"
  },
  {
    "path": "fern/docs/pages/installation/installation.mdx",
    "chars": 20322,
    "preview": "It is important that you review the [Main Concepts](../concepts) section to understand the different components of Priva"
  },
  {
    "path": "fern/docs/pages/installation/troubleshooting.mdx",
    "chars": 2798,
    "preview": "# Downloading Gated and Private Models\nMany models are gated or private, requiring special access to use them. Follow th"
  },
  {
    "path": "fern/docs/pages/manual/ingestion-reset.mdx",
    "chars": 385,
    "preview": "# Reset Local documents database\n\nWhen running in a local setup, you can remove all ingested documents by simply\ndeletin"
  },
  {
    "path": "fern/docs/pages/manual/ingestion.mdx",
    "chars": 5133,
    "preview": "# Ingesting & Managing Documents\n\nThe ingestion of documents can be done in different ways:\n\n* Using the `/ingest` API\n*"
  },
  {
    "path": "fern/docs/pages/manual/llms.mdx",
    "chars": 8915,
    "preview": "## Running the Server\n\nPrivateGPT supports running with different LLMs & setups.\n\n### Local models\n\nBoth the LLM and the"
  },
  {
    "path": "fern/docs/pages/manual/nodestore.mdx",
    "chars": 2771,
    "preview": "## NodeStores\nPrivateGPT supports **Simple** and [Postgres](https://www.postgresql.org/) providers. Simple being the def"
  },
  {
    "path": "fern/docs/pages/manual/reranker.mdx",
    "chars": 1717,
    "preview": "## Enhancing Response Quality with Reranking\n\nPrivateGPT offers a reranking feature aimed at optimizing response generat"
  },
  {
    "path": "fern/docs/pages/manual/settings.mdx",
    "chars": 3456,
    "preview": "# Settings and profiles for your private GPT\n\nThe configuration of your private GPT server is done thanks to `settings` "
  },
  {
    "path": "fern/docs/pages/manual/vectordb.mdx",
    "chars": 9867,
    "preview": "## Vectorstores\nPrivateGPT supports [Qdrant](https://qdrant.tech/), [Milvus](https://milvus.io/), [Chroma](https://www.t"
  },
  {
    "path": "fern/docs/pages/overview/welcome.mdx",
    "chars": 1471,
    "preview": "PrivateGPT provides an **API** containing all the building blocks required to\nbuild **private, context-aware AI applicat"
  },
  {
    "path": "fern/docs/pages/quickstart/quickstart.mdx",
    "chars": 3948,
    "preview": "This guide provides a quick start for running different profiles of PrivateGPT using Docker Compose.\nThe profiles cater "
  },
  {
    "path": "fern/docs/pages/recipes/quickstart.mdx",
    "chars": 1018,
    "preview": "# Recipes\n\nRecipes are predefined use cases that help users solve very specific tasks using PrivateGPT.\nThey provide a s"
  },
  {
    "path": "fern/docs/pages/recipes/summarize.mdx",
    "chars": 1414,
    "preview": "The Summarize Recipe provides a method to extract concise summaries from ingested documents or texts using PrivateGPT.\nT"
  },
  {
    "path": "fern/docs/pages/ui/alternatives.mdx",
    "chars": 1381,
    "preview": "\nThis page aims to present different user interface (UI) alternatives for integrating and using PrivateGPT. These altern"
  },
  {
    "path": "fern/docs/pages/ui/gradio.mdx",
    "chars": 3346,
    "preview": "## Gradio UI user manual\n\nGradio UI is a ready to use way of testing most of PrivateGPT API functionalities.\n\n![Gradio P"
  },
  {
    "path": "fern/docs.yml",
    "chars": 3812,
    "preview": "# Main Fern configuration file\ninstances:\n  - url: privategpt.docs.buildwithfern.com\n    custom-domain: docs.privategpt."
  },
  {
    "path": "fern/fern.config.json",
    "chars": 58,
    "preview": "{\n  \"organization\": \"privategpt\",\n  \"version\": \"0.31.17\"\n}"
  },
  {
    "path": "fern/generators.yml",
    "chars": 187,
    "preview": "groups:\n  public:\n    generators:\n      - name: fernapi/fern-python-sdk\n        version: 0.6.2\n        output:\n         "
  },
  {
    "path": "fern/openapi/openapi.json",
    "chars": 37159,
    "preview": "{\n  \"openapi\": \"3.1.0\",\n  \"info\": {\n    \"title\": \"FastAPI\",\n    \"version\": \"0.1.0\"\n  },\n  \"paths\": {\n    \"/v1/completion"
  },
  {
    "path": "local_data/.gitignore",
    "chars": 13,
    "preview": "*\n!.gitignore"
  },
  {
    "path": "models/.gitignore",
    "chars": 13,
    "preview": "*\n!.gitignore"
  },
  {
    "path": "private_gpt/__init__.py",
    "chars": 995,
    "preview": "\"\"\"private-gpt.\"\"\"\n\nimport logging\nimport os\n\n# Set to 'DEBUG' to have extensive logging turned on, even for libraries\nR"
  },
  {
    "path": "private_gpt/__main__.py",
    "chars": 421,
    "preview": "# start a fastapi server with uvicorn\n\nimport uvicorn\n\nfrom private_gpt.main import app\nfrom private_gpt.settings.settin"
  },
  {
    "path": "private_gpt/components/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "private_gpt/components/embedding/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "private_gpt/components/embedding/custom/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "private_gpt/components/embedding/custom/sagemaker.py",
    "chars": 2834,
    "preview": "# mypy: ignore-errors\nimport json\nfrom typing import Any\n\nimport boto3\nfrom llama_index.core.base.embeddings.base import"
  },
  {
    "path": "private_gpt/components/embedding/embedding_component.py",
    "chars": 7091,
    "preview": "import logging\n\nfrom injector import inject, singleton\nfrom llama_index.core.embeddings import BaseEmbedding, MockEmbedd"
  },
  {
    "path": "private_gpt/components/ingest/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "private_gpt/components/ingest/ingest_component.py",
    "chars": 20953,
    "preview": "import abc\nimport itertools\nimport logging\nimport multiprocessing\nimport multiprocessing.pool\nimport os\nimport threading"
  },
  {
    "path": "private_gpt/components/ingest/ingest_helper.py",
    "chars": 4253,
    "preview": "import logging\nfrom pathlib import Path\n\nfrom llama_index.core.readers import StringIterableReader\nfrom llama_index.core"
  },
  {
    "path": "private_gpt/components/llm/__init__.py",
    "chars": 27,
    "preview": "\"\"\"LLM implementations.\"\"\"\n"
  },
  {
    "path": "private_gpt/components/llm/custom/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "private_gpt/components/llm/custom/sagemaker.py",
    "chars": 9787,
    "preview": "# mypy: ignore-errors\nfrom __future__ import annotations\n\nimport io\nimport json\nimport logging\nfrom typing import TYPE_C"
  },
  {
    "path": "private_gpt/components/llm/llm_component.py",
    "chars": 10505,
    "preview": "import logging\nfrom collections.abc import Callable\nfrom typing import Any\n\nfrom injector import inject, singleton\nfrom "
  },
  {
    "path": "private_gpt/components/llm/prompt_helper.py",
    "chars": 11703,
    "preview": "import abc\nimport logging\nfrom collections.abc import Sequence\nfrom typing import Any, Literal\n\nfrom llama_index.core.ll"
  },
  {
    "path": "private_gpt/components/node_store/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "private_gpt/components/node_store/node_store_component.py",
    "chars": 2669,
    "preview": "import logging\n\nfrom injector import inject, singleton\nfrom llama_index.core.storage.docstore import BaseDocumentStore, "
  },
  {
    "path": "private_gpt/components/vector_store/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "private_gpt/components/vector_store/batched_chroma.py",
    "chars": 3422,
    "preview": "from collections.abc import Generator, Sequence\nfrom typing import TYPE_CHECKING, Any\n\nfrom llama_index.core.schema impo"
  },
  {
    "path": "private_gpt/components/vector_store/vector_store_component.py",
    "chars": 8653,
    "preview": "import logging\nimport typing\n\nfrom injector import inject, singleton\nfrom llama_index.core.indices.vector_store import V"
  },
  {
    "path": "private_gpt/constants.py",
    "chars": 78,
    "preview": "from pathlib import Path\n\nPROJECT_ROOT_PATH: Path = Path(__file__).parents[1]\n"
  },
  {
    "path": "private_gpt/di.py",
    "chars": 537,
    "preview": "from injector import Injector\n\nfrom private_gpt.settings.settings import Settings, unsafe_typed_settings\n\n\ndef create_ap"
  },
  {
    "path": "private_gpt/launcher.py",
    "chars": 2690,
    "preview": "\"\"\"FastAPI app creation, logger configuration and main API routes.\"\"\"\n\nimport logging\n\nfrom fastapi import Depends, Fast"
  },
  {
    "path": "private_gpt/main.py",
    "chars": 193,
    "preview": "\"\"\"FastAPI app creation, logger configuration and main API routes.\"\"\"\n\nfrom private_gpt.di import global_injector\nfrom p"
  },
  {
    "path": "private_gpt/open_ai/__init__.py",
    "chars": 38,
    "preview": "\"\"\"OpenAI compatibility utilities.\"\"\"\n"
  },
  {
    "path": "private_gpt/open_ai/extensions/__init__.py",
    "chars": 29,
    "preview": "\"\"\"OpenAI API extensions.\"\"\"\n"
  },
  {
    "path": "private_gpt/open_ai/extensions/context_filter.py",
    "chars": 178,
    "preview": "from pydantic import BaseModel, Field\n\n\nclass ContextFilter(BaseModel):\n    docs_ids: list[str] | None = Field(\n        "
  },
  {
    "path": "private_gpt/open_ai/openai_models.py",
    "chars": 3702,
    "preview": "import time\nimport uuid\nfrom collections.abc import Iterator\nfrom typing import Literal\n\nfrom llama_index.core.llms impo"
  },
  {
    "path": "private_gpt/paths.py",
    "chars": 517,
    "preview": "from pathlib import Path\n\nfrom private_gpt.constants import PROJECT_ROOT_PATH\nfrom private_gpt.settings.settings import "
  },
  {
    "path": "private_gpt/server/__init__.py",
    "chars": 26,
    "preview": "\"\"\"private-gpt server.\"\"\"\n"
  },
  {
    "path": "private_gpt/server/chat/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "private_gpt/server/chat/chat_router.py",
    "chars": 4167,
    "preview": "from fastapi import APIRouter, Depends, Request\nfrom llama_index.core.llms import ChatMessage, MessageRole\nfrom pydantic"
  },
  {
    "path": "private_gpt/server/chat/chat_service.py",
    "chars": 7798,
    "preview": "from dataclasses import dataclass\nfrom typing import TYPE_CHECKING\n\nfrom injector import inject, singleton\nfrom llama_in"
  },
  {
    "path": "private_gpt/server/chunks/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "private_gpt/server/chunks/chunks_router.py",
    "chars": 2175,
    "preview": "from typing import Literal\n\nfrom fastapi import APIRouter, Depends, Request\nfrom pydantic import BaseModel, Field\n\nfrom "
  },
  {
    "path": "private_gpt/server/chunks/chunks_service.py",
    "chars": 4524,
    "preview": "from typing import TYPE_CHECKING, Literal\n\nfrom injector import inject, singleton\nfrom llama_index.core.indices import V"
  },
  {
    "path": "private_gpt/server/completions/__init__.py",
    "chars": 48,
    "preview": "\"\"\"Deprecated Openai compatibility endpoint.\"\"\"\n"
  },
  {
    "path": "private_gpt/server/completions/completions_router.py",
    "chars": 3362,
    "preview": "from fastapi import APIRouter, Depends, Request\nfrom pydantic import BaseModel\nfrom starlette.responses import Streaming"
  },
  {
    "path": "private_gpt/server/embeddings/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "private_gpt/server/embeddings/embeddings_router.py",
    "chars": 1131,
    "preview": "from typing import Literal\n\nfrom fastapi import APIRouter, Depends, Request\nfrom pydantic import BaseModel\n\nfrom private"
  },
  {
    "path": "private_gpt/server/embeddings/embeddings_service.py",
    "chars": 924,
    "preview": "from typing import Literal\n\nfrom injector import inject, singleton\nfrom pydantic import BaseModel, Field\n\nfrom private_g"
  },
  {
    "path": "private_gpt/server/health/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "private_gpt/server/health/health_router.py",
    "chars": 442,
    "preview": "from typing import Literal\n\nfrom fastapi import APIRouter\nfrom pydantic import BaseModel, Field\n\n# Not authentication or"
  },
  {
    "path": "private_gpt/server/ingest/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "private_gpt/server/ingest/ingest_router.py",
    "chars": 4306,
    "preview": "from typing import Literal\n\nfrom fastapi import APIRouter, Depends, HTTPException, Request, UploadFile\nfrom pydantic imp"
  },
  {
    "path": "private_gpt/server/ingest/ingest_service.py",
    "chars": 5215,
    "preview": "import logging\nimport tempfile\nfrom pathlib import Path\nfrom typing import TYPE_CHECKING, AnyStr, BinaryIO\n\nfrom injecto"
  },
  {
    "path": "private_gpt/server/ingest/ingest_watcher.py",
    "chars": 1366,
    "preview": "from collections.abc import Callable\nfrom pathlib import Path\nfrom typing import Any\n\nfrom watchdog.events import (\n    "
  },
  {
    "path": "private_gpt/server/ingest/model.py",
    "chars": 981,
    "preview": "from typing import Any, Literal\n\nfrom llama_index.core.schema import Document\nfrom pydantic import BaseModel, Field\n\n\ncl"
  },
  {
    "path": "private_gpt/server/recipes/summarize/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "private_gpt/server/recipes/summarize/summarize_router.py",
    "chars": 2950,
    "preview": "from fastapi import APIRouter, Depends, Request\nfrom pydantic import BaseModel\nfrom starlette.responses import Streaming"
  },
  {
    "path": "private_gpt/server/recipes/summarize/summarize_service.py",
    "chars": 6152,
    "preview": "from itertools import chain\n\nfrom injector import inject, singleton\nfrom llama_index.core import (\n    Document,\n    Sto"
  },
  {
    "path": "private_gpt/server/utils/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "private_gpt/server/utils/auth.py",
    "chars": 2631,
    "preview": "\"\"\"Authentication mechanism for the API.\n\nDefine a simple mechanism to authenticate requests.\nMore complex authenticatio"
  },
  {
    "path": "private_gpt/settings/__init__.py",
    "chars": 16,
    "preview": "\"\"\"Settings.\"\"\"\n"
  },
  {
    "path": "private_gpt/settings/settings.py",
    "chars": 22743,
    "preview": "from typing import Any, Literal\n\nfrom pydantic import BaseModel, Field\n\nfrom private_gpt.settings.settings_loader import"
  },
  {
    "path": "private_gpt/settings/settings_loader.py",
    "chars": 1697,
    "preview": "import functools\nimport logging\nimport os\nimport sys\nfrom collections.abc import Iterable\nfrom pathlib import Path\nfrom "
  },
  {
    "path": "private_gpt/settings/yaml.py",
    "chars": 1331,
    "preview": "import os\nimport re\nimport typing\nfrom typing import Any, TextIO\n\nfrom yaml import SafeLoader\n\n_env_replace_matcher = re"
  },
  {
    "path": "private_gpt/ui/__init__.py",
    "chars": 23,
    "preview": "\"\"\"Gradio based UI.\"\"\"\n"
  },
  {
    "path": "private_gpt/ui/images.py",
    "chars": 4976,
    "preview": "logo_svg = \"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODYxIiBoZWlnaHQ9Ijk4IiB2aWV3Qm94PSIwIDAgODYxIDk4IiBmaWxsPSJub25lIi"
  },
  {
    "path": "private_gpt/ui/ui.py",
    "chars": 24507,
    "preview": "\"\"\"This file should be imported if and only if you want to run the UI locally.\"\"\"\n\nimport base64\nimport logging\nimport t"
  },
  {
    "path": "private_gpt/utils/__init__.py",
    "chars": 21,
    "preview": "\"\"\"general utils.\"\"\"\n"
  },
  {
    "path": "private_gpt/utils/eta.py",
    "chars": 4215,
    "preview": "import datetime\nimport logging\nimport math\nimport time\nfrom collections import deque\nfrom typing import Any\n\nlogger = lo"
  },
  {
    "path": "private_gpt/utils/ollama.py",
    "chars": 3261,
    "preview": "import logging\nfrom collections import deque\nfrom collections.abc import Iterator, Mapping\nfrom typing import Any\n\nfrom "
  },
  {
    "path": "private_gpt/utils/retry.py",
    "chars": 750,
    "preview": "import logging\nfrom collections.abc import Callable\nfrom typing import Any\n\nfrom retry_async import retry as retry_untyp"
  },
  {
    "path": "private_gpt/utils/typing.py",
    "chars": 79,
    "preview": "from typing import TypeVar\n\nT = TypeVar(\"T\")\nK = TypeVar(\"K\")\nV = TypeVar(\"V\")\n"
  },
  {
    "path": "pyproject.toml",
    "chars": 6238,
    "preview": "[tool.poetry]\nname = \"private-gpt\"\nversion = \"0.6.2\"\ndescription = \"Private GPT\"\nauthors = [\"Zylon <hi@zylon.ai>\"]\n\n[too"
  },
  {
    "path": "scripts/__init__.py",
    "chars": 26,
    "preview": "\"\"\"PrivateGPT scripts.\"\"\"\n"
  },
  {
    "path": "scripts/extract_openapi.py",
    "chars": 1064,
    "preview": "import argparse\nimport json\nimport sys\n\nimport yaml\nfrom uvicorn.importer import import_from_string\n\nparser = argparse.A"
  },
  {
    "path": "scripts/ingest_folder.py",
    "chars": 4873,
    "preview": "#!/usr/bin/env python3\n\nimport argparse\nimport logging\nfrom pathlib import Path\n\nfrom private_gpt.di import global_injec"
  },
  {
    "path": "scripts/setup",
    "chars": 1847,
    "preview": "#!/usr/bin/env python3\nimport os\nimport argparse\n\nfrom huggingface_hub import hf_hub_download, snapshot_download\nfrom tr"
  },
  {
    "path": "scripts/utils.py",
    "chars": 6300,
    "preview": "import argparse\nimport os\nimport shutil\nfrom typing import Any, ClassVar\n\nfrom private_gpt.paths import local_data_path\n"
  },
  {
    "path": "settings-azopenai.yaml",
    "chars": 398,
    "preview": "server:\n  env_name: ${APP_ENV:azopenai}\n\nllm:\n  mode: azopenai\n\nembedding:\n  mode: azopenai\n\nazopenai:\n  api_key: ${AZ_O"
  },
  {
    "path": "settings-docker.yaml",
    "chars": 1157,
    "preview": "server:\n  env_name: ${APP_ENV:prod}\n  port: ${PORT:8080}\n\nllm:\n  mode: ${PGPT_MODE:mock}\n\nembedding:\n  mode: ${PGPT_EMBE"
  },
  {
    "path": "settings-gemini.yaml",
    "chars": 153,
    "preview": "llm:\n  mode: gemini\n\nembedding:\n  mode: gemini\n\ngemini:\n  api_key: ${GOOGLE_API_KEY:}\n  model: models/gemini-pro\n  embed"
  },
  {
    "path": "settings-local.yaml",
    "chars": 637,
    "preview": "# poetry install --extras \"ui llms-llama-cpp vector-stores-qdrant embeddings-huggingface\"\nserver:\n  env_name: ${APP_ENV:"
  },
  {
    "path": "settings-mock.yaml",
    "chars": 191,
    "preview": "server:\n  env_name: ${APP_ENV:mock}\n\n# This configuration allows you to use GPU for creating embeddings while avoiding l"
  },
  {
    "path": "settings-ollama-pg.yaml",
    "chars": 687,
    "preview": "# Using ollama and postgres for the vector, doc and index store. Ollama is also used for embeddings.\n# To use install th"
  },
  {
    "path": "settings-ollama.yaml",
    "chars": 1701,
    "preview": "server:\n  env_name: ${APP_ENV:ollama}\n\nllm:\n  mode: ollama\n  max_new_tokens: 512\n  context_window: 3900\n  temperature: 0"
  },
  {
    "path": "settings-openai.yaml",
    "chars": 148,
    "preview": "server:\n  env_name: ${APP_ENV:openai}\n\nllm:\n  mode: openai\n\nembedding:\n  mode: openai\n\nopenai:\n  api_key: ${OPENAI_API_K"
  },
  {
    "path": "settings-sagemaker.yaml",
    "chars": 220,
    "preview": "server:\n  env_name: ${APP_ENV:sagemaker}\n  port: ${PORT:8001}\n\nui:\n  enabled: true\n  path: /\n\nllm:\n  mode: sagemaker\n\nem"
  },
  {
    "path": "settings-test.yaml",
    "chars": 267,
    "preview": "server:\n  env_name: test\n  auth:\n    enabled: false\n    # Dummy secrets used for tests\n    secret: \"foo bar; dummy secre"
  },
  {
    "path": "settings-vllm.yaml",
    "chars": 393,
    "preview": "server:\n  env_name: ${APP_ENV:vllm}\n\nllm:\n  mode: openailike\n  max_new_tokens: 512\n  tokenizer: meta-llama/Meta-Llama-3."
  },
  {
    "path": "settings.yaml",
    "chars": 5727,
    "preview": "# The default configuration file.\n# More information about configuration can be found in the documentation: https://docs"
  },
  {
    "path": "tests/__init__.py",
    "chars": 13,
    "preview": "\"\"\"Tests.\"\"\"\n"
  },
  {
    "path": "tests/conftest.py",
    "chars": 403,
    "preview": "import os\nimport pathlib\nfrom glob import glob\n\nroot_path = pathlib.Path(__file__).parents[1]\n# This is to prevent a bug"
  },
  {
    "path": "tests/fixtures/__init__.py",
    "chars": 23,
    "preview": "\"\"\"Global fixtures.\"\"\"\n"
  },
  {
    "path": "tests/fixtures/auto_close_qdrant.py",
    "chars": 557,
    "preview": "import pytest\n\nfrom private_gpt.components.vector_store.vector_store_component import (\n    VectorStoreComponent,\n)\nfrom"
  },
  {
    "path": "tests/fixtures/fast_api_test_client.py",
    "chars": 465,
    "preview": "import pytest\nfrom fastapi.testclient import TestClient\n\nfrom private_gpt.launcher import create_app\nfrom tests.fixtures"
  },
  {
    "path": "tests/fixtures/ingest_helper.py",
    "chars": 705,
    "preview": "from pathlib import Path\n\nimport pytest\nfrom fastapi.testclient import TestClient\n\nfrom private_gpt.server.ingest.ingest"
  },
  {
    "path": "tests/fixtures/mock_injector.py",
    "chars": 1300,
    "preview": "from collections.abc import Callable\nfrom typing import Any\nfrom unittest.mock import MagicMock\n\nimport pytest\nfrom inje"
  },
  {
    "path": "tests/server/chat/test_chat_routes.py",
    "chars": 1228,
    "preview": "from fastapi.testclient import TestClient\n\nfrom private_gpt.open_ai.openai_models import OpenAICompletion, OpenAIMessage"
  },
  {
    "path": "tests/server/chunks/chunk_test.txt",
    "chars": 150,
    "preview": "e88c1005-637d-4cb4-ae79-9b8eb58cab97\n\nb483dd15-78c4-4d67-b546-21a0d690bf43\n\na8080238-b294-4598-ac9c-7abf4c8e0552\n\n14208d"
  },
  {
    "path": "tests/server/chunks/test_chunk_routes.py",
    "chars": 740,
    "preview": "from pathlib import Path\n\nfrom fastapi.testclient import TestClient\n\nfrom private_gpt.server.chunks.chunks_router import"
  },
  {
    "path": "tests/server/embeddings/test_embedding_routes.py",
    "chars": 553,
    "preview": "from fastapi.testclient import TestClient\n\nfrom private_gpt.server.embeddings.embeddings_router import (\n    EmbeddingsB"
  },
  {
    "path": "tests/server/ingest/test.txt",
    "chars": 2763,
    "preview": "Once upon a time, in a magical forest called Enchantia, lived a young and cheerful deer named Zumi. Zumi was no ordinary"
  },
  {
    "path": "tests/server/ingest/test_ingest_routes.py",
    "chars": 1756,
    "preview": "import tempfile\nfrom pathlib import Path\n\nfrom fastapi.testclient import TestClient\n\nfrom private_gpt.server.ingest.inge"
  },
  {
    "path": "tests/server/ingest/test_local_ingest.py",
    "chars": 1967,
    "preview": "import os\nimport subprocess\nfrom pathlib import Path\n\nimport pytest\nfrom fastapi.testclient import TestClient\n\n\n@pytest."
  },
  {
    "path": "tests/server/recipes/test_summarize_router.py",
    "chars": 5575,
    "preview": "from fastapi.testclient import TestClient\n\nfrom private_gpt.server.recipes.summarize.summarize_router import (\n    Summa"
  },
  {
    "path": "tests/server/utils/test_auth.py",
    "chars": 220,
    "preview": "from fastapi.testclient import TestClient\n\n\ndef test_default_does_not_require_auth(test_client: TestClient) -> None:\n   "
  },
  {
    "path": "tests/server/utils/test_simple_auth.py",
    "chars": 1779,
    "preview": "\"\"\"Tests to validate that the simple authentication mechanism is working.\n\nNOTE: We are not testing the switch based on "
  },
  {
    "path": "tests/settings/test_settings.py",
    "chars": 455,
    "preview": "from private_gpt.settings.settings import Settings, settings\nfrom tests.fixtures.mock_injector import MockInjector\n\n\ndef"
  },
  {
    "path": "tests/settings/test_settings_loader.py",
    "chars": 1218,
    "preview": "import io\nimport os\n\nimport pytest\n\nfrom private_gpt.settings.yaml import load_yaml_with_envvars\n\n\ndef test_environment_"
  },
  {
    "path": "tests/test_prompt_helper.py",
    "chars": 6393,
    "preview": "import pytest\nfrom llama_index.core.llms import ChatMessage, MessageRole\n\nfrom private_gpt.components.llm.prompt_helper "
  },
  {
    "path": "tests/ui/test_ui.py",
    "chars": 315,
    "preview": "import pytest\nfrom fastapi.testclient import TestClient\n\n\n@pytest.mark.parametrize(\n    \"test_client\", [{\"ui\": {\"enabled"
  },
  {
    "path": "tiktoken_cache/.gitignore",
    "chars": 13,
    "preview": "*\n!.gitignore"
  },
  {
    "path": "version.txt",
    "chars": 6,
    "preview": "0.6.2\n"
  }
]

About this extraction

This page contains the full source code of the zylon-ai/private-gpt GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 159 files (438.5 KB), approximately 109.7k tokens, and a symbol index with 327 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!