quivr/core/quivr_core/config.py
Jacopo Chevallard 285fe5b960
feat: websearch, tool use, user intent, dynamic retrieval, multiple questions (#3424)
# Description

This PR includes far too many new features:

- detection of user intent (closes CORE-211)
- treating multiple questions in parallel (closes CORE-212)
- using the chat history when answering a question (closes CORE-213)
- filtering of retrieved chunks by relevance threshold (closes CORE-217)
- dynamic retrieval of chunks (closes CORE-218)
- enabling web search via Tavily (closes CORE-220)
- enabling agent / assistant to activate tools when relevant to complete
the user task (closes CORE-224)

Also closes CORE-205

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally 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

## Screenshots (if appropriate):

---------

Co-authored-by: Stan Girard <stan@quivr.app>
2024-10-31 17:57:54 +01:00

28 lines
678 B
Python

from enum import Enum
import yaml
from pydantic import BaseModel
class PdfParser(str, Enum):
LLAMA_PARSE = "llama_parse"
UNSTRUCTURED = "unstructured"
MEGAPARSE_VISION = "megaparse_vision"
class MegaparseBaseConfig(BaseModel):
@classmethod
def from_yaml(cls, file_path: str):
# Load the YAML file
with open(file_path, "r") as stream:
config_data = yaml.safe_load(stream)
# Instantiate the class using the YAML data
return cls(**config_data)
class MegaparseConfig(MegaparseBaseConfig):
strategy: str = "fast"
llama_parse_api_key: str | None = None
pdf_parser: PdfParser = PdfParser.UNSTRUCTURED