query

Function

Queries the cache. When the cache cannot be queried, an LLM is accessed.

Prototype

def query(text, *args, **kwargs) -> Union[Dict, Iterator[Dict]]

Parameters

Parameter

Data Type

Required/Optional

Description

text

String

Required

Original question of a user. The value is a string within the range of (0, 128M].

llm_config

LLMParameterConfig

Optional

LLM parameters. For details, see LLMParameterConfig.

*args/**kwargs

Any

Optional

Signature of the parent class method, which is not involved in RAG SDK.

Return Value

Data Type

Description

Union[Dict, Iterator[Dict]]

Answer. The dictionary content is as follows:

  • With knowledge source: {"query": query, "result": data, "source_documents": [{'metadata': xxx, 'page_content': xxx}]}
  • Without knowledge source: {"query": query, "result": data}