mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 17:05:41 +01:00
Compare commits
No commits in common. "main" and "v0.6.2" have entirely different histories.
25 changed files with 2451 additions and 2972 deletions
6
.github/workflows/tests.yml
vendored
6
.github/workflows/tests.yml
vendored
|
|
@ -14,7 +14,7 @@ jobs:
|
||||||
setup:
|
setup:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: ./.github/workflows/actions/install_dependencies
|
- uses: ./.github/workflows/actions/install_dependencies
|
||||||
|
|
||||||
checks:
|
checks:
|
||||||
|
|
@ -28,7 +28,7 @@ jobs:
|
||||||
- ruff
|
- ruff
|
||||||
- mypy
|
- mypy
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: ./.github/workflows/actions/install_dependencies
|
- uses: ./.github/workflows/actions/install_dependencies
|
||||||
- name: run ${{ matrix.quality-command }}
|
- name: run ${{ matrix.quality-command }}
|
||||||
run: make ${{ matrix.quality-command }}
|
run: make ${{ matrix.quality-command }}
|
||||||
|
|
@ -38,7 +38,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: test
|
name: test
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v3
|
||||||
- uses: ./.github/workflows/actions/install_dependencies
|
- uses: ./.github/workflows/actions/install_dependencies
|
||||||
- name: run test
|
- name: run test
|
||||||
run: make test-coverage
|
run: make test-coverage
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
### IMPORTANT, THIS IMAGE CAN ONLY BE RUN IN LINUX DOCKER
|
### IMPORTANT, THIS IMAGE CAN ONLY BE RUN IN LINUX DOCKER
|
||||||
### You will run into a segfault in mac
|
### You will run into a segfault in mac
|
||||||
FROM python:3.11.6-slim-bookworm AS base
|
FROM python:3.11.6-slim-bookworm as base
|
||||||
|
|
||||||
# Install poetry
|
# Install poetry
|
||||||
RUN pip install pipx
|
RUN pip install pipx
|
||||||
|
|
@ -20,14 +20,14 @@ RUN apt update && apt install -y \
|
||||||
# https://python-poetry.org/docs/configuration/#virtualenvsin-project
|
# https://python-poetry.org/docs/configuration/#virtualenvsin-project
|
||||||
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
|
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
|
||||||
|
|
||||||
FROM base AS dependencies
|
FROM base as dependencies
|
||||||
WORKDIR /home/worker/app
|
WORKDIR /home/worker/app
|
||||||
COPY pyproject.toml poetry.lock ./
|
COPY pyproject.toml poetry.lock ./
|
||||||
|
|
||||||
ARG POETRY_EXTRAS="ui embeddings-huggingface llms-llama-cpp vector-stores-qdrant"
|
ARG POETRY_EXTRAS="ui embeddings-huggingface llms-llama-cpp vector-stores-qdrant"
|
||||||
RUN poetry install --no-root --extras "${POETRY_EXTRAS}"
|
RUN poetry install --no-root --extras "${POETRY_EXTRAS}"
|
||||||
|
|
||||||
FROM base AS app
|
FROM base as app
|
||||||
|
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
ENV PORT=8080
|
ENV PORT=8080
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
FROM python:3.11.6-slim-bookworm AS base
|
FROM python:3.11.6-slim-bookworm as base
|
||||||
|
|
||||||
# Install poetry
|
# Install poetry
|
||||||
RUN pip install pipx
|
RUN pip install pipx
|
||||||
|
|
@ -10,14 +10,14 @@ ENV PATH=".venv/bin/:$PATH"
|
||||||
# https://python-poetry.org/docs/configuration/#virtualenvsin-project
|
# https://python-poetry.org/docs/configuration/#virtualenvsin-project
|
||||||
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
|
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
|
||||||
|
|
||||||
FROM base AS dependencies
|
FROM base as dependencies
|
||||||
WORKDIR /home/worker/app
|
WORKDIR /home/worker/app
|
||||||
COPY pyproject.toml poetry.lock ./
|
COPY pyproject.toml poetry.lock ./
|
||||||
|
|
||||||
ARG POETRY_EXTRAS="ui vector-stores-qdrant llms-ollama embeddings-ollama"
|
ARG POETRY_EXTRAS="ui vector-stores-qdrant llms-ollama embeddings-ollama"
|
||||||
RUN poetry install --no-root --extras "${POETRY_EXTRAS}"
|
RUN poetry install --no-root --extras "${POETRY_EXTRAS}"
|
||||||
|
|
||||||
FROM base AS app
|
FROM base as app
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
ENV PORT=8080
|
ENV PORT=8080
|
||||||
ENV APP_ENV=prod
|
ENV APP_ENV=prod
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
# PrivateGPT
|
# 🔒 PrivateGPT 📑
|
||||||
|
|
||||||
<a href="https://trendshift.io/repositories/2601" target="_blank"><img src="https://trendshift.io/api/badge/repositories/2601" alt="imartinez%2FprivateGPT | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
|
||||||
|
|
||||||
[](https://github.com/zylon-ai/private-gpt/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/)
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,12 @@ services:
|
||||||
# Private-GPT service for the Ollama CPU and GPU modes
|
# Private-GPT service for the Ollama CPU and GPU modes
|
||||||
# This service builds from an external Dockerfile and runs the Ollama mode.
|
# This service builds from an external Dockerfile and runs the Ollama mode.
|
||||||
private-gpt-ollama:
|
private-gpt-ollama:
|
||||||
image: ${PGPT_IMAGE:-zylonai/private-gpt}:${PGPT_TAG:-0.6.2}-ollama # x-release-please-version
|
image: ${PGPT_IMAGE:-zylonai/private-gpt}${PGPT_TAG:-0.6.2}-ollama # x-release-please-version
|
||||||
user: root
|
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.ollama
|
dockerfile: Dockerfile.ollama
|
||||||
volumes:
|
volumes:
|
||||||
- ./local_data:/home/worker/app/local_data
|
- ./local_data/:/home/worker/app/local_data
|
||||||
ports:
|
ports:
|
||||||
- "8001:8001"
|
- "8001:8001"
|
||||||
environment:
|
environment:
|
||||||
|
|
@ -28,15 +27,11 @@ services:
|
||||||
- ollama-cpu
|
- ollama-cpu
|
||||||
- ollama-cuda
|
- ollama-cuda
|
||||||
- ollama-api
|
- ollama-api
|
||||||
depends_on:
|
|
||||||
ollama:
|
|
||||||
condition: service_healthy
|
|
||||||
|
|
||||||
# Private-GPT service for the local mode
|
# Private-GPT service for the local mode
|
||||||
# This service builds from a local Dockerfile and runs the application in local mode.
|
# This service builds from a local Dockerfile and runs the application in local mode.
|
||||||
private-gpt-llamacpp-cpu:
|
private-gpt-llamacpp-cpu:
|
||||||
image: ${PGPT_IMAGE:-zylonai/private-gpt}:${PGPT_TAG:-0.6.2}-llamacpp-cpu # x-release-please-version
|
image: ${PGPT_IMAGE:-zylonai/private-gpt}${PGPT_TAG:-0.6.2}-llamacpp-cpu # x-release-please-version
|
||||||
user: root
|
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.llamacpp-cpu
|
dockerfile: Dockerfile.llamacpp-cpu
|
||||||
|
|
@ -49,7 +44,7 @@ services:
|
||||||
environment:
|
environment:
|
||||||
PORT: 8001
|
PORT: 8001
|
||||||
PGPT_PROFILES: local
|
PGPT_PROFILES: local
|
||||||
HF_TOKEN: ${HF_TOKEN:-}
|
HF_TOKEN: ${HF_TOKEN}
|
||||||
profiles:
|
profiles:
|
||||||
- llamacpp-cpu
|
- llamacpp-cpu
|
||||||
|
|
||||||
|
|
@ -61,14 +56,9 @@ services:
|
||||||
# This will route requests to the Ollama service based on the profile.
|
# This will route requests to the Ollama service based on the profile.
|
||||||
ollama:
|
ollama:
|
||||||
image: traefik:v2.10
|
image: traefik:v2.10
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "sh", "-c", "wget -q --spider http://ollama:11434 || exit 1"]
|
|
||||||
interval: 10s
|
|
||||||
retries: 3
|
|
||||||
start_period: 5s
|
|
||||||
timeout: 5s
|
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "11435:11434"
|
||||||
|
- "8081:8080"
|
||||||
command:
|
command:
|
||||||
- "--providers.file.filename=/etc/router.yml"
|
- "--providers.file.filename=/etc/router.yml"
|
||||||
- "--log.level=ERROR"
|
- "--log.level=ERROR"
|
||||||
|
|
@ -90,19 +80,15 @@ services:
|
||||||
# Ollama service for the CPU mode
|
# Ollama service for the CPU mode
|
||||||
ollama-cpu:
|
ollama-cpu:
|
||||||
image: ollama/ollama:latest
|
image: ollama/ollama:latest
|
||||||
ports:
|
|
||||||
- "11434:11434"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./models:/root/.ollama
|
- ./models:/root/.ollama
|
||||||
profiles:
|
profiles:
|
||||||
- ""
|
- ""
|
||||||
- ollama-cpu
|
- ollama
|
||||||
|
|
||||||
# Ollama service for the CUDA mode
|
# Ollama service for the CUDA mode
|
||||||
ollama-cuda:
|
ollama-cuda:
|
||||||
image: ollama/ollama:latest
|
image: ollama/ollama:latest
|
||||||
ports:
|
|
||||||
- "11434:11434"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./models:/root/.ollama
|
- ./models:/root/.ollama
|
||||||
deploy:
|
deploy:
|
||||||
|
|
@ -113,4 +99,4 @@ services:
|
||||||
count: 1
|
count: 1
|
||||||
capabilities: [gpu]
|
capabilities: [gpu]
|
||||||
profiles:
|
profiles:
|
||||||
- ollama-cuda
|
- ollama-cuda
|
||||||
5068
poetry.lock
generated
5068
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -144,23 +144,6 @@ class EmbeddingComponent:
|
||||||
api_key=settings.gemini.api_key,
|
api_key=settings.gemini.api_key,
|
||||||
model_name=settings.gemini.embedding_model,
|
model_name=settings.gemini.embedding_model,
|
||||||
)
|
)
|
||||||
case "mistralai":
|
|
||||||
try:
|
|
||||||
from llama_index.embeddings.mistralai import ( # type: ignore
|
|
||||||
MistralAIEmbedding,
|
|
||||||
)
|
|
||||||
except ImportError as e:
|
|
||||||
raise ImportError(
|
|
||||||
"Mistral dependencies not found, install with `poetry install --extras embeddings-mistral`"
|
|
||||||
) from e
|
|
||||||
|
|
||||||
api_key = settings.openai.api_key
|
|
||||||
model = settings.openai.embedding_model
|
|
||||||
|
|
||||||
self.embedding_model = MistralAIEmbedding(
|
|
||||||
api_key=api_key,
|
|
||||||
model=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
|
||||||
|
|
|
||||||
|
|
@ -403,7 +403,7 @@ class PipelineIngestComponent(BaseIngestComponentWithIndex):
|
||||||
self.transformations,
|
self.transformations,
|
||||||
show_progress=self.show_progress,
|
show_progress=self.show_progress,
|
||||||
)
|
)
|
||||||
self.node_q.put(("process", file_name, documents, list(nodes)))
|
self.node_q.put(("process", file_name, documents, nodes))
|
||||||
finally:
|
finally:
|
||||||
self.doc_semaphore.release()
|
self.doc_semaphore.release()
|
||||||
self.doc_q.task_done() # unblock Q joins
|
self.doc_q.task_done() # unblock Q joins
|
||||||
|
|
|
||||||
|
|
@ -92,13 +92,7 @@ class IngestionHelper:
|
||||||
return string_reader.load_data([file_data.read_text()])
|
return string_reader.load_data([file_data.read_text()])
|
||||||
|
|
||||||
logger.debug("Specific reader found for extension=%s", extension)
|
logger.debug("Specific reader found for extension=%s", extension)
|
||||||
documents = reader_cls().load_data(file_data)
|
return reader_cls().load_data(file_data)
|
||||||
|
|
||||||
# Sanitize NUL bytes in text which can't be stored in Postgres
|
|
||||||
for i in range(len(documents)):
|
|
||||||
documents[i].text = documents[i].text.replace("\u0000", "")
|
|
||||||
|
|
||||||
return documents
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _exclude_metadata(documents: list[Document]) -> None:
|
def _exclude_metadata(documents: list[Document]) -> None:
|
||||||
|
|
|
||||||
|
|
@ -120,6 +120,7 @@ class LLMComponent:
|
||||||
api_version="",
|
api_version="",
|
||||||
temperature=settings.llm.temperature,
|
temperature=settings.llm.temperature,
|
||||||
context_window=settings.llm.context_window,
|
context_window=settings.llm.context_window,
|
||||||
|
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,
|
tokenizer=settings.llm.tokenizer,
|
||||||
|
|
@ -183,10 +184,10 @@ class LLMComponent:
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
Ollama.chat = add_keep_alive(Ollama.chat) # type: ignore
|
Ollama.chat = add_keep_alive(Ollama.chat)
|
||||||
Ollama.stream_chat = add_keep_alive(Ollama.stream_chat) # type: ignore
|
Ollama.stream_chat = add_keep_alive(Ollama.stream_chat)
|
||||||
Ollama.complete = add_keep_alive(Ollama.complete) # type: ignore
|
Ollama.complete = add_keep_alive(Ollama.complete)
|
||||||
Ollama.stream_complete = add_keep_alive(Ollama.stream_complete) # type: ignore
|
Ollama.stream_complete = add_keep_alive(Ollama.stream_complete)
|
||||||
|
|
||||||
self.llm = llm
|
self.llm = llm
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,7 @@ class AbstractPromptStyle(abc.ABC):
|
||||||
logger.debug("Got for messages='%s' the prompt='%s'", messages, prompt)
|
logger.debug("Got for messages='%s' the prompt='%s'", messages, prompt)
|
||||||
return prompt
|
return prompt
|
||||||
|
|
||||||
def completion_to_prompt(self, prompt: str) -> str:
|
def completion_to_prompt(self, completion: str) -> str:
|
||||||
completion = prompt # Fix: Llama-index parameter has to be named as prompt
|
|
||||||
prompt = self._completion_to_prompt(completion)
|
prompt = self._completion_to_prompt(completion)
|
||||||
logger.debug("Got for completion='%s' the prompt='%s'", completion, prompt)
|
logger.debug("Got for completion='%s' the prompt='%s'", completion, prompt)
|
||||||
return prompt
|
return prompt
|
||||||
|
|
@ -286,9 +285,8 @@ class ChatMLPromptStyle(AbstractPromptStyle):
|
||||||
|
|
||||||
|
|
||||||
def get_prompt_style(
|
def get_prompt_style(
|
||||||
prompt_style: (
|
prompt_style: Literal["default", "llama2", "llama3", "tag", "mistral", "chatml"]
|
||||||
Literal["default", "llama2", "llama3", "tag", "mistral", "chatml"] | None
|
| None
|
||||||
)
|
|
||||||
) -> AbstractPromptStyle:
|
) -> AbstractPromptStyle:
|
||||||
"""Get the prompt style to use from the given string.
|
"""Get the prompt style to use from the given string.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,10 @@ class NodeStoreComponent:
|
||||||
|
|
||||||
case "postgres":
|
case "postgres":
|
||||||
try:
|
try:
|
||||||
from llama_index.storage.docstore.postgres import ( # type: ignore
|
from llama_index.core.storage.docstore.postgres_docstore import (
|
||||||
PostgresDocumentStore,
|
PostgresDocumentStore,
|
||||||
)
|
)
|
||||||
from llama_index.storage.index_store.postgres import ( # type: ignore
|
from llama_index.core.storage.index_store.postgres_index_store import (
|
||||||
PostgresIndexStore,
|
PostgresIndexStore,
|
||||||
)
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
@ -55,7 +55,6 @@ class NodeStoreComponent:
|
||||||
self.index_store = PostgresIndexStore.from_params(
|
self.index_store = PostgresIndexStore.from_params(
|
||||||
**settings.postgres.model_dump(exclude_none=True)
|
**settings.postgres.model_dump(exclude_none=True)
|
||||||
)
|
)
|
||||||
|
|
||||||
self.doc_store = PostgresDocumentStore.from_params(
|
self.doc_store = PostgresDocumentStore.from_params(
|
||||||
**settings.postgres.model_dump(exclude_none=True)
|
**settings.postgres.model_dump(exclude_none=True)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,14 @@
|
||||||
from collections.abc import Generator, Sequence
|
from collections.abc import Generator
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import Any
|
||||||
|
|
||||||
from llama_index.core.schema import BaseNode, MetadataMode
|
from llama_index.core.schema import BaseNode, MetadataMode
|
||||||
from llama_index.core.vector_stores.utils import node_to_metadata_dict
|
from llama_index.core.vector_stores.utils import node_to_metadata_dict
|
||||||
from llama_index.vector_stores.chroma import ChromaVectorStore # type: ignore
|
from llama_index.vector_stores.chroma import ChromaVectorStore # type: ignore
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from collections.abc import Mapping
|
|
||||||
|
|
||||||
|
|
||||||
def chunk_list(
|
def chunk_list(
|
||||||
lst: Sequence[BaseNode], max_chunk_size: int
|
lst: list[BaseNode], max_chunk_size: int
|
||||||
) -> Generator[Sequence[BaseNode], None, None]:
|
) -> Generator[list[BaseNode], None, None]:
|
||||||
"""Yield successive max_chunk_size-sized chunks from lst.
|
"""Yield successive max_chunk_size-sized chunks from lst.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|
@ -63,7 +60,7 @@ class BatchedChromaVectorStore(ChromaVectorStore): # type: ignore
|
||||||
)
|
)
|
||||||
self.chroma_client = chroma_client
|
self.chroma_client = chroma_client
|
||||||
|
|
||||||
def add(self, nodes: Sequence[BaseNode], **add_kwargs: Any) -> list[str]:
|
def add(self, nodes: list[BaseNode], **add_kwargs: Any) -> list[str]:
|
||||||
"""Add nodes to index, batching the insertion to avoid issues.
|
"""Add nodes to index, batching the insertion to avoid issues.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
|
@ -81,8 +78,8 @@ class BatchedChromaVectorStore(ChromaVectorStore): # type: ignore
|
||||||
|
|
||||||
all_ids = []
|
all_ids = []
|
||||||
for node_chunk in node_chunks:
|
for node_chunk in node_chunks:
|
||||||
embeddings: list[Sequence[float]] = []
|
embeddings = []
|
||||||
metadatas: list[Mapping[str, Any]] = []
|
metadatas = []
|
||||||
ids = []
|
ids = []
|
||||||
documents = []
|
documents = []
|
||||||
for node in node_chunk:
|
for node in node_chunk:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
from injector import inject, singleton
|
from injector import inject, singleton
|
||||||
from llama_index.core.chat_engine import ContextChatEngine, SimpleChatEngine
|
from llama_index.core.chat_engine import ContextChatEngine, SimpleChatEngine
|
||||||
|
|
@ -27,9 +26,6 @@ from private_gpt.open_ai.extensions.context_filter import ContextFilter
|
||||||
from private_gpt.server.chunks.chunks_service import Chunk
|
from private_gpt.server.chunks.chunks_service import Chunk
|
||||||
from private_gpt.settings.settings import Settings
|
from private_gpt.settings.settings import Settings
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from llama_index.core.postprocessor.types import BaseNodePostprocessor
|
|
||||||
|
|
||||||
|
|
||||||
class Completion(BaseModel):
|
class Completion(BaseModel):
|
||||||
response: str
|
response: str
|
||||||
|
|
@ -118,15 +114,12 @@ class ChatService:
|
||||||
context_filter=context_filter,
|
context_filter=context_filter,
|
||||||
similarity_top_k=self.settings.rag.similarity_top_k,
|
similarity_top_k=self.settings.rag.similarity_top_k,
|
||||||
)
|
)
|
||||||
node_postprocessors: list[BaseNodePostprocessor] = [
|
node_postprocessors = [
|
||||||
MetadataReplacementPostProcessor(target_metadata_key="window"),
|
MetadataReplacementPostProcessor(target_metadata_key="window"),
|
||||||
|
SimilarityPostprocessor(
|
||||||
|
similarity_cutoff=settings.rag.similarity_value
|
||||||
|
),
|
||||||
]
|
]
|
||||||
if settings.rag.similarity_value:
|
|
||||||
node_postprocessors.append(
|
|
||||||
SimilarityPostprocessor(
|
|
||||||
similarity_cutoff=settings.rag.similarity_value
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
if settings.rag.rerank.enabled:
|
if settings.rag.rerank.enabled:
|
||||||
rerank_postprocessor = SentenceTransformerRerank(
|
rerank_postprocessor = SentenceTransformerRerank(
|
||||||
|
|
|
||||||
|
|
@ -90,9 +90,9 @@ class SummarizeService:
|
||||||
# Add context documents to summarize
|
# Add context documents to summarize
|
||||||
if use_context:
|
if use_context:
|
||||||
# 1. Recover all ref docs
|
# 1. Recover all ref docs
|
||||||
ref_docs: dict[str, RefDocInfo] | None = (
|
ref_docs: dict[
|
||||||
self.storage_context.docstore.get_all_ref_doc_info()
|
str, RefDocInfo
|
||||||
)
|
] | None = self.storage_context.docstore.get_all_ref_doc_info()
|
||||||
if ref_docs is None:
|
if ref_docs is None:
|
||||||
raise ValueError("No documents have been ingested yet.")
|
raise ValueError("No documents have been ingested yet.")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,19 +136,19 @@ class LLMSettings(BaseModel):
|
||||||
0.1,
|
0.1,
|
||||||
description="The temperature of the model. Increasing the temperature will make the model answer more creatively. A value of 0.1 would be more factual.",
|
description="The temperature of the model. Increasing the temperature will make the model answer more creatively. A value of 0.1 would be more factual.",
|
||||||
)
|
)
|
||||||
prompt_style: Literal["default", "llama2", "llama3", "tag", "mistral", "chatml"] = (
|
prompt_style: Literal[
|
||||||
Field(
|
"default", "llama2", "llama3", "tag", "mistral", "chatml"
|
||||||
"llama2",
|
] = Field(
|
||||||
description=(
|
"llama2",
|
||||||
"The prompt style to use for the chat engine. "
|
description=(
|
||||||
"If `default` - use the default prompt style from the llama_index. It should look like `role: message`.\n"
|
"The prompt style to use for the chat engine. "
|
||||||
"If `llama2` - use the llama2 prompt style from the llama_index. Based on `<s>`, `[INST]` and `<<SYS>>`.\n"
|
"If `default` - use the default prompt style from the llama_index. It should look like `role: message`.\n"
|
||||||
"If `llama3` - use the llama3 prompt style from the llama_index."
|
"If `llama2` - use the llama2 prompt style from the llama_index. Based on `<s>`, `[INST]` and `<<SYS>>`.\n"
|
||||||
"If `tag` - use the `tag` prompt style. It should look like `<|role|>: message`. \n"
|
"If `llama3` - use the llama3 prompt style from the llama_index."
|
||||||
"If `mistral` - use the `mistral prompt style. It shoudl look like <s>[INST] {System Prompt} [/INST]</s>[INST] { UserInstructions } [/INST]"
|
"If `tag` - use the `tag` prompt style. It should look like `<|role|>: message`. \n"
|
||||||
"`llama2` is the historic behaviour. `default` might work better with your custom models."
|
"If `mistral` - use the `mistral prompt style. It shoudl look like <s>[INST] {System Prompt} [/INST]</s>[INST] { UserInstructions } [/INST]"
|
||||||
),
|
"`llama2` is the historic behaviour. `default` might work better with your custom models."
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -197,14 +197,7 @@ class HuggingFaceSettings(BaseModel):
|
||||||
|
|
||||||
class EmbeddingSettings(BaseModel):
|
class EmbeddingSettings(BaseModel):
|
||||||
mode: Literal[
|
mode: Literal[
|
||||||
"huggingface",
|
"huggingface", "openai", "azopenai", "sagemaker", "ollama", "mock", "gemini"
|
||||||
"openai",
|
|
||||||
"azopenai",
|
|
||||||
"sagemaker",
|
|
||||||
"ollama",
|
|
||||||
"mock",
|
|
||||||
"gemini",
|
|
||||||
"mistralai",
|
|
||||||
]
|
]
|
||||||
ingest_mode: Literal["simple", "batch", "parallel", "pipeline"] = Field(
|
ingest_mode: Literal["simple", "batch", "parallel", "pipeline"] = Field(
|
||||||
"simple",
|
"simple",
|
||||||
|
|
@ -357,10 +350,6 @@ class AzureOpenAISettings(BaseModel):
|
||||||
class UISettings(BaseModel):
|
class UISettings(BaseModel):
|
||||||
enabled: bool
|
enabled: bool
|
||||||
path: str
|
path: str
|
||||||
default_mode: Literal["RAG", "Search", "Basic", "Summarize"] = Field(
|
|
||||||
"RAG",
|
|
||||||
description="The default mode.",
|
|
||||||
)
|
|
||||||
default_chat_system_prompt: str = Field(
|
default_chat_system_prompt: str = Field(
|
||||||
None,
|
None,
|
||||||
description="The default system prompt to use for the chat mode.",
|
description="The default system prompt to use for the chat mode.",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
"""This file should be imported if and only if you want to run the UI locally."""
|
"""This file should be imported if and only if you want to run the UI locally."""
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
|
@ -100,11 +99,8 @@ class PrivateGptUi:
|
||||||
self._selected_filename = None
|
self._selected_filename = None
|
||||||
|
|
||||||
# Initialize system prompt based on default mode
|
# Initialize system prompt based on default mode
|
||||||
default_mode_map = {mode.value: mode for mode in Modes}
|
self.mode = MODES[0]
|
||||||
self._default_mode = default_mode_map.get(
|
self._system_prompt = self._get_default_system_prompt(self.mode)
|
||||||
settings().ui.default_mode, Modes.RAG_MODE
|
|
||||||
)
|
|
||||||
self._system_prompt = self._get_default_system_prompt(self._default_mode)
|
|
||||||
|
|
||||||
def _chat(
|
def _chat(
|
||||||
self, message: str, history: list[list[str]], mode: Modes, *_: Any
|
self, message: str, history: list[list[str]], mode: Modes, *_: Any
|
||||||
|
|
@ -394,7 +390,7 @@ class PrivateGptUi:
|
||||||
|
|
||||||
with gr.Row(equal_height=False):
|
with gr.Row(equal_height=False):
|
||||||
with gr.Column(scale=3):
|
with gr.Column(scale=3):
|
||||||
default_mode = self._default_mode
|
default_mode = MODES[0]
|
||||||
mode = gr.Radio(
|
mode = gr.Radio(
|
||||||
[mode.value for mode in MODES],
|
[mode.value for mode in MODES],
|
||||||
label="Mode",
|
label="Mode",
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,10 @@ from collections import deque
|
||||||
from collections.abc import Iterator, Mapping
|
from collections.abc import Iterator, Mapping
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from httpx import ConnectError
|
|
||||||
from tqdm import tqdm # type: ignore
|
from tqdm import tqdm # type: ignore
|
||||||
|
|
||||||
from private_gpt.utils.retry import retry
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ollama import Client, ResponseError # type: ignore
|
from ollama import Client # type: ignore
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
"Ollama dependencies not found, install with `poetry install --extras llms-ollama or embeddings-ollama`"
|
"Ollama dependencies not found, install with `poetry install --extras llms-ollama or embeddings-ollama`"
|
||||||
|
|
@ -17,25 +14,13 @@ except ImportError as e:
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
_MAX_RETRIES = 5
|
|
||||||
_JITTER = (3.0, 10.0)
|
|
||||||
|
|
||||||
|
|
||||||
@retry(
|
|
||||||
is_async=False,
|
|
||||||
exceptions=(ConnectError, ResponseError),
|
|
||||||
tries=_MAX_RETRIES,
|
|
||||||
jitter=_JITTER,
|
|
||||||
logger=logger,
|
|
||||||
)
|
|
||||||
def check_connection(client: Client) -> bool:
|
def check_connection(client: Client) -> bool:
|
||||||
try:
|
try:
|
||||||
client.list()
|
client.list()
|
||||||
return True
|
return True
|
||||||
except (ConnectError, ResponseError) as e:
|
|
||||||
raise e
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to connect to Ollama: {type(e).__name__}: {e!s}")
|
logger.error(f"Failed to connect to Ollama: {e!s}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
import logging
|
|
||||||
from collections.abc import Callable
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from retry_async import retry as retry_untyped # type: ignore
|
|
||||||
|
|
||||||
retry_logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
def retry(
|
|
||||||
exceptions: Any = Exception,
|
|
||||||
*,
|
|
||||||
is_async: bool = False,
|
|
||||||
tries: int = -1,
|
|
||||||
delay: float = 0,
|
|
||||||
max_delay: float | None = None,
|
|
||||||
backoff: float = 1,
|
|
||||||
jitter: float | tuple[float, float] = 0,
|
|
||||||
logger: logging.Logger = retry_logger,
|
|
||||||
) -> Callable[..., Any]:
|
|
||||||
wrapped = retry_untyped(
|
|
||||||
exceptions=exceptions,
|
|
||||||
is_async=is_async,
|
|
||||||
tries=tries,
|
|
||||||
delay=delay,
|
|
||||||
max_delay=max_delay,
|
|
||||||
backoff=backoff,
|
|
||||||
jitter=jitter,
|
|
||||||
logger=logger,
|
|
||||||
)
|
|
||||||
return wrapped # type: ignore
|
|
||||||
|
|
@ -7,75 +7,82 @@ 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.115.0" }
|
fastapi = { extras = ["all"], version = "^0.111.0" }
|
||||||
python-multipart = "^0.0.10"
|
python-multipart = "^0.0.9"
|
||||||
injector = "^0.22.0"
|
injector = "^0.21.0"
|
||||||
pyyaml = "^6.0.2"
|
pyyaml = "^6.0.1"
|
||||||
watchdog = "^4.0.1"
|
watchdog = "^4.0.1"
|
||||||
transformers = "^4.44.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.11.2,<0.12.0"
|
llama-index-core = "^0.10.52"
|
||||||
llama-index-readers-file = "*"
|
llama-index-readers-file = "^0.1.27"
|
||||||
# Optional LlamaIndex integration libs
|
# Optional LlamaIndex integration libs
|
||||||
llama-index-llms-llama-cpp = {version = "*", optional = true}
|
llama-index-llms-llama-cpp = {version = "^0.1.4", optional = true}
|
||||||
llama-index-llms-openai = {version ="*", optional = true}
|
llama-index-llms-openai = {version = "^0.1.25", optional = true}
|
||||||
llama-index-llms-openai-like = {version ="*", optional = true}
|
llama-index-llms-openai-like = {version ="^0.1.3", optional = true}
|
||||||
llama-index-llms-ollama = {version ="*", optional = true}
|
llama-index-llms-ollama = {version ="^0.2.2", optional = true}
|
||||||
llama-index-llms-azure-openai = {version ="*", optional = true}
|
llama-index-llms-azure-openai = {version ="^0.1.8", optional = true}
|
||||||
llama-index-llms-gemini = {version ="*", optional = true}
|
llama-index-llms-gemini = {version ="^0.1.11", optional = true}
|
||||||
llama-index-embeddings-ollama = {version ="*", optional = true}
|
llama-index-embeddings-ollama = {version ="^0.1.2", optional = true}
|
||||||
llama-index-embeddings-huggingface = {version ="*", optional = true}
|
llama-index-embeddings-huggingface = {version ="^0.2.2", optional = true}
|
||||||
llama-index-embeddings-openai = {version ="*", optional = true}
|
llama-index-embeddings-openai = {version ="^0.1.10", optional = true}
|
||||||
llama-index-embeddings-azure-openai = {version ="*", optional = true}
|
llama-index-embeddings-azure-openai = {version ="^0.1.10", optional = true}
|
||||||
llama-index-embeddings-gemini = {version ="*", optional = true}
|
llama-index-embeddings-gemini = {version ="^0.1.8", optional = true}
|
||||||
llama-index-embeddings-mistralai = {version ="*", optional = true}
|
llama-index-vector-stores-qdrant = {version ="^0.2.10", optional = true}
|
||||||
llama-index-vector-stores-qdrant = {version ="*", optional = true}
|
llama-index-vector-stores-milvus = {version ="^0.1.20", optional = true}
|
||||||
llama-index-vector-stores-milvus = {version ="*", optional = true}
|
llama-index-vector-stores-chroma = {version ="^0.1.10", optional = true}
|
||||||
llama-index-vector-stores-chroma = {version ="*", optional = true}
|
llama-index-vector-stores-postgres = {version ="^0.1.11", optional = true}
|
||||||
llama-index-vector-stores-postgres = {version ="*", optional = true}
|
llama-index-vector-stores-clickhouse = {version ="^0.1.3", optional = true}
|
||||||
llama-index-vector-stores-clickhouse = {version ="*", optional = true}
|
llama-index-storage-docstore-postgres = {version ="^0.1.3", optional = true}
|
||||||
llama-index-storage-docstore-postgres = {version ="*", optional = true}
|
llama-index-storage-index-store-postgres = {version ="^0.1.4", optional = true}
|
||||||
llama-index-storage-index-store-postgres = {version ="*", 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
|
||||||
clickhouse-connect = {version = "^0.7.19", optional = true}
|
clickhouse-connect = {version = "^0.7.15", optional = true}
|
||||||
|
|
||||||
# Optional Sagemaker dependency
|
# Optional Sagemaker dependency
|
||||||
boto3 = {version ="^1.35.26", 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.4.1", optional = true}
|
torch = {version ="^2.3.1", optional = true}
|
||||||
sentence-transformers = {version ="^3.1.1", optional = true}
|
sentence-transformers = {version ="^3.0.1", optional = true}
|
||||||
|
|
||||||
# Optional UI
|
# Optional UI
|
||||||
gradio = {version ="^4.44.0", optional = true}
|
gradio = {version ="^4.37.2", optional = true}
|
||||||
ffmpy = {version ="^0.4.0", optional = true}
|
# Fix: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/16289#issuecomment-2255106490
|
||||||
|
ffmpy = {git = "https://github.com/EuDs63/ffmpy.git", rev = "333a19ee4d21f32537c0508aa1942ef1aa7afe24", optional = true}
|
||||||
|
|
||||||
|
# Optional Google Gemini dependency
|
||||||
|
google-generativeai = {version ="^0.5.4", optional = true}
|
||||||
|
|
||||||
|
# Optional Ollama client
|
||||||
|
ollama = {version ="^0.3.0", optional = true}
|
||||||
|
|
||||||
# Optional HF Transformers
|
# Optional HF Transformers
|
||||||
einops = {version = "^0.8.0", optional = true}
|
einops = {version = "^0.8.0", optional = true}
|
||||||
retry-async = "^0.1.4"
|
|
||||||
|
|
||||||
[tool.poetry.extras]
|
[tool.poetry.extras]
|
||||||
ui = ["gradio", "ffmpy"]
|
ui = ["gradio", "ffmpy"]
|
||||||
llms-llama-cpp = ["llama-index-llms-llama-cpp"]
|
llms-llama-cpp = ["llama-index-llms-llama-cpp"]
|
||||||
llms-openai = ["llama-index-llms-openai"]
|
llms-openai = ["llama-index-llms-openai"]
|
||||||
llms-openai-like = ["llama-index-llms-openai-like"]
|
llms-openai-like = ["llama-index-llms-openai-like"]
|
||||||
llms-ollama = ["llama-index-llms-ollama"]
|
llms-ollama = ["llama-index-llms-ollama", "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"]
|
llms-gemini = ["llama-index-llms-gemini", "google-generativeai"]
|
||||||
embeddings-ollama = ["llama-index-embeddings-ollama"]
|
embeddings-ollama = ["llama-index-embeddings-ollama", "ollama"]
|
||||||
embeddings-huggingface = ["llama-index-embeddings-huggingface", "einops"]
|
embeddings-huggingface = ["llama-index-embeddings-huggingface", "einops"]
|
||||||
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"]
|
embeddings-gemini = ["llama-index-embeddings-gemini"]
|
||||||
embeddings-mistral = ["llama-index-embeddings-mistralai"]
|
|
||||||
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-clickhouse = ["llama-index-vector-stores-clickhouse", "clickhouse_connect"]
|
||||||
vector-stores-chroma = ["llama-index-vector-stores-chroma"]
|
vector-stores-chroma = ["llama-index-vector-stores-chroma"]
|
||||||
|
|
@ -85,14 +92,14 @@ storage-nodestore-postgres = ["llama-index-storage-docstore-postgres","llama-ind
|
||||||
rerank-sentence-transformers = ["torch", "sentence-transformers"]
|
rerank-sentence-transformers = ["torch", "sentence-transformers"]
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
black = "^24"
|
black = "^22"
|
||||||
mypy = "^1.11"
|
mypy = "^1.2"
|
||||||
pre-commit = "^3"
|
pre-commit = "^2"
|
||||||
pytest = "^8"
|
pytest = "^7"
|
||||||
pytest-cov = "^5"
|
pytest-cov = "^3"
|
||||||
ruff = "^0"
|
ruff = "^0"
|
||||||
pytest-asyncio = "^0.24.0"
|
pytest-asyncio = "^0.21.1"
|
||||||
types-pyyaml = "^6.0.12.20240917"
|
types-pyyaml = "^6.0.12.12"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.0.0"]
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
|
|
||||||
|
|
@ -25,23 +25,21 @@ data:
|
||||||
ui:
|
ui:
|
||||||
enabled: true
|
enabled: true
|
||||||
path: /
|
path: /
|
||||||
# "RAG", "Search", "Basic", or "Summarize"
|
|
||||||
default_mode: "RAG"
|
|
||||||
default_chat_system_prompt: >
|
default_chat_system_prompt: >
|
||||||
You are a helpful, respectful and honest assistant.
|
You are a helpful, respectful and honest assistant.
|
||||||
Always answer as helpfully as possible and follow ALL given instructions.
|
Always answer as helpfully as possible and follow ALL given instructions.
|
||||||
Do not speculate or make up information.
|
Do not speculate or make up information.
|
||||||
Do not reference any given instructions or context.
|
Do not reference any given instructions or context.
|
||||||
default_query_system_prompt: >
|
default_query_system_prompt: >
|
||||||
You can only answer questions about the provided context.
|
You can only answer questions about the provided context.
|
||||||
If you know the answer but it is not based in the provided context, don't provide
|
If you know the answer but it is not based in the provided context, don't provide
|
||||||
the answer, just state the answer is not in the context provided.
|
the answer, just state the answer is not in the context provided.
|
||||||
default_summarization_system_prompt: >
|
default_summarization_system_prompt: >
|
||||||
Provide a comprehensive summary of the provided context information.
|
Provide a comprehensive summary of the provided context information.
|
||||||
The summary should cover all the key points and main ideas presented in
|
The summary should cover all the key points and main ideas presented in
|
||||||
the original text, while also condensing the information into a concise
|
the original text, while also condensing the information into a concise
|
||||||
and easy-to-understand format. Please ensure that the summary includes
|
and easy-to-understand format. Please ensure that the summary includes
|
||||||
relevant details and examples that support the main ideas, while avoiding
|
relevant details and examples that support the main ideas, while avoiding
|
||||||
any unnecessary information or repetition.
|
any unnecessary information or repetition.
|
||||||
delete_file_button_enabled: true
|
delete_file_button_enabled: true
|
||||||
delete_all_files_button_enabled: true
|
delete_all_files_button_enabled: true
|
||||||
|
|
|
||||||
2
tests/fixtures/fast_api_test_client.py
vendored
2
tests/fixtures/fast_api_test_client.py
vendored
|
|
@ -5,7 +5,7 @@ from private_gpt.launcher import create_app
|
||||||
from tests.fixtures.mock_injector import MockInjector
|
from tests.fixtures.mock_injector import MockInjector
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture()
|
||||||
def test_client(request: pytest.FixtureRequest, injector: MockInjector) -> TestClient:
|
def test_client(request: pytest.FixtureRequest, injector: MockInjector) -> TestClient:
|
||||||
if request is not None and hasattr(request, "param"):
|
if request is not None and hasattr(request, "param"):
|
||||||
injector.bind_settings(request.param or {})
|
injector.bind_settings(request.param or {})
|
||||||
|
|
|
||||||
2
tests/fixtures/ingest_helper.py
vendored
2
tests/fixtures/ingest_helper.py
vendored
|
|
@ -19,6 +19,6 @@ class IngestHelper:
|
||||||
return ingest_result
|
return ingest_result
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture()
|
||||||
def ingest_helper(test_client: TestClient) -> IngestHelper:
|
def ingest_helper(test_client: TestClient) -> IngestHelper:
|
||||||
return IngestHelper(test_client)
|
return IngestHelper(test_client)
|
||||||
|
|
|
||||||
2
tests/fixtures/mock_injector.py
vendored
2
tests/fixtures/mock_injector.py
vendored
|
|
@ -37,6 +37,6 @@ class MockInjector:
|
||||||
return self.test_injector.get(interface)
|
return self.test_injector.get(interface)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture()
|
||||||
def injector() -> MockInjector:
|
def injector() -> MockInjector:
|
||||||
return MockInjector()
|
return MockInjector()
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import pytest
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture()
|
||||||
def file_path() -> str:
|
def file_path() -> str:
|
||||||
return "test.txt"
|
return "test.txt"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue