nat.tool.nvidia_rag#

Attributes#

Classes#

BaseRagResult

Base class for RAG service response schemas.

SourceResult

RAG Blueprint /search endpoint schema.

DocumentChunk

GenerativeAIExamples chain server /search endpoint schema.

NVIDIARAGToolConfig

Tool used to search the NVIDIA Developer database for documents across a variety of NVIDIA asset types.

Functions#

parse_rag_response(...)

Auto-detect RAG schema and return Documents.

nvidia_rag_tool(...)

Module Contents#

logger#
class BaseRagResult(/, **data: Any)#

Bases: pydantic.BaseModel

Base class for RAG service response schemas.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

content: str#
score: float#
abstractmethod get_document_title() str#

Override in subclass to return the document name field.

to_document() langchain_core.documents.Document#
class SourceResult(/, **data: Any)#

Bases: BaseRagResult

RAG Blueprint /search endpoint schema.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

document_name: str#
get_document_title() str#

Override in subclass to return the document name field.

class DocumentChunk(/, **data: Any)#

Bases: BaseRagResult

GenerativeAIExamples chain server /search endpoint schema.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

filename: str#
get_document_title() str#

Override in subclass to return the document name field.

parse_rag_response(
data: dict[str, Any],
) list[langchain_core.documents.Document]#

Auto-detect RAG schema and return Documents.

class NVIDIARAGToolConfig(/, **data: Any)#

Bases: nat.data_models.function.FunctionBaseConfig

Tool used to search the NVIDIA Developer database for documents across a variety of NVIDIA asset types.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

base_url: str = None#
timeout: int = None#
document_separator: str = None#
document_prompt: str = None#
top_k: int = None#
collection_name: str = None#
async nvidia_rag_tool(
config: NVIDIARAGToolConfig,
builder: nat.builder.builder.Builder,
) collections.abc.AsyncGenerator[nat.builder.function_info.FunctionInfo, None]#