Using Knowledge Base

Quickly create an extremely accurate RAG pipeline for your model.

Creating a Knowledge Base in PropulsionAI allows you to build a powerful and accurate Retrieval-Augmented Generation (RAG) pipeline. This enhances your model's ability to reference domain-specific information, ensuring more precise and contextually relevant outputs.

1. Create New Knowledge Base

  • Step 1: Navigate to the "Knowledge Base" section in your project dashboard.

  • Step 2: Click "Create New Knowledge Base" and provide a name and description for your Knowledge Base. This will help you organize and identify it easily in the future.

2. Upload Content to Your Knowledge Base

Once inside your new Knowledge Base, you have several options to add content:

  • Upload Files:

    • Click "Upload" to add new files.

    • Supported file formats include PDF, DOCX, and Image files (which will be converted to text using OCR).

  • Add Textual Content Manually:

    • Another option is to manually add textual content by clicking on "Add Content".

    • You will need to provide the Source, the Content itself, and any relevant Metadata that will help organize and retrieve the information later.

  • Upload Files or Add Content Using SDK:

    • If you prefer to automate the process or integrate it with your existing systems, you can upload files or add content using the PropulsionAI SDK. This allows for seamless integration and easy updates to your Knowledge Base.

Accessing the Knowledge Base

Once your Knowledge Base is set up, you can easily access and utilize it in your projects:

  • In Playground:

    • When using in the Playground, simply choose your Knowledge Base from the dropdown menu. This enables your model to pull information from the Knowledge Base during interactions, enhancing its accuracy and relevance.

  • Using the SDK:

    • You can also access and utilize the Knowledge Base through the SDK, allowing your applications to query the Knowledge Base and retrieve information as needed.

With these steps, you’ve created a Knowledge Base that serves as a rich repository of information for your models to reference. This enhances your model's ability to generate more accurate and contextually relevant responses, making your AI solutions more effective in specialized domains.

Using with PropulsionAI SDK

Installing the SDK

Using Knowledgebases for inference as simple as adding knowledgebases key with the array of knowledgebase codes.

// Without Streaming
async function main() {
    const completionCreateResponse = await client.chat.completions.create({
        deployment: '<deployment_id>',
        knowledgebases=["<knowledgebase_code_1>", "<knowledgebase_code_2>"],
        messages=[
            {
                "role": "user",
                "content": "Hello, How are you?",
            }
        ],
        stream: false
    });
    
    console.log(completionCreateResponse.choices);
}
main();

// With Streaming
async function main() {
    const completionCreateResponse = await client.chat.completions.create({
        deployment: '<deployment_id>',
        knowledgebases=["<knowledgebase_code_1>", "<knowledgebase_code_2>"],
        messages=[
            {
                "role": "user",
                "content": "Hello, How are you?",
            }
        ],
        stream: true
    });
    
    for await (const part of stream) {
        process.stdout.write(part.choices[0]?.delta?.content || '');
    }
}
main();

Last updated