InMemoryQueryEngine

InMemoryQueryEngine(llm_config: LLMConfig | dict[str, Any])

This engine stores ingested documents in memory and then injects them into an internal agent’s system message for answering queries.
This implements the autogen.agentchat.contrib.rag.RAGQueryEngine protocol.

Parameters:
NameDescription
llm_configType: LLMConfig | dict[str, typing.Any]

Instance Methods

add_docs

add_docs(
    self,
    new_doc_dir: Path | str | None = None,
    new_doc_paths_or_urls: Sequence[Path | str] | None = None
) -> None

Add additional documents to the in-memory store

Loads new Docling-parsed Markdown files from a specified directory or a list of file paths and inserts them into the in-memory store.

Parameters:
NameDescription
new_doc_dirThe directory path from which to load additional documents.

If provided, all eligible files in this directory are loaded.

Type: pathlib.Path | str | None

Default: None
new_doc_paths_or_urlsA list of file paths specifying additional documents to load.

Each file should be a Docling-parsed Markdown file.

Type: Sequence[pathlib.Path | str] | None

Default: None

connect_db

connect_db(
    self,
    *args: Any,
    **kwargs: Any
) -> bool

Not required nor implemented for InMemoryQueryEngine

Parameters:
NameDescription
*argsType: Any
**kwargsType: Any

init_db

init_db(
    self,
    new_doc_dir: Path | str | None = None,
    new_doc_paths_or_urls: Sequence[Path | str] | None = None,
    *args: Any,
    **kwargs: Any
) -> bool

Not required nor implemented for InMemoryQueryEngine

Parameters:
NameDescription
new_doc_dirType: pathlib.Path | str | None

Default: None
new_doc_paths_or_urlsType: Sequence[pathlib.Path | str] | None

Default: None
*argsType: Any
**kwargsType: Any

query

query(
    self,
    question: str,
    *args: Any,
    **kwargs: Any
) -> str

Run a query against the ingested documents and return the answer.

Parameters:
NameDescription
questionType: str
*argsType: Any
**kwargsType: Any