mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 17:05:41 +01:00
Merge branch 'main' into qdm12/dockerfile-1
This commit is contained in:
commit
0af94d2043
37 changed files with 1986 additions and 691 deletions
105
.github/ISSUE_TEMPLATE/bug.yml
vendored
Normal file
105
.github/ISSUE_TEMPLATE/bug.yml
vendored
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
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`)
|
||||||
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
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.
|
||||||
19
.github/ISSUE_TEMPLATE/docs.yml
vendored
Normal file
19
.github/ISSUE_TEMPLATE/docs.yml
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
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
|
||||||
37
.github/ISSUE_TEMPLATE/feature.yml
vendored
Normal file
37
.github/ISSUE_TEMPLATE/feature.yml
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
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
|
||||||
19
.github/ISSUE_TEMPLATE/question.yml
vendored
Normal file
19
.github/ISSUE_TEMPLATE/question.yml
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
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
|
||||||
37
.github/pull_request_template.md
vendored
Normal file
37
.github/pull_request_template.md
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
# 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
|
||||||
14
.github/workflows/preview-docs.yml
vendored
14
.github/workflows/preview-docs.yml
vendored
|
|
@ -11,6 +11,10 @@ jobs:
|
||||||
preview-docs:
|
preview-docs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -37,14 +41,14 @@ jobs:
|
||||||
# Set the output for the step
|
# Set the output for the step
|
||||||
echo "::set-output name=preview_url::$preview_url"
|
echo "::set-output name=preview_url::$preview_url"
|
||||||
- name: Comment PR with URL using github-actions bot
|
- name: Comment PR with URL using github-actions bot
|
||||||
uses: actions/github-script@v4
|
uses: actions/github-script@v7
|
||||||
if: ${{ steps.generate_docs.outputs.preview_url }}
|
if: ${{ steps.generate_docs.outputs.preview_url }}
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const preview_url = '${{ steps.generate_docs.outputs.preview_url }}';
|
const preview_url = '${{ steps.generate_docs.outputs.preview_url }}';
|
||||||
const issue_number = context.issue.number;
|
github.rest.issues.createComment({
|
||||||
github.issues.createComment({
|
issue_number: context.issue.number,
|
||||||
...context.repo,
|
owner: context.repo.owner,
|
||||||
issue_number: issue_number,
|
repo: context.repo.repo,
|
||||||
body: `Published docs preview URL: ${preview_url}`
|
body: `Published docs preview URL: ${preview_url}`
|
||||||
})
|
})
|
||||||
|
|
|
||||||
17
CITATION.cff
17
CITATION.cff
|
|
@ -8,18 +8,9 @@ message: >-
|
||||||
metadata from this file.
|
metadata from this file.
|
||||||
type: software
|
type: software
|
||||||
authors:
|
authors:
|
||||||
- given-names: Iván
|
- name: Zylon by PrivateGPT
|
||||||
family-names: Martínez Toro
|
address: hello@zylon.ai
|
||||||
email: ivanmartit@gmail.com
|
website: 'https://www.zylon.ai/'
|
||||||
orcid: 'https://orcid.org/0009-0004-5065-2311'
|
repository-code: 'https://github.com/zylon-ai/private-gpt'
|
||||||
- family-names: Gallego Vico
|
|
||||||
given-names: Daniel
|
|
||||||
email: danielgallegovico@gmail.com
|
|
||||||
orcid: 'https://orcid.org/0009-0006-8582-4384'
|
|
||||||
- given-names: Pablo
|
|
||||||
family-names: Orgaz
|
|
||||||
email: pabloogc+gh@gmail.com
|
|
||||||
orcid: 'https://orcid.org/0009-0008-0080-1437'
|
|
||||||
repository-code: 'https://github.com/imartinez/privateGPT'
|
|
||||||
license: Apache-2.0
|
license: Apache-2.0
|
||||||
date-released: '2023-05-02'
|
date-released: '2023-05-02'
|
||||||
|
|
|
||||||
23
README.md
23
README.md
|
|
@ -1,6 +1,6 @@
|
||||||
# 🔒 PrivateGPT 📑
|
# 🔒 PrivateGPT 📑
|
||||||
|
|
||||||
[](https://github.com/imartinez/privateGPT/actions/workflows/tests.yml?query=branch%3Amain)
|
[](https://github.com/zylon-ai/private-gpt/actions/workflows/tests.yml?query=branch%3Amain)
|
||||||
[](https://docs.privategpt.dev/)
|
[](https://docs.privategpt.dev/)
|
||||||
|
|
||||||
[](https://discord.gg/bK6mRVpErU)
|
[](https://discord.gg/bK6mRVpErU)
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
> Install & usage docs: https://docs.privategpt.dev/
|
> Install & usage docs: https://docs.privategpt.dev/
|
||||||
>
|
>
|
||||||
> Join the community: [Twitter](https://twitter.com/PrivateGPT_AI) & [Discord](https://discord.gg/bK6mRVpErU)
|
> Join the community: [Twitter](https://twitter.com/ZylonPrivateGPT) & [Discord](https://discord.gg/bK6mRVpErU)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
@ -38,9 +38,10 @@ 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
|
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.
|
download script, ingestion script, documents folder watch, etc.
|
||||||
|
|
||||||
> 👂 **Need help applying PrivateGPT to your specific use case?**
|
> 💡 If you are looking for an **enterprise-ready, fully private AI workspace**
|
||||||
> [Let us know more about it](https://forms.gle/4cSDmH13RZBHV9at7)
|
> check out [Zylon's website](https://zylon.ai) or [request a demo](https://cal.com/zylon/demo?source=pgpt-readme).
|
||||||
> and we'll try to help! We are refining PrivateGPT through your feedback.
|
> 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...).
|
||||||
|
|
||||||
## 🎞️ Overview
|
## 🎞️ Overview
|
||||||
DISCLAIMER: This README is not updated as frequently as the [documentation](https://docs.privategpt.dev/).
|
DISCLAIMER: This README is not updated as frequently as the [documentation](https://docs.privategpt.dev/).
|
||||||
|
|
@ -62,7 +63,7 @@ thus a simpler and more educational implementation to understand the basic conce
|
||||||
to build a fully local -and therefore, private- chatGPT-like tool.
|
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
|
If you want to keep experimenting with it, we have saved it in the
|
||||||
[primordial branch](https://github.com/imartinez/privateGPT/tree/primordial) of the project.
|
[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
|
> 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.
|
PrivateGPT if you come from the previous, primordial version.
|
||||||
|
|
@ -73,7 +74,7 @@ completions, document ingestion, RAG pipelines and other low-level building bloc
|
||||||
We want to make it easier for any developer to build AI applications and experiences, as well as provide
|
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.
|
a suitable extensive architecture for the community to keep contributing.
|
||||||
|
|
||||||
Stay tuned to our [releases](https://github.com/imartinez/privateGPT/releases) to check out all the new features and changes included.
|
Stay tuned to our [releases](https://github.com/zylon-ai/private-gpt/releases) to check out all the new features and changes included.
|
||||||
|
|
||||||
## 📄 Documentation
|
## 📄 Documentation
|
||||||
Full documentation on installation, dependencies, configuration, running the server, deployment options,
|
Full documentation on installation, dependencies, configuration, running the server, deployment options,
|
||||||
|
|
@ -132,19 +133,19 @@ Here are a couple of examples:
|
||||||
|
|
||||||
#### BibTeX
|
#### BibTeX
|
||||||
```bibtex
|
```bibtex
|
||||||
@software{Martinez_Toro_PrivateGPT_2023,
|
@software{Zylon_PrivateGPT_2023,
|
||||||
author = {Martínez Toro, Iván and Gallego Vico, Daniel and Orgaz, Pablo},
|
author = {Zylon by PrivateGPT},
|
||||||
license = {Apache-2.0},
|
license = {Apache-2.0},
|
||||||
month = may,
|
month = may,
|
||||||
title = {{PrivateGPT}},
|
title = {{PrivateGPT}},
|
||||||
url = {https://github.com/imartinez/privateGPT},
|
url = {https://github.com/zylon-ai/private-gpt},
|
||||||
year = {2023}
|
year = {2023}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### APA
|
#### APA
|
||||||
```
|
```
|
||||||
Martínez Toro, I., Gallego Vico, D., & Orgaz, P. (2023). PrivateGPT [Computer software]. https://github.com/imartinez/privateGPT
|
Zylon by PrivateGPT (2023). PrivateGPT [Computer software]. https://github.com/zylon-ai/private-gpt
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🤗 Partners & Supporters
|
## 🤗 Partners & Supporters
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Documentation of privateGPT
|
# Documentation of PrivateGPT
|
||||||
|
|
||||||
The documentation of this project is being rendered thanks to [fern](https://github.com/fern-api/fern).
|
The documentation of this project is being rendered thanks to [fern](https://github.com/fern-api/fern).
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ navigation:
|
||||||
contents:
|
contents:
|
||||||
- page: Introduction
|
- page: Introduction
|
||||||
path: ./docs/pages/overview/welcome.mdx
|
path: ./docs/pages/overview/welcome.mdx
|
||||||
# How to install privateGPT, with FAQ and troubleshooting
|
# How to install PrivateGPT, with FAQ and troubleshooting
|
||||||
- tab: installation
|
- tab: installation
|
||||||
layout:
|
layout:
|
||||||
- section: Getting started
|
- section: Getting started
|
||||||
|
|
@ -41,7 +41,9 @@ navigation:
|
||||||
path: ./docs/pages/installation/concepts.mdx
|
path: ./docs/pages/installation/concepts.mdx
|
||||||
- page: Installation
|
- page: Installation
|
||||||
path: ./docs/pages/installation/installation.mdx
|
path: ./docs/pages/installation/installation.mdx
|
||||||
# Manual of privateGPT: how to use it and configure it
|
- page: Troubleshooting
|
||||||
|
path: ./docs/pages/installation/troubleshooting.mdx
|
||||||
|
# Manual of PrivateGPT: how to use it and configure it
|
||||||
- tab: manual
|
- tab: manual
|
||||||
layout:
|
layout:
|
||||||
- section: General configuration
|
- section: General configuration
|
||||||
|
|
@ -68,8 +70,10 @@ navigation:
|
||||||
path: ./docs/pages/manual/reranker.mdx
|
path: ./docs/pages/manual/reranker.mdx
|
||||||
- section: User Interface
|
- section: User Interface
|
||||||
contents:
|
contents:
|
||||||
- page: User interface (Gradio) Manual
|
- page: Gradio Manual
|
||||||
path: ./docs/pages/manual/ui.mdx
|
path: ./docs/pages/ui/gradio.mdx
|
||||||
|
- page: Alternatives
|
||||||
|
path: ./docs/pages/ui/alternatives.mdx
|
||||||
# Small code snippet or example of usage to help users
|
# Small code snippet or example of usage to help users
|
||||||
- tab: recipes
|
- tab: recipes
|
||||||
layout:
|
layout:
|
||||||
|
|
@ -78,7 +82,7 @@ navigation:
|
||||||
# TODO: add recipes
|
# TODO: add recipes
|
||||||
- page: List of LLMs
|
- page: List of LLMs
|
||||||
path: ./docs/pages/recipes/list-llm.mdx
|
path: ./docs/pages/recipes/list-llm.mdx
|
||||||
# More advanced usage of privateGPT, by API
|
# More advanced usage of PrivateGPT, by API
|
||||||
- tab: api-reference
|
- tab: api-reference
|
||||||
layout:
|
layout:
|
||||||
- section: Overview
|
- section: Overview
|
||||||
|
|
@ -92,12 +96,11 @@ navigation:
|
||||||
# Definition of the navbar, will be displayed in the top right corner.
|
# 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
|
# `type:primary` is always displayed at the most right side of the navbar
|
||||||
navbar-links:
|
navbar-links:
|
||||||
- type: secondary
|
|
||||||
text: GitHub
|
|
||||||
url: "https://github.com/imartinez/privateGPT"
|
|
||||||
- type: secondary
|
- type: secondary
|
||||||
text: Contact us
|
text: Contact us
|
||||||
url: "mailto:hello@zylon.ai"
|
url: "mailto:hello@zylon.ai"
|
||||||
|
- type: github
|
||||||
|
value: "https://github.com/zylon-ai/private-gpt"
|
||||||
- type: primary
|
- type: primary
|
||||||
text: Join the Discord
|
text: Join the Discord
|
||||||
url: https://discord.com/invite/bK6mRVpErU
|
url: https://discord.com/invite/bK6mRVpErU
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,14 @@ The clients are kept up to date automatically, so we encourage you to use the la
|
||||||
|
|
||||||
<Cards>
|
<Cards>
|
||||||
<Card
|
<Card
|
||||||
title="Node.js/TypeScript - WIP"
|
title="TypeScript"
|
||||||
icon="fa-brands fa-node"
|
icon="fa-brands fa-node"
|
||||||
href="https://github.com/imartinez/privateGPT-typescript"
|
href="https://github.com/zylon-ai/privategpt-ts"
|
||||||
/>
|
/>
|
||||||
<Card
|
<Card
|
||||||
title="Python - Ready!"
|
title="Python"
|
||||||
icon="fa-brands fa-python"
|
icon="fa-brands fa-python"
|
||||||
href="https://github.com/imartinez/pgpt_python"
|
href="https://github.com/zylon-ai/pgpt-python"
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
</Cards>
|
</Cards>
|
||||||
|
|
@ -26,12 +26,12 @@ The clients are kept up to date automatically, so we encourage you to use the la
|
||||||
<Card
|
<Card
|
||||||
title="Java - WIP"
|
title="Java - WIP"
|
||||||
icon="fa-brands fa-java"
|
icon="fa-brands fa-java"
|
||||||
href="https://github.com/imartinez/privateGPT-java"
|
href="https://github.com/zylon-ai/private-gpt-java"
|
||||||
/>
|
/>
|
||||||
<Card
|
<Card
|
||||||
title="Go - WIP"
|
title="Go - WIP"
|
||||||
icon="fa-brands fa-golang"
|
icon="fa-brands fa-golang"
|
||||||
href="https://github.com/imartinez/privateGPT-go"
|
href="https://github.com/zylon-ai/private-gpt-go"
|
||||||
/>
|
/>
|
||||||
</Cards>
|
</Cards>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,20 +8,27 @@ It supports a variety of LLM providers, embeddings providers, and vector stores,
|
||||||
|
|
||||||
## Setup configurations available
|
## Setup configurations available
|
||||||
You get to decide the setup for these 3 main components:
|
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.
|
- **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.
|
- **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.
|
- **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.
|
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
|
### Setups and Dependencies
|
||||||
Your setup will be the combination of the different options available. You'll find recommended setups in the [installation](/installation) section.
|
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>..."`.
|
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 HuggingFace as local embeddings, you would run
|
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:
|
||||||
|
|
||||||
`poetry install --extras "ui vector-stores-qdrant llms-ollama embeddings-huggingface"`.
|
```bash
|
||||||
|
poetry install --extras "ui vector-stores-qdrant llms-ollama embeddings-ollama"
|
||||||
|
```
|
||||||
|
|
||||||
Refer to the [installation](/installation) section for more details.
|
Refer to the [installation](./installation) section for more details.
|
||||||
|
|
||||||
### Setups and Configuration
|
### Setups and Configuration
|
||||||
PrivateGPT uses yaml to define its configuration in files named `settings-<profile>.yaml`.
|
PrivateGPT uses yaml to define its configuration in files named `settings-<profile>.yaml`.
|
||||||
|
|
@ -37,17 +44,6 @@ will load the configuration from `settings.yaml` and `settings-ollama.yaml`.
|
||||||
|
|
||||||
## About Fully Local Setups
|
## 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.
|
In order to run PrivateGPT in a fully local setup, you will need to run the LLM, Embeddings and Vector Store locally.
|
||||||
### Vector stores
|
|
||||||
The vector stores supported (Qdrant, ChromaDB and Postgres) run locally by default.
|
|
||||||
### 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
|
|
||||||
```
|
|
||||||
|
|
||||||
### LLM
|
### LLM
|
||||||
For local LLM there are two options:
|
For local LLM there are two options:
|
||||||
|
|
@ -58,3 +54,14 @@ In order for LlamaCPP powered LLM to work (the second option), you need to downl
|
||||||
```bash
|
```bash
|
||||||
poetry run python scripts/setup
|
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.
|
||||||
|
|
@ -1,63 +1,102 @@
|
||||||
It is important that you review the Main Concepts before you start the installation process.
|
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
|
## Base requirements to run PrivateGPT
|
||||||
|
|
||||||
* Clone PrivateGPT repository, and navigate to it:
|
### 1. Clone the PrivateGPT Repository
|
||||||
|
Clone the repository and navigate to it:
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/zylon-ai/private-gpt
|
git clone https://github.com/zylon-ai/private-gpt
|
||||||
cd private-gpt
|
cd private-gpt
|
||||||
```
|
```
|
||||||
|
|
||||||
* Install Python `3.11` (*if you do not have it already*). Ideally through a python version manager like `pyenv`.
|
### 2. Install Python 3.11
|
||||||
Earlier python versions are not supported.
|
If you do not have Python 3.11 installed, install it using a Python version manager like `pyenv`. Earlier Python versions are not supported.
|
||||||
* osx/linux: [pyenv](https://github.com/pyenv/pyenv)
|
#### macOS/Linux
|
||||||
* windows: [pyenv-win](https://github.com/pyenv-win/pyenv-win)
|
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
|
```bash
|
||||||
pyenv install 3.11
|
pyenv install 3.11
|
||||||
pyenv local 3.11
|
pyenv local 3.11
|
||||||
```
|
```
|
||||||
|
|
||||||
* Install [Poetry](https://python-poetry.org/docs/#installing-with-the-official-installer) for dependency management:
|
### 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.
|
||||||
|
|
||||||
* Install `make` to be able to run the different scripts:
|
### 4. Optional: Install `make`
|
||||||
* osx: (Using homebrew): `brew install make`
|
To run various scripts, you need to install `make`. Follow the instructions for your operating system:
|
||||||
* windows: (Using chocolatey) `choco install make`
|
#### macOS
|
||||||
|
(Using Homebrew):
|
||||||
|
```bash
|
||||||
|
brew install make
|
||||||
|
```
|
||||||
|
#### Windows
|
||||||
|
(Using Chocolatey):
|
||||||
|
```bash
|
||||||
|
choco install make
|
||||||
|
```
|
||||||
|
|
||||||
## Install and run your desired setup
|
## Install and Run Your Desired Setup
|
||||||
|
|
||||||
PrivateGPT allows to customize the setup -from fully local to cloud based- by deciding the modules to use.
|
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:
|
||||||
Here are the different options available:
|
|
||||||
|
|
||||||
- LLM: "llama-cpp", "ollama", "sagemaker", "openai", "openailike", "azopenai"
|
|
||||||
- Embeddings: "huggingface", "openai", "sagemaker", "azopenai"
|
|
||||||
- Vector stores: "qdrant", "chroma", "postgres"
|
|
||||||
- UI: whether or not to enable UI (Gradio) or just go with the API
|
|
||||||
|
|
||||||
In order to only install the required dependencies, PrivateGPT offers different `extras` that can be combined during the installation process:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
poetry install --extras "<extra1> <extra2>..."
|
poetry install --extras "<extra1> <extra2>..."
|
||||||
```
|
```
|
||||||
|
Where `<extra>` can be any of the following options described below.
|
||||||
|
|
||||||
Where `<extra>` can be any of the following:
|
### Available Modules
|
||||||
|
|
||||||
- ui: adds support for UI using Gradio
|
You need to choose one option per category (LLM, Embeddings, Vector Stores, UI). Below are the tables listing the available options for each category.
|
||||||
- llms-ollama: adds support for Ollama LLM, the easiest way to get a local LLM running, requires Ollama running locally
|
|
||||||
- llms-llama-cpp: adds support for local LLM using LlamaCPP - expect a messy installation process on some platforms
|
#### LLM
|
||||||
- llms-sagemaker: adds support for Amazon Sagemaker LLM, requires Sagemaker inference endpoints
|
|
||||||
- llms-openai: adds support for OpenAI LLM, requires OpenAI API key
|
| **Option** | **Description** | **Extra** |
|
||||||
- llms-openai-like: adds support for 3rd party LLM providers that are compatible with OpenAI's API
|
|--------------|------------------------------------------------------------------------|---------------------|
|
||||||
- llms-azopenai: adds support for Azure OpenAI LLM, requires Azure OpenAI inference endpoints
|
| **ollama** | Adds support for Ollama LLM, requires Ollama running locally | llms-ollama |
|
||||||
- embeddings-ollama: adds support for Ollama Embeddings, requires Ollama running locally
|
| llama-cpp | Adds support for local LLM using LlamaCPP | llms-llama-cpp |
|
||||||
- embeddings-huggingface: adds support for local Embeddings using HuggingFace
|
| sagemaker | Adds support for Amazon Sagemaker LLM, requires Sagemaker endpoints | llms-sagemaker |
|
||||||
- embeddings-sagemaker: adds support for Amazon Sagemaker Embeddings, requires Sagemaker inference endpoints
|
| openai | Adds support for OpenAI LLM, requires OpenAI API key | llms-openai |
|
||||||
- embeddings-openai = adds support for OpenAI Embeddings, requires OpenAI API key
|
| openailike | Adds support for 3rd party LLM providers compatible with OpenAI's API | llms-openai-like |
|
||||||
- embeddings-azopenai = adds support for Azure OpenAI Embeddings, requires Azure OpenAI inference endpoints
|
| azopenai | Adds support for Azure OpenAI LLM, requires Azure endpoints | llms-azopenai |
|
||||||
- vector-stores-qdrant: adds support for Qdrant vector store
|
| gemini | Adds support for Gemini LLM, requires Gemini API key | llms-gemini |
|
||||||
- vector-stores-chroma: adds support for Chroma DB vector store
|
|
||||||
- vector-stores-postgres: adds support for Postgres vector store
|
#### 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
|
## Recommended Setups
|
||||||
|
|
||||||
|
|
@ -81,6 +120,8 @@ set PGPT_PROFILES=ollama
|
||||||
make run
|
make run
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Refer to the [troubleshooting](./troubleshooting) section for specific issues you might encounter.
|
||||||
|
|
||||||
### Local, Ollama-powered setup - RECOMMENDED
|
### 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.
|
**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.
|
||||||
|
|
|
||||||
31
fern/docs/pages/installation/troubleshooting.mdx
Normal file
31
fern/docs/pages/installation/troubleshooting.mdx
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
# 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: mistralai/Mistral-7B-Instruct-v0.2
|
||||||
|
```
|
||||||
|
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.
|
||||||
|
|
@ -93,7 +93,7 @@ time PGPT_PROFILES=mock python ./scripts/ingest_folder.py ~/my-dir/to-ingest/
|
||||||
|
|
||||||
## Supported file formats
|
## Supported file formats
|
||||||
|
|
||||||
privateGPT by default supports all the file formats that contains clear text (for example, `.txt` files, `.html`, etc.).
|
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.
|
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:
|
It also supports the following file formats:
|
||||||
|
|
@ -115,11 +115,15 @@ It also supports the following file formats:
|
||||||
* `.ipynb`
|
* `.ipynb`
|
||||||
* `.json`
|
* `.json`
|
||||||
|
|
||||||
**Please note the following nuance**: while `privateGPT` supports these file formats, it **might** require additional
|
<Callout intent = "info">
|
||||||
|
While `PrivateGPT` supports these file formats, it **might** require additional
|
||||||
dependencies to be installed in your python's virtual environment.
|
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
|
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.
|
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
|
**Other file formats might work**, but they will be considered as plain text
|
||||||
files (in other words, they will be ingested as `.txt` files).
|
files (in other words, they will be ingested as `.txt` files).
|
||||||
|
</Callout>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,3 +193,42 @@ or
|
||||||
|
|
||||||
When the server is started it will print a log *Application startup complete*.
|
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.
|
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.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
The configuration of your private GPT server is done thanks to `settings` files (more precisely `settings.yaml`).
|
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.
|
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
|
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.
|
PrivateGPT, and this can be done using the `settings` files.
|
||||||
|
|
||||||
This project is defining the concept of **profiles** (or configuration profiles).
|
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
|
This mechanism, using your environment variables, is giving you the ability to easily switch between
|
||||||
|
|
@ -30,15 +30,20 @@ For example, on **linux and macOS**, this gives:
|
||||||
export PGPT_PROFILES=my_profile_name_here
|
export PGPT_PROFILES=my_profile_name_here
|
||||||
```
|
```
|
||||||
|
|
||||||
Windows Powershell(s) have a different syntax, one of them being:
|
Windows Command Prompt (cmd) has a different syntax:
|
||||||
```shell
|
```shell
|
||||||
set PGPT_PROFILES=my_profile_name_here
|
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.
|
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,
|
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.
|
and it will run using your profile on top of the default configuration.
|
||||||
|
|
||||||
## Reference
|
## Reference
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
## Vectorstores
|
## Vectorstores
|
||||||
PrivateGPT supports [Qdrant](https://qdrant.tech/), [Chroma](https://www.trychroma.com/) and [PGVector](https://github.com/pgvector/pgvector) as vectorstore providers. Qdrant being the default.
|
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`, `chroma` or `postgres`.
|
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
|
```yaml
|
||||||
vectorstore:
|
vectorstore:
|
||||||
|
|
@ -39,6 +39,24 @@ qdrant:
|
||||||
path: local_data/private_gpt/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
|
### Chroma configuration
|
||||||
|
|
||||||
To enable Chroma, set the `vectorstore.database` property in the `settings.yaml` file to `chroma` and install the `chroma` extra.
|
To enable Chroma, set the `vectorstore.database` property in the `settings.yaml` file to `chroma` and install the `chroma` extra.
|
||||||
|
|
@ -101,3 +119,69 @@ Indexes:
|
||||||
postgres=#
|
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.
|
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.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,16 @@
|
||||||
PrivateGPT provides an **API** containing all the building blocks required to
|
PrivateGPT provides an **API** containing all the building blocks required to
|
||||||
build **private, context-aware AI applications**.
|
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.
|
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,
|
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.
|
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).
|
Get started by understanding the [Main Concepts and Installation](/installation) and then dive into the [API Reference](/api-reference).
|
||||||
|
|
||||||
|
|
@ -32,9 +40,3 @@ Get started by understanding the [Main Concepts and Installation](/installation)
|
||||||
</Cards>
|
</Cards>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|
||||||
<Callout intent = "info">
|
|
||||||
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.
|
|
||||||
</Callout>
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
# List of working LLM
|
# List of working LLM
|
||||||
|
|
||||||
**Do you have any working combination of LLM and embeddings?**
|
**Do you have any working combination of LLM and embeddings?**
|
||||||
|
|
||||||
Please open a PR to add it to the list, and come on our Discord to tell us about it!
|
Please open a PR to add it to the list, and come on our Discord to tell us about it!
|
||||||
|
|
||||||
## Prompt style
|
## Prompt style
|
||||||
|
|
|
||||||
21
fern/docs/pages/ui/alternatives.mdx
Normal file
21
fern/docs/pages/ui/alternatives.mdx
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
@ -2,7 +2,12 @@
|
||||||
|
|
||||||
Gradio UI is a ready to use way of testing most of PrivateGPT API functionalities.
|
Gradio UI is a ready to use way of testing most of PrivateGPT API functionalities.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
<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
|
### Execution Modes
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
{
|
||||||
"organization": "privategpt",
|
"organization": "privategpt",
|
||||||
"version": "0.19.10"
|
"version": "0.31.17"
|
||||||
}
|
}
|
||||||
1538
poetry.lock
generated
1538
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -55,8 +55,17 @@ class EmbeddingComponent:
|
||||||
"OpenAI dependencies not found, install with `poetry install --extras embeddings-openai`"
|
"OpenAI dependencies not found, install with `poetry install --extras embeddings-openai`"
|
||||||
) from e
|
) from e
|
||||||
|
|
||||||
openai_settings = settings.openai.api_key
|
api_base = (
|
||||||
self.embedding_model = OpenAIEmbedding(api_key=openai_settings)
|
settings.openai.embedding_api_base or settings.openai.api_base
|
||||||
|
)
|
||||||
|
api_key = settings.openai.embedding_api_key or settings.openai.api_key
|
||||||
|
model = settings.openai.embedding_model
|
||||||
|
|
||||||
|
self.embedding_model = OpenAIEmbedding(
|
||||||
|
api_base=api_base,
|
||||||
|
api_key=api_key,
|
||||||
|
model=model,
|
||||||
|
)
|
||||||
case "ollama":
|
case "ollama":
|
||||||
try:
|
try:
|
||||||
from llama_index.embeddings.ollama import ( # type: ignore
|
from llama_index.embeddings.ollama import ( # type: ignore
|
||||||
|
|
@ -90,6 +99,20 @@ class EmbeddingComponent:
|
||||||
azure_endpoint=azopenai_settings.azure_endpoint,
|
azure_endpoint=azopenai_settings.azure_endpoint,
|
||||||
api_version=azopenai_settings.api_version,
|
api_version=azopenai_settings.api_version,
|
||||||
)
|
)
|
||||||
|
case "gemini":
|
||||||
|
try:
|
||||||
|
from llama_index.embeddings.gemini import ( # type: ignore
|
||||||
|
GeminiEmbedding,
|
||||||
|
)
|
||||||
|
except ImportError as e:
|
||||||
|
raise ImportError(
|
||||||
|
"Gemini dependencies not found, install with `poetry install --extras embeddings-gemini`"
|
||||||
|
) from e
|
||||||
|
|
||||||
|
self.embedding_model = GeminiEmbedding(
|
||||||
|
api_key=settings.gemini.api_key,
|
||||||
|
model_name=settings.gemini.embedding_model,
|
||||||
|
)
|
||||||
case "mock":
|
case "mock":
|
||||||
# Not a random number, is the dimensionality used by
|
# Not a random number, is the dimensionality used by
|
||||||
# the default embedding model
|
# the default embedding model
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,10 @@ class LLMComponent:
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Failed to download tokenizer %s. Falling back to "
|
f"Failed to download tokenizer {settings.llm.tokenizer}: {e!s}"
|
||||||
"default tokenizer.",
|
f"Please follow the instructions in the documentation to download it if needed: "
|
||||||
settings.llm.tokenizer,
|
f"https://docs.privategpt.dev/installation/getting-started/troubleshooting#tokenizer-setup."
|
||||||
e,
|
f"Falling back to default tokenizer."
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info("Initializing the LLM in mode=%s", llm_mode)
|
logger.info("Initializing the LLM in mode=%s", llm_mode)
|
||||||
|
|
@ -123,6 +123,9 @@ class LLMComponent:
|
||||||
max_new_tokens=settings.llm.max_new_tokens,
|
max_new_tokens=settings.llm.max_new_tokens,
|
||||||
messages_to_prompt=prompt_style.messages_to_prompt,
|
messages_to_prompt=prompt_style.messages_to_prompt,
|
||||||
completion_to_prompt=prompt_style.completion_to_prompt,
|
completion_to_prompt=prompt_style.completion_to_prompt,
|
||||||
|
tokenizer=settings.llm.tokenizer,
|
||||||
|
timeout=openai_settings.request_timeout,
|
||||||
|
reuse_client=False,
|
||||||
)
|
)
|
||||||
case "ollama":
|
case "ollama":
|
||||||
try:
|
try:
|
||||||
|
|
@ -187,5 +190,18 @@ class LLMComponent:
|
||||||
azure_endpoint=azopenai_settings.azure_endpoint,
|
azure_endpoint=azopenai_settings.azure_endpoint,
|
||||||
api_version=azopenai_settings.api_version,
|
api_version=azopenai_settings.api_version,
|
||||||
)
|
)
|
||||||
|
case "gemini":
|
||||||
|
try:
|
||||||
|
from llama_index.llms.gemini import ( # type: ignore
|
||||||
|
Gemini,
|
||||||
|
)
|
||||||
|
except ImportError as e:
|
||||||
|
raise ImportError(
|
||||||
|
"Google Gemini dependencies not found, install with `poetry install --extras llms-gemini`"
|
||||||
|
) from e
|
||||||
|
gemini_settings = settings.gemini
|
||||||
|
self.llm = Gemini(
|
||||||
|
model_name=gemini_settings.model, api_key=gemini_settings.api_key
|
||||||
|
)
|
||||||
case "mock":
|
case "mock":
|
||||||
self.llm = MockLLM()
|
self.llm = MockLLM()
|
||||||
|
|
|
||||||
|
|
@ -173,18 +173,22 @@ class TagPromptStyle(AbstractPromptStyle):
|
||||||
|
|
||||||
class MistralPromptStyle(AbstractPromptStyle):
|
class MistralPromptStyle(AbstractPromptStyle):
|
||||||
def _messages_to_prompt(self, messages: Sequence[ChatMessage]) -> str:
|
def _messages_to_prompt(self, messages: Sequence[ChatMessage]) -> str:
|
||||||
prompt = "<s>"
|
inst_buffer = []
|
||||||
|
text = ""
|
||||||
for message in messages:
|
for message in messages:
|
||||||
role = message.role
|
if message.role == MessageRole.SYSTEM or message.role == MessageRole.USER:
|
||||||
content = message.content or ""
|
inst_buffer.append(str(message.content).strip())
|
||||||
if role.lower() == "system":
|
elif message.role == MessageRole.ASSISTANT:
|
||||||
message_from_user = f"[INST] {content.strip()} [/INST]"
|
text += "<s>[INST] " + "\n".join(inst_buffer) + " [/INST]"
|
||||||
prompt += message_from_user
|
text += " " + str(message.content).strip() + "</s>"
|
||||||
elif role.lower() == "user":
|
inst_buffer.clear()
|
||||||
prompt += "</s>"
|
else:
|
||||||
message_from_user = f"[INST] {content.strip()} [/INST]"
|
raise ValueError(f"Unknown message role {message.role}")
|
||||||
prompt += message_from_user
|
|
||||||
return prompt
|
if len(inst_buffer) > 0:
|
||||||
|
text += "<s>[INST] " + "\n".join(inst_buffer) + " [/INST]"
|
||||||
|
|
||||||
|
return text
|
||||||
|
|
||||||
def _completion_to_prompt(self, completion: str) -> str:
|
def _completion_to_prompt(self, completion: str) -> str:
|
||||||
return self._messages_to_prompt(
|
return self._messages_to_prompt(
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@ import typing
|
||||||
from injector import inject, singleton
|
from injector import inject, singleton
|
||||||
from llama_index.core.indices.vector_store import VectorIndexRetriever, VectorStoreIndex
|
from llama_index.core.indices.vector_store import VectorIndexRetriever, VectorStoreIndex
|
||||||
from llama_index.core.vector_stores.types import (
|
from llama_index.core.vector_stores.types import (
|
||||||
|
BasePydanticVectorStore,
|
||||||
FilterCondition,
|
FilterCondition,
|
||||||
MetadataFilter,
|
MetadataFilter,
|
||||||
MetadataFilters,
|
MetadataFilters,
|
||||||
VectorStore,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from private_gpt.open_ai.extensions.context_filter import ContextFilter
|
from private_gpt.open_ai.extensions.context_filter import ContextFilter
|
||||||
|
|
@ -32,7 +32,7 @@ def _doc_id_metadata_filter(
|
||||||
@singleton
|
@singleton
|
||||||
class VectorStoreComponent:
|
class VectorStoreComponent:
|
||||||
settings: Settings
|
settings: Settings
|
||||||
vector_store: VectorStore
|
vector_store: BasePydanticVectorStore
|
||||||
|
|
||||||
@inject
|
@inject
|
||||||
def __init__(self, settings: Settings) -> None:
|
def __init__(self, settings: Settings) -> None:
|
||||||
|
|
@ -54,7 +54,7 @@ class VectorStoreComponent:
|
||||||
)
|
)
|
||||||
|
|
||||||
self.vector_store = typing.cast(
|
self.vector_store = typing.cast(
|
||||||
VectorStore,
|
BasePydanticVectorStore,
|
||||||
PGVectorStore.from_params(
|
PGVectorStore.from_params(
|
||||||
**settings.postgres.model_dump(exclude_none=True),
|
**settings.postgres.model_dump(exclude_none=True),
|
||||||
table_name="embeddings",
|
table_name="embeddings",
|
||||||
|
|
@ -87,7 +87,7 @@ class VectorStoreComponent:
|
||||||
) # TODO
|
) # TODO
|
||||||
|
|
||||||
self.vector_store = typing.cast(
|
self.vector_store = typing.cast(
|
||||||
VectorStore,
|
BasePydanticVectorStore,
|
||||||
BatchedChromaVectorStore(
|
BatchedChromaVectorStore(
|
||||||
chroma_client=chroma_client, chroma_collection=chroma_collection
|
chroma_client=chroma_client, chroma_collection=chroma_collection
|
||||||
),
|
),
|
||||||
|
|
@ -115,12 +115,78 @@ class VectorStoreComponent:
|
||||||
**settings.qdrant.model_dump(exclude_none=True)
|
**settings.qdrant.model_dump(exclude_none=True)
|
||||||
)
|
)
|
||||||
self.vector_store = typing.cast(
|
self.vector_store = typing.cast(
|
||||||
VectorStore,
|
BasePydanticVectorStore,
|
||||||
QdrantVectorStore(
|
QdrantVectorStore(
|
||||||
client=client,
|
client=client,
|
||||||
collection_name="make_this_parameterizable_per_api_call",
|
collection_name="make_this_parameterizable_per_api_call",
|
||||||
), # TODO
|
), # TODO
|
||||||
)
|
)
|
||||||
|
|
||||||
|
case "milvus":
|
||||||
|
try:
|
||||||
|
from llama_index.vector_stores.milvus import ( # type: ignore
|
||||||
|
MilvusVectorStore,
|
||||||
|
)
|
||||||
|
except ImportError as e:
|
||||||
|
raise ImportError(
|
||||||
|
"Milvus dependencies not found, install with `poetry install --extras vector-stores-milvus`"
|
||||||
|
) from e
|
||||||
|
|
||||||
|
if settings.milvus is None:
|
||||||
|
logger.info(
|
||||||
|
"Milvus config not found. Using default settings.\n"
|
||||||
|
"Trying to connect to Milvus at local_data/private_gpt/milvus/milvus_local.db "
|
||||||
|
"with collection 'make_this_parameterizable_per_api_call'."
|
||||||
|
)
|
||||||
|
|
||||||
|
self.vector_store = typing.cast(
|
||||||
|
BasePydanticVectorStore,
|
||||||
|
MilvusVectorStore(
|
||||||
|
dim=settings.embedding.embed_dim,
|
||||||
|
collection_name="make_this_parameterizable_per_api_call",
|
||||||
|
overwrite=True,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
self.vector_store = typing.cast(
|
||||||
|
BasePydanticVectorStore,
|
||||||
|
MilvusVectorStore(
|
||||||
|
dim=settings.embedding.embed_dim,
|
||||||
|
uri=settings.milvus.uri,
|
||||||
|
token=settings.milvus.token,
|
||||||
|
collection_name=settings.milvus.collection_name,
|
||||||
|
overwrite=settings.milvus.overwrite,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
case "clickhouse":
|
||||||
|
try:
|
||||||
|
from clickhouse_connect import ( # type: ignore
|
||||||
|
get_client,
|
||||||
|
)
|
||||||
|
from llama_index.vector_stores.clickhouse import ( # type: ignore
|
||||||
|
ClickHouseVectorStore,
|
||||||
|
)
|
||||||
|
except ImportError as e:
|
||||||
|
raise ImportError(
|
||||||
|
"ClickHouse dependencies not found, install with `poetry install --extras vector-stores-clickhouse`"
|
||||||
|
) from e
|
||||||
|
|
||||||
|
if settings.clickhouse is None:
|
||||||
|
raise ValueError(
|
||||||
|
"ClickHouse settings not found. Please provide settings."
|
||||||
|
)
|
||||||
|
|
||||||
|
clickhouse_client = get_client(
|
||||||
|
host=settings.clickhouse.host,
|
||||||
|
port=settings.clickhouse.port,
|
||||||
|
username=settings.clickhouse.username,
|
||||||
|
password=settings.clickhouse.password,
|
||||||
|
)
|
||||||
|
self.vector_store = ClickHouseVectorStore(
|
||||||
|
clickhouse_client=clickhouse_client
|
||||||
|
)
|
||||||
case _:
|
case _:
|
||||||
# Should be unreachable
|
# Should be unreachable
|
||||||
# The settings validator should have caught this
|
# The settings validator should have caught this
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
from typing import Literal
|
from typing import Any, Literal
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
@ -82,7 +82,14 @@ class DataSettings(BaseModel):
|
||||||
|
|
||||||
class LLMSettings(BaseModel):
|
class LLMSettings(BaseModel):
|
||||||
mode: Literal[
|
mode: Literal[
|
||||||
"llamacpp", "openai", "openailike", "azopenai", "sagemaker", "mock", "ollama"
|
"llamacpp",
|
||||||
|
"openai",
|
||||||
|
"openailike",
|
||||||
|
"azopenai",
|
||||||
|
"sagemaker",
|
||||||
|
"mock",
|
||||||
|
"ollama",
|
||||||
|
"gemini",
|
||||||
]
|
]
|
||||||
max_new_tokens: int = Field(
|
max_new_tokens: int = Field(
|
||||||
256,
|
256,
|
||||||
|
|
@ -118,7 +125,7 @@ class LLMSettings(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
class VectorstoreSettings(BaseModel):
|
class VectorstoreSettings(BaseModel):
|
||||||
database: Literal["chroma", "qdrant", "postgres"]
|
database: Literal["chroma", "qdrant", "postgres", "clickhouse", "milvus"]
|
||||||
|
|
||||||
|
|
||||||
class NodeStoreSettings(BaseModel):
|
class NodeStoreSettings(BaseModel):
|
||||||
|
|
@ -157,7 +164,9 @@ class HuggingFaceSettings(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
class EmbeddingSettings(BaseModel):
|
class EmbeddingSettings(BaseModel):
|
||||||
mode: Literal["huggingface", "openai", "azopenai", "sagemaker", "ollama", "mock"]
|
mode: Literal[
|
||||||
|
"huggingface", "openai", "azopenai", "sagemaker", "ollama", "mock", "gemini"
|
||||||
|
]
|
||||||
ingest_mode: Literal["simple", "batch", "parallel", "pipeline"] = Field(
|
ingest_mode: Literal["simple", "batch", "parallel", "pipeline"] = Field(
|
||||||
"simple",
|
"simple",
|
||||||
description=(
|
description=(
|
||||||
|
|
@ -205,6 +214,31 @@ class OpenAISettings(BaseModel):
|
||||||
"gpt-3.5-turbo",
|
"gpt-3.5-turbo",
|
||||||
description="OpenAI Model to use. Example: 'gpt-4'.",
|
description="OpenAI Model to use. Example: 'gpt-4'.",
|
||||||
)
|
)
|
||||||
|
request_timeout: float = Field(
|
||||||
|
120.0,
|
||||||
|
description="Time elapsed until openailike server times out the request. Default is 120s. Format is float. ",
|
||||||
|
)
|
||||||
|
embedding_api_base: str = Field(
|
||||||
|
None,
|
||||||
|
description="Base URL of OpenAI API. Example: 'https://api.openai.com/v1'.",
|
||||||
|
)
|
||||||
|
embedding_api_key: str
|
||||||
|
embedding_model: str = Field(
|
||||||
|
"text-embedding-ada-002",
|
||||||
|
description="OpenAI embedding Model to use. Example: 'text-embedding-3-large'.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class GeminiSettings(BaseModel):
|
||||||
|
api_key: str
|
||||||
|
model: str = Field(
|
||||||
|
"models/gemini-pro",
|
||||||
|
description="Google Model to use. Example: 'models/gemini-pro'.",
|
||||||
|
)
|
||||||
|
embedding_model: str = Field(
|
||||||
|
"models/embedding-001",
|
||||||
|
description="Google Embedding Model to use. Example: 'models/embedding-001'.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class OllamaSettings(BaseModel):
|
class OllamaSettings(BaseModel):
|
||||||
|
|
@ -322,6 +356,77 @@ class RagSettings(BaseModel):
|
||||||
rerank: RerankSettings
|
rerank: RerankSettings
|
||||||
|
|
||||||
|
|
||||||
|
class ClickHouseSettings(BaseModel):
|
||||||
|
host: str = Field(
|
||||||
|
"localhost",
|
||||||
|
description="The server hosting the ClickHouse database",
|
||||||
|
)
|
||||||
|
port: int = Field(
|
||||||
|
8443,
|
||||||
|
description="The port on which the ClickHouse database is accessible",
|
||||||
|
)
|
||||||
|
username: str = Field(
|
||||||
|
"default",
|
||||||
|
description="The username to use to connect to the ClickHouse database",
|
||||||
|
)
|
||||||
|
password: str = Field(
|
||||||
|
"",
|
||||||
|
description="The password to use to connect to the ClickHouse database",
|
||||||
|
)
|
||||||
|
database: str = Field(
|
||||||
|
"__default__",
|
||||||
|
description="The default database to use for connections",
|
||||||
|
)
|
||||||
|
secure: bool | str = Field(
|
||||||
|
False,
|
||||||
|
description="Use https/TLS for secure connection to the server",
|
||||||
|
)
|
||||||
|
interface: str | None = Field(
|
||||||
|
None,
|
||||||
|
description="Must be either 'http' or 'https'. Determines the protocol to use for the connection",
|
||||||
|
)
|
||||||
|
settings: dict[str, Any] | None = Field(
|
||||||
|
None,
|
||||||
|
description="Specific ClickHouse server settings to be used with the session",
|
||||||
|
)
|
||||||
|
connect_timeout: int | None = Field(
|
||||||
|
None,
|
||||||
|
description="Timeout in seconds for establishing a connection",
|
||||||
|
)
|
||||||
|
send_receive_timeout: int | None = Field(
|
||||||
|
None,
|
||||||
|
description="Read timeout in seconds for http connection",
|
||||||
|
)
|
||||||
|
verify: bool | None = Field(
|
||||||
|
None,
|
||||||
|
description="Verify the server certificate in secure/https mode",
|
||||||
|
)
|
||||||
|
ca_cert: str | None = Field(
|
||||||
|
None,
|
||||||
|
description="Path to Certificate Authority root certificate (.pem format)",
|
||||||
|
)
|
||||||
|
client_cert: str | None = Field(
|
||||||
|
None,
|
||||||
|
description="Path to TLS Client certificate (.pem format)",
|
||||||
|
)
|
||||||
|
client_cert_key: str | None = Field(
|
||||||
|
None,
|
||||||
|
description="Path to the private key for the TLS Client certificate",
|
||||||
|
)
|
||||||
|
http_proxy: str | None = Field(
|
||||||
|
None,
|
||||||
|
description="HTTP proxy address",
|
||||||
|
)
|
||||||
|
https_proxy: str | None = Field(
|
||||||
|
None,
|
||||||
|
description="HTTPS proxy address",
|
||||||
|
)
|
||||||
|
server_host_name: str | None = Field(
|
||||||
|
None,
|
||||||
|
description="Server host name to be checked against the TLS certificate",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class PostgresSettings(BaseModel):
|
class PostgresSettings(BaseModel):
|
||||||
host: str = Field(
|
host: str = Field(
|
||||||
"localhost",
|
"localhost",
|
||||||
|
|
@ -403,6 +508,27 @@ class QdrantSettings(BaseModel):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class MilvusSettings(BaseModel):
|
||||||
|
uri: str = Field(
|
||||||
|
"local_data/private_gpt/milvus/milvus_local.db",
|
||||||
|
description="The URI of the Milvus instance. For example: 'local_data/private_gpt/milvus/milvus_local.db' for Milvus Lite.",
|
||||||
|
)
|
||||||
|
token: str = Field(
|
||||||
|
"",
|
||||||
|
description=(
|
||||||
|
"A valid access token to access the specified Milvus instance. "
|
||||||
|
"This can be used as a recommended alternative to setting user and password separately. "
|
||||||
|
),
|
||||||
|
)
|
||||||
|
collection_name: str = Field(
|
||||||
|
"make_this_parameterizable_per_api_call",
|
||||||
|
description="The name of the collection in Milvus. Default is 'make_this_parameterizable_per_api_call'.",
|
||||||
|
)
|
||||||
|
overwrite: bool = Field(
|
||||||
|
True, description="Overwrite the previous collection schema if it exists."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Settings(BaseModel):
|
class Settings(BaseModel):
|
||||||
server: ServerSettings
|
server: ServerSettings
|
||||||
data: DataSettings
|
data: DataSettings
|
||||||
|
|
@ -413,6 +539,7 @@ class Settings(BaseModel):
|
||||||
huggingface: HuggingFaceSettings
|
huggingface: HuggingFaceSettings
|
||||||
sagemaker: SagemakerSettings
|
sagemaker: SagemakerSettings
|
||||||
openai: OpenAISettings
|
openai: OpenAISettings
|
||||||
|
gemini: GeminiSettings
|
||||||
ollama: OllamaSettings
|
ollama: OllamaSettings
|
||||||
azopenai: AzureOpenAISettings
|
azopenai: AzureOpenAISettings
|
||||||
vectorstore: VectorstoreSettings
|
vectorstore: VectorstoreSettings
|
||||||
|
|
@ -420,6 +547,8 @@ class Settings(BaseModel):
|
||||||
rag: RagSettings
|
rag: RagSettings
|
||||||
qdrant: QdrantSettings | None = None
|
qdrant: QdrantSettings | None = None
|
||||||
postgres: PostgresSettings | None = None
|
postgres: PostgresSettings | None = None
|
||||||
|
clickhouse: ClickHouseSettings | None = None
|
||||||
|
milvus: MilvusSettings | None = None
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -444,6 +444,7 @@ class PrivateGptUi:
|
||||||
"sagemaker": config_settings.sagemaker.llm_endpoint_name,
|
"sagemaker": config_settings.sagemaker.llm_endpoint_name,
|
||||||
"mock": llm_mode,
|
"mock": llm_mode,
|
||||||
"ollama": config_settings.ollama.llm_model,
|
"ollama": config_settings.ollama.llm_model,
|
||||||
|
"gemini": config_settings.gemini.model,
|
||||||
}
|
}
|
||||||
|
|
||||||
if llm_mode not in model_mapping:
|
if llm_mode not in model_mapping:
|
||||||
|
|
|
||||||
|
|
@ -7,45 +7,58 @@ authors = ["Zylon <hi@zylon.ai>"]
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = ">=3.11,<3.12"
|
python = ">=3.11,<3.12"
|
||||||
# PrivateGPT
|
# PrivateGPT
|
||||||
fastapi = { extras = ["all"], version = "^0.110.0" }
|
fastapi = { extras = ["all"], version = "^0.111.0" }
|
||||||
python-multipart = "^0.0.9"
|
python-multipart = "^0.0.9"
|
||||||
injector = "^0.21.0"
|
injector = "^0.21.0"
|
||||||
pyyaml = "^6.0.1"
|
pyyaml = "^6.0.1"
|
||||||
watchdog = "^4.0.0"
|
watchdog = "^4.0.1"
|
||||||
transformers = "^4.38.2"
|
transformers = "^4.42.3"
|
||||||
docx2txt = "^0.8"
|
docx2txt = "^0.8"
|
||||||
cryptography = "^3.1"
|
cryptography = "^3.1"
|
||||||
# LlamaIndex core libs
|
# LlamaIndex core libs
|
||||||
llama-index-core = "^0.10.14"
|
llama-index-core = "^0.10.52"
|
||||||
llama-index-readers-file = "^0.1.6"
|
llama-index-readers-file = "^0.1.27"
|
||||||
# Optional LlamaIndex integration libs
|
# Optional LlamaIndex integration libs
|
||||||
llama-index-llms-llama-cpp = {version = "^0.1.3", optional = true}
|
llama-index-llms-llama-cpp = {version = "^0.1.4", optional = true}
|
||||||
llama-index-llms-openai = {version = "^0.1.6", optional = true}
|
llama-index-llms-openai = {version = "^0.1.25", optional = true}
|
||||||
llama-index-llms-openai-like = {version ="^0.1.3", optional = true}
|
llama-index-llms-openai-like = {version ="^0.1.3", optional = true}
|
||||||
llama-index-llms-ollama = {version ="^0.1.2", optional = true}
|
llama-index-llms-ollama = {version ="^0.1.5", optional = true}
|
||||||
llama-index-llms-azure-openai = {version ="^0.1.5", optional = true}
|
llama-index-llms-azure-openai = {version ="^0.1.8", optional = true}
|
||||||
|
llama-index-llms-gemini = {version ="^0.1.11", optional = true}
|
||||||
llama-index-embeddings-ollama = {version ="^0.1.2", optional = true}
|
llama-index-embeddings-ollama = {version ="^0.1.2", optional = true}
|
||||||
llama-index-embeddings-huggingface = {version ="^0.1.4", optional = true}
|
llama-index-embeddings-huggingface = {version ="^0.2.2", optional = true}
|
||||||
llama-index-embeddings-openai = {version ="^0.1.6", optional = true}
|
llama-index-embeddings-openai = {version ="^0.1.10", optional = true}
|
||||||
llama-index-embeddings-azure-openai = {version ="^0.1.6", optional = true}
|
llama-index-embeddings-azure-openai = {version ="^0.1.10", optional = true}
|
||||||
llama-index-vector-stores-qdrant = {version ="^0.1.3", optional = true}
|
llama-index-embeddings-gemini = {version ="^0.1.8", optional = true}
|
||||||
llama-index-vector-stores-chroma = {version ="^0.1.4", optional = true}
|
llama-index-vector-stores-qdrant = {version ="^0.2.10", optional = true}
|
||||||
llama-index-vector-stores-postgres = {version ="^0.1.2", optional = true}
|
llama-index-vector-stores-milvus = {version ="^0.1.20", optional = true}
|
||||||
llama-index-storage-docstore-postgres = {version ="^0.1.2", optional = true}
|
llama-index-vector-stores-chroma = {version ="^0.1.10", optional = true}
|
||||||
llama-index-storage-index-store-postgres = {version ="^0.1.2", optional = true}
|
llama-index-vector-stores-postgres = {version ="^0.1.11", optional = true}
|
||||||
|
llama-index-vector-stores-clickhouse = {version ="^0.1.3", optional = true}
|
||||||
|
llama-index-storage-docstore-postgres = {version ="^0.1.3", optional = true}
|
||||||
|
llama-index-storage-index-store-postgres = {version ="^0.1.4", optional = true}
|
||||||
# Postgres
|
# Postgres
|
||||||
psycopg2-binary = {version ="^2.9.9", optional = true}
|
psycopg2-binary = {version ="^2.9.9", optional = true}
|
||||||
asyncpg = {version="^0.29.0", optional = true}
|
asyncpg = {version="^0.29.0", optional = true}
|
||||||
|
|
||||||
|
# ClickHouse
|
||||||
|
clickhouse-connect = {version = "^0.7.15", optional = true}
|
||||||
|
|
||||||
# Optional Sagemaker dependency
|
# Optional Sagemaker dependency
|
||||||
boto3 = {version ="^1.34.51", optional = true}
|
boto3 = {version ="^1.34.139", optional = true}
|
||||||
|
|
||||||
|
# Optional Qdrant client
|
||||||
|
qdrant-client = {version ="^1.9.0", optional = true}
|
||||||
|
|
||||||
# Optional Reranker dependencies
|
# Optional Reranker dependencies
|
||||||
torch = {version ="^2.1.2", optional = true}
|
torch = {version ="^2.3.1", optional = true}
|
||||||
sentence-transformers = {version ="^2.6.1", optional = true}
|
sentence-transformers = {version ="^3.0.1", optional = true}
|
||||||
|
|
||||||
# Optional UI
|
# Optional UI
|
||||||
gradio = {version ="^4.19.2", optional = true}
|
gradio = {version ="^4.37.2", optional = true}
|
||||||
|
|
||||||
|
# Optional Google Gemini dependency
|
||||||
|
google-generativeai = {version ="^0.5.4", optional = true}
|
||||||
|
|
||||||
[tool.poetry.extras]
|
[tool.poetry.extras]
|
||||||
ui = ["gradio"]
|
ui = ["gradio"]
|
||||||
|
|
@ -55,14 +68,18 @@ llms-openai-like = ["llama-index-llms-openai-like"]
|
||||||
llms-ollama = ["llama-index-llms-ollama"]
|
llms-ollama = ["llama-index-llms-ollama"]
|
||||||
llms-sagemaker = ["boto3"]
|
llms-sagemaker = ["boto3"]
|
||||||
llms-azopenai = ["llama-index-llms-azure-openai"]
|
llms-azopenai = ["llama-index-llms-azure-openai"]
|
||||||
|
llms-gemini = ["llama-index-llms-gemini", "google-generativeai"]
|
||||||
embeddings-ollama = ["llama-index-embeddings-ollama"]
|
embeddings-ollama = ["llama-index-embeddings-ollama"]
|
||||||
embeddings-huggingface = ["llama-index-embeddings-huggingface"]
|
embeddings-huggingface = ["llama-index-embeddings-huggingface"]
|
||||||
embeddings-openai = ["llama-index-embeddings-openai"]
|
embeddings-openai = ["llama-index-embeddings-openai"]
|
||||||
embeddings-sagemaker = ["boto3"]
|
embeddings-sagemaker = ["boto3"]
|
||||||
embeddings-azopenai = ["llama-index-embeddings-azure-openai"]
|
embeddings-azopenai = ["llama-index-embeddings-azure-openai"]
|
||||||
|
embeddings-gemini = ["llama-index-embeddings-gemini"]
|
||||||
vector-stores-qdrant = ["llama-index-vector-stores-qdrant"]
|
vector-stores-qdrant = ["llama-index-vector-stores-qdrant"]
|
||||||
|
vector-stores-clickhouse = ["llama-index-vector-stores-clickhouse", "clickhouse_connect"]
|
||||||
vector-stores-chroma = ["llama-index-vector-stores-chroma"]
|
vector-stores-chroma = ["llama-index-vector-stores-chroma"]
|
||||||
vector-stores-postgres = ["llama-index-vector-stores-postgres"]
|
vector-stores-postgres = ["llama-index-vector-stores-postgres"]
|
||||||
|
vector-stores-milvus = ["llama-index-vector-stores-milvus"]
|
||||||
storage-nodestore-postgres = ["llama-index-storage-docstore-postgres","llama-index-storage-index-store-postgres","psycopg2-binary","asyncpg"]
|
storage-nodestore-postgres = ["llama-index-storage-docstore-postgres","llama-index-storage-index-store-postgres","psycopg2-binary","asyncpg"]
|
||||||
rerank-sentence-transformers = ["torch", "sentence-transformers"]
|
rerank-sentence-transformers = ["torch", "sentence-transformers"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ snapshot_download(
|
||||||
repo_id=settings().huggingface.embedding_hf_model_name,
|
repo_id=settings().huggingface.embedding_hf_model_name,
|
||||||
cache_dir=models_cache_path,
|
cache_dir=models_cache_path,
|
||||||
local_dir=embedding_path,
|
local_dir=embedding_path,
|
||||||
|
token=settings().huggingface.access_token,
|
||||||
)
|
)
|
||||||
print("Embedding model downloaded!")
|
print("Embedding model downloaded!")
|
||||||
|
|
||||||
|
|
@ -35,15 +36,18 @@ hf_hub_download(
|
||||||
cache_dir=models_cache_path,
|
cache_dir=models_cache_path,
|
||||||
local_dir=models_path,
|
local_dir=models_path,
|
||||||
resume_download=resume_download,
|
resume_download=resume_download,
|
||||||
|
token=settings().huggingface.access_token,
|
||||||
)
|
)
|
||||||
print("LLM model downloaded!")
|
print("LLM model downloaded!")
|
||||||
|
|
||||||
# Download Tokenizer
|
# Download Tokenizer
|
||||||
print(f"Downloading tokenizer {settings().llm.tokenizer}")
|
if settings().llm.tokenizer:
|
||||||
AutoTokenizer.from_pretrained(
|
print(f"Downloading tokenizer {settings().llm.tokenizer}")
|
||||||
pretrained_model_name_or_path=settings().llm.tokenizer,
|
AutoTokenizer.from_pretrained(
|
||||||
cache_dir=models_cache_path,
|
pretrained_model_name_or_path=settings().llm.tokenizer,
|
||||||
)
|
cache_dir=models_cache_path,
|
||||||
print("Tokenizer downloaded!")
|
token=settings().huggingface.access_token,
|
||||||
|
)
|
||||||
|
print("Tokenizer downloaded!")
|
||||||
|
|
||||||
print("Setup done")
|
print("Setup done")
|
||||||
|
|
|
||||||
10
settings-gemini.yaml
Normal file
10
settings-gemini.yaml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
llm:
|
||||||
|
mode: gemini
|
||||||
|
|
||||||
|
embedding:
|
||||||
|
mode: gemini
|
||||||
|
|
||||||
|
gemini:
|
||||||
|
api_key: ${GOOGLE_API_KEY:}
|
||||||
|
model: models/gemini-pro
|
||||||
|
embedding_model: models/embedding-001
|
||||||
|
|
@ -3,6 +3,9 @@ server:
|
||||||
|
|
||||||
llm:
|
llm:
|
||||||
mode: openailike
|
mode: openailike
|
||||||
|
max_new_tokens: 512
|
||||||
|
tokenizer: mistralai/Mistral-7B-Instruct-v0.2
|
||||||
|
temperature: 0.1
|
||||||
|
|
||||||
embedding:
|
embedding:
|
||||||
mode: huggingface
|
mode: huggingface
|
||||||
|
|
@ -15,3 +18,4 @@ openai:
|
||||||
api_base: http://localhost:8000/v1
|
api_base: http://localhost:8000/v1
|
||||||
api_key: EMPTY
|
api_key: EMPTY
|
||||||
model: facebook/opt-125m
|
model: facebook/opt-125m
|
||||||
|
request_timeout: 600.0
|
||||||
|
|
@ -5,7 +5,7 @@ server:
|
||||||
env_name: ${APP_ENV:prod}
|
env_name: ${APP_ENV:prod}
|
||||||
port: ${PORT:8001}
|
port: ${PORT:8001}
|
||||||
cors:
|
cors:
|
||||||
enabled: false
|
enabled: true
|
||||||
allow_origins: ["*"]
|
allow_origins: ["*"]
|
||||||
allow_methods: ["*"]
|
allow_methods: ["*"]
|
||||||
allow_headers: ["*"]
|
allow_headers: ["*"]
|
||||||
|
|
@ -40,7 +40,8 @@ llm:
|
||||||
# Should be matching the selected model
|
# Should be matching the selected model
|
||||||
max_new_tokens: 512
|
max_new_tokens: 512
|
||||||
context_window: 3900
|
context_window: 3900
|
||||||
tokenizer: mistralai/Mistral-7B-Instruct-v0.2
|
# Select your tokenizer. Llama-index tokenizer is the default.
|
||||||
|
# tokenizer: mistralai/Mistral-7B-Instruct-v0.2
|
||||||
temperature: 0.1 # The temperature of the model. Increasing the temperature will make the model answer more creatively. A value of 0.1 would be more factual. (Default: 0.1)
|
temperature: 0.1 # The temperature of the model. Increasing the temperature will make the model answer more creatively. A value of 0.1 would be more factual. (Default: 0.1)
|
||||||
|
|
||||||
rag:
|
rag:
|
||||||
|
|
@ -53,6 +54,13 @@ rag:
|
||||||
model: cross-encoder/ms-marco-MiniLM-L-2-v2
|
model: cross-encoder/ms-marco-MiniLM-L-2-v2
|
||||||
top_n: 1
|
top_n: 1
|
||||||
|
|
||||||
|
clickhouse:
|
||||||
|
host: localhost
|
||||||
|
port: 8443
|
||||||
|
username: admin
|
||||||
|
password: clickhouse
|
||||||
|
database: embeddings
|
||||||
|
|
||||||
llamacpp:
|
llamacpp:
|
||||||
llm_hf_repo_id: TheBloke/Mistral-7B-Instruct-v0.2-GGUF
|
llm_hf_repo_id: TheBloke/Mistral-7B-Instruct-v0.2-GGUF
|
||||||
llm_hf_model_file: mistral-7b-instruct-v0.2.Q4_K_M.gguf
|
llm_hf_model_file: mistral-7b-instruct-v0.2.Q4_K_M.gguf
|
||||||
|
|
@ -69,7 +77,7 @@ embedding:
|
||||||
|
|
||||||
huggingface:
|
huggingface:
|
||||||
embedding_hf_model_name: BAAI/bge-small-en-v1.5
|
embedding_hf_model_name: BAAI/bge-small-en-v1.5
|
||||||
access_token: ${HUGGINGFACE_TOKEN:}
|
access_token: ${HF_TOKEN:}
|
||||||
|
|
||||||
vectorstore:
|
vectorstore:
|
||||||
database: qdrant
|
database: qdrant
|
||||||
|
|
@ -77,6 +85,11 @@ vectorstore:
|
||||||
nodestore:
|
nodestore:
|
||||||
database: simple
|
database: simple
|
||||||
|
|
||||||
|
milvus:
|
||||||
|
uri: local_data/private_gpt/milvus/milvus_local.db
|
||||||
|
collection_name: milvus_db
|
||||||
|
overwrite: false
|
||||||
|
|
||||||
qdrant:
|
qdrant:
|
||||||
path: local_data/private_gpt/qdrant
|
path: local_data/private_gpt/qdrant
|
||||||
|
|
||||||
|
|
@ -95,6 +108,7 @@ sagemaker:
|
||||||
openai:
|
openai:
|
||||||
api_key: ${OPENAI_API_KEY:}
|
api_key: ${OPENAI_API_KEY:}
|
||||||
model: gpt-3.5-turbo
|
model: gpt-3.5-turbo
|
||||||
|
embedding_api_key: ${OPENAI_API_KEY:}
|
||||||
|
|
||||||
ollama:
|
ollama:
|
||||||
llm_model: llama2
|
llm_model: llama2
|
||||||
|
|
@ -112,3 +126,8 @@ azopenai:
|
||||||
api_version: "2023-05-15"
|
api_version: "2023-05-15"
|
||||||
embedding_model: text-embedding-ada-002
|
embedding_model: text-embedding-ada-002
|
||||||
llm_model: gpt-35-turbo
|
llm_model: gpt-35-turbo
|
||||||
|
|
||||||
|
gemini:
|
||||||
|
api_key: ${GOOGLE_API_KEY:}
|
||||||
|
model: models/gemini-pro
|
||||||
|
embedding_model: models/embedding-001
|
||||||
|
|
|
||||||
|
|
@ -69,17 +69,21 @@ def test_tag_prompt_style_format_with_system_prompt():
|
||||||
def test_mistral_prompt_style_format():
|
def test_mistral_prompt_style_format():
|
||||||
prompt_style = MistralPromptStyle()
|
prompt_style = MistralPromptStyle()
|
||||||
messages = [
|
messages = [
|
||||||
ChatMessage(content="You are an AI assistant.", role=MessageRole.SYSTEM),
|
ChatMessage(content="A", role=MessageRole.SYSTEM),
|
||||||
ChatMessage(content="Hello, how are you doing?", role=MessageRole.USER),
|
ChatMessage(content="B", role=MessageRole.USER),
|
||||||
]
|
]
|
||||||
|
expected_prompt = "<s>[INST] A\nB [/INST]"
|
||||||
expected_prompt = (
|
|
||||||
"<s>[INST] You are an AI assistant. [/INST]</s>"
|
|
||||||
"[INST] Hello, how are you doing? [/INST]"
|
|
||||||
)
|
|
||||||
|
|
||||||
assert prompt_style.messages_to_prompt(messages) == expected_prompt
|
assert prompt_style.messages_to_prompt(messages) == expected_prompt
|
||||||
|
|
||||||
|
messages2 = [
|
||||||
|
ChatMessage(content="A", role=MessageRole.SYSTEM),
|
||||||
|
ChatMessage(content="B", role=MessageRole.USER),
|
||||||
|
ChatMessage(content="C", role=MessageRole.ASSISTANT),
|
||||||
|
ChatMessage(content="D", role=MessageRole.USER),
|
||||||
|
]
|
||||||
|
expected_prompt2 = "<s>[INST] A\nB [/INST] C</s><s>[INST] D [/INST]"
|
||||||
|
assert prompt_style.messages_to_prompt(messages2) == expected_prompt2
|
||||||
|
|
||||||
|
|
||||||
def test_chatml_prompt_style_format():
|
def test_chatml_prompt_style_format():
|
||||||
prompt_style = ChatMLPromptStyle()
|
prompt_style = ChatMLPromptStyle()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue