Pre-built Agents
RAG Powered Agents
Chat Agent
Usage

B. Usage

Installation

You can install our package simply by running:

pip install <<package name>>

C. Data Sources

a) Overview

  • Add PDF
  • Add Docx
  • Add Text
  • Add YouTube
  • Add Webpage
  • Add Website

b) Data Types

i. PDF

Incorporating PDF Content into Your Chat Agent

Enhancing your chat agent with PDF content broadens its conversational abilities, tapping into the wealth of information housed within PDF documents. This feature is pivotal for crafting a chat agent capable of furnishing precise, detailed responses sourced from diverse documents. The pdf_chat method streamlines the task of rendering PDF content searchable and available to your chat agent.

Overview of Function

Tailored for integrating PDF content into your chat agent, the pdf_chat function employs diverse parameters to enhance the processing and utilization of this content throughout conversations.

Parameters

  • input_dir (Optional[str]): The directory containing PDF files to be added. If specified, the function scans this directory for PDF files.
  • input_files (Optional[List]): A list of specific PDF file paths to be added. If provided, input_dir is ignored.
  • exclude_hidden (bool): When set to True, hidden files or files starting with a dot (.) in input_dir are excluded.
  • filename_as_id (bool): Uses the filename as the unique identifier for each PDF document if set to True.
  • recursive (bool): If True, includes files from subdirectories within input_dir.
  • required_exts (Optional[List[str]]): Specifies file extensions to include, with the default targeting PDF files.
  • system_prompt (str): An optional prompt to guide the system in processing PDF content.
  • query_wrapper_prompt (str): An optional prompt to enhance query relevance by wrapping user queries in a specific context.
  • embed_model (Union[str, EmbedType]): The embedding model used for text extraction and embedding from PDF documents. Defaults to a predefined model.
  • llm_params (dict): Parameters for integrating Large Language Models to augment content understanding and query processing.
  • vector_store_params (dict): Configuration for vector storage, specifying how and where the extracted content embeddings are stored.
  • service_context_params (dict): Additional parameters for customizing the service context for PDF content.
  • chat_engine_params (dict): Customization parameters for the chat engine, influencing how the chat agent utilizes the PDF content during conversations.
  • retriever_params (dict): Configuration for the document retriever component, determining how PDF content is indexed and retrieved based on user queries.

Example Usage

Adding PDF Files from a Directory

chat_agent.pdf_chat(
    input_dir="/path/to/your_pdf/documents",
    recursive=True
)

Adding Specific PDF Files

chat_agent.pdf_chat(
    input_files=["/path/to/your_specific/document1.pdf", "/path/to/your_specific/document2.pdf"],
)

ii. Docx File

Integration of DOCX Content into Your Chat Agent

Incorporating DOCX files into your chat agent enhances its conversational capabilities by accessing the vast information stored in this commonly used document format. The docx_chat method streamlines the process of adding DOCX content, empowering your chat agent to utilize the detailed information from these files for more precise and informed interactions.

Overview of Function

The docx_chat function is precisely designed to ingest DOCX content into your chat agent, employing various parameters to regulate how this content is handled, organized, and employed during conversations.

Parameters

  • input_dir (Optional[str]): Directory path containing DOCX files to be added. If specified, the function scans this directory for eligible DOCX files.
  • input_files (Optional[List]): A list of specific DOCX file paths to be added. This parameter takes precedence over input_dir if provided.
  • exclude_hidden (bool): If True, hidden files or files starting with a dot (.) in input_dir are excluded from processing.
  • filename_as_id (bool): Uses the filename as the unique identifier for each DOCX document if set to True.
  • recursive (bool): If True, includes files from subdirectories within input_dir.
  • required_exts (Optional[List[str]]): Specifies file extensions to include, typically set to [".docx"] to target DOCX files.
  • system_prompt (str): An optional prompt guiding the system in processing DOCX content.
  • query_wrapper_prompt (str): An optional prompt to enhance the relevance of user queries by providing specific context related to the DOCX content.
  • embed_model (Union[str, EmbedType]): The embedding model used for text extraction and embedding from DOCX documents. Defaults to a standard model optimized for document content.
  • llm_params (dict): Parameters for integrating Large Language Models to enhance content understanding and query processing.
  • vector_store_params (dict): Configuration for vector storage, detailing how and where the content embeddings are stored.
  • service_context_params (dict): Additional parameters to customize the service context for DOCX content.
  • chat_engine_params (dict): Customization parameters for the chat engine, influencing how the chat agent utilizes the DOCX content in conversations.
  • retriever_params (dict): Configuration for the document retriever component, determining how DOCX content is indexed and retrieved in response to user queries.

Example Usage

Adding DOCX Files from a Directory

chat_agent.docx_chat(
    input_dir="/path/to/your_docx/documents",
    recursive=True
)
 
This code snippet adds DOCX documents from the specified directory (and its subdirectories, if `recursive` is set to `True`) to the chat agent’s database.
 
#### Adding Specific DOCX Files
 
```python
chat_agent.docx_chat(
    input_files=["/path/to/your/document1.docx", "/path/to/your/document2.docx"],
)

Here, specific DOCX files are directly added to the chat agent, enabling it to draw upon their content in conversation.

iii. Text

Integrate Text File Content into Your Chat Agent

Expanding your chat agent's capabilities by integrating plain text (.txt) files broadens its repository of knowledge, allowing it to leverage a wide array of textual content. The txt_chat method simplifies the process of incorporating text files into your chat agent, ensuring that this abundance of information is readily available to enhance the quality and relevance of conversations.

Overview of Function

The txt_chat function is crafted to intake content from text files into your chat agent, utilizing various parameters to guarantee that this process is both efficient and productive.

Parameters

  • input_dir (Optional[str]): Directory path containing text files to be added. If specified, the function will search this directory for eligible files.
  • input_files (Optional[List]): A list of paths to specific text files to be added. When provided, input_dir is bypassed.
  • exclude_hidden (bool): If True, hidden files or those starting with a dot (.) within input_dir are excluded.
  • filename_as_id (bool): If True, the filename is used as the unique identifier for each text document.
  • recursive (bool): If True, the function will also search subdirectories within input_dir for text files.
  • required_exts (Optional[List[str]]): Specifies the file extensions to include. Defaults to text file extensions.
  • system_prompt (str): An optional prompt to guide the system in processing text file content.
  • query_wrapper_prompt (str): An optional prompt that can improve the relevance of search queries by providing context related to the text content.
  • embed_model (Union[str, EmbedType]): The embedding model used for extracting and embedding text from the files. Defaults to a general-purpose model.
  • llm_params (dict): Configuration parameters for integrating Large Language Models to enhance content comprehension and query processing.
  • vector_store_params (dict): Configuration for vector storage, specifying how and where extracted content embeddings are stored.
  • service_context_params (dict): Additional parameters to customize the service context for the text file content.
  • chat_engine_params (dict): Customization parameters for the chat engine, influencing how the chat agent utilizes text file content in conversations.
  • retriever_params (dict): Configuration for the document retriever component, determining how text file content is indexed and retrieved in response to user queries.

Example Usage

Adding Text Files from a Directory

chat_agent.txt_chat(
    input_dir="/path/to/your_text/files",
    recursive=True
)

This snippet configures the chat agent to ingest text files from the specified directory and its subdirectories.

Adding Specific Text Files

chat_agent.txt_chat({
    input_files: ["/path/to/your/file1.txt", "/path/to/your/file2.txt"],
})

Here, specific text files are directly added to the chat agent, allowing it to leverage their content in conversations.

YouTube Video Integration

Integrate YouTube video content into your chat agent to broaden its abilities and captivate users with dynamic, multimedia-rich information. The youtube_chat method streamlines the integration of YouTube video content, allowing your chat agent to reference or cite video content in its responses.

Overview of Function

The youtube_chat function is specially crafted to intake content from YouTube videos into your chat agent. This integration not only diversifies the agent’s data pool but also empowers it to reference or cite video content in its responses.

Parameters

  • urls (List[str]): A list of YouTube video URLs that you wish to integrate into the chat agent. Each URL should point to a specific video from which content will be extracted.
  • system_prompt (str, optional): An optional prompt guiding the system on how to process and integrate content from the YouTube videos. This can be particularly useful for emphasizing certain types of information within the videos.
  • query_wrapper_prompt (str, optional): An optional prompt designed to enhance the relevance of user queries by providing a context specific to the YouTube content.
  • embed_model (Union[str, EmbedType], optional): The embedding model used for processing and embedding textual content extracted from the videos. Defaults to a model suitable for video content analysis.
  • llm_params (dict, optional): Configuration parameters for integrating Large Language Models, enhancing the agent’s understanding and interpretation of video content.
  • vector_store_params (dict, optional): Configuration for vector storage, specifying how and where the extracted content embeddings are stored.
  • service_context_params (dict, optional): Additional parameters to customize the service context specific to YouTube video content.
  • chat_engine_params (dict, optional): Customization parameters for the chat engine, affecting how the agent utilizes YouTube content in conversations.
  • retriever_params (dict, optional): Configuration for the document retriever component, determining how YouTube content is indexed and retrieved based on user queries.

Example Usage

Adding Multiple YouTube Videos

To add multiple YouTube videos to your chat agent, you can use the youtube_chat method and provide a list of YouTube video URLs.

chat_agent.youtube_chat({
    urls: [
        "https://www.youtube.com/watch?v=example1",
        "https://www.youtube.com/watch?v=example2"
    ]
})

Integrate Webpage Content into Your Chat Agent

Integrating content from particular web pages can greatly improve your chat agent's capacity to offer informative and contextually appropriate responses. Through the webpage_chat technique, you can seamlessly incorporate webpage content, thereby enriching the agent's knowledge base with current information accessible on the internet.

Overview of Function

The webpage_chat feature is designed to streamline the effortless inclusion of content from a single webpage into your chat agent, employing various parameters for efficient content processing and integration.

Parameters

  • url (Optional[str]): The URL of the webpage whose content you wish to make searchable by the chat agent. This specifies the exact source of the content to be integrated.
  • system_prompt (str): An optional prompt to guide the system in processing the webpage content. It can be used to focus the content extraction on relevant information for the chat agent.
  • query_wrapper_prompt (str): An optional prompt that can enhance the relevance of search queries by providing context related to the webpage content.
  • embed_model (Union[str, EmbedType]): Specifies the embedding model used for text extraction and embedding from the webpage. Defaults to a model suitable for general web content.
  • llm_params (dict): Configuration parameters for integrating Large Language Models to augment the agent’s understanding of the webpage content.
  • vector_store_params (dict): Configuration for vector storage, detailing how and where the extracted content embeddings are stored.
  • service_context_params (dict): Additional parameters to customize the service context for the integrated webpage content.
  • chat_engine_params (dict): Customization parameters for the chat engine, influencing how the agent utilizes the webpage content in conversations.
  • retriever_params (dict): Configuration for the document retriever component, determining how the webpage content is indexed and retrieved based on user queries.

Example Usage

To demonstrate adding content from a specific webpage to the chat agent, you can use the following example:

chat_agent.webpage_chat({
    url: "https://www.example.com/specific-article",
})

Integrate Entire Website Content into Your Chat Agent

Enabling your chat agent to seamlessly incorporate content from an entire website substantially boosts its knowledge reservoir and conversational prowess. The website_chat function is tailored precisely for this objective, facilitating the thorough integration of website information, thus amplifying the agent's capacity to furnish precise and detailed responses.

Overview of Function

The website_chat function empowers the incorporation of a website's complete content into the chat agent, employing a set of parameters to refine content processing and guarantee seamless integration.

Parameters

  • url (Optional[str]): The base URL of the website you want to integrate. This should point to the homepage or a major section of the site whose content you wish to make searchable.
  • system_prompt (str): An optional prompt to guide the system’s approach to processing the website’s content. This can be useful for focusing on particular types of information.
  • query_wrapper_prompt (str): An optional prompt that can improve the relevance of user queries by providing a context specific to the website’s content.
  • embed_model (Union[str, EmbedType]): Specifies the embedding model used for extracting and embedding text from the website. Defaults to a model optimized for general web content.
  • llm_params (dict): Configuration parameters for integrating Large Language Models, enhancing the chat agent’s comprehension of the website content.
  • vector_store_params (dict): Configuration for vector storage, outlining how and where the extracted content embeddings are stored.
  • service_context_params (dict): Additional parameters for customizing the service context for the integrated website content.
  • chat_engine_params (dict): Customization parameters for the chat engine, affecting how the agent utilizes the website content in conversations.
  • retriever_params (dict): Configuration for the document retriever component, determining how the website content is indexed and retrieved based on user queries.

Example Usage

To demonstrate adding the content from an entire website to the chat agent, you can use the following example:

chat_agent.website_chat({
    url: "https://www.sample.com",
})