# What is PropulsionAI?

Brief introduction to PropulsionAI, its purpose, and core features.

**PropulsionAI** is a cutting-edge platform designed to simplify and accelerate the development, fine-tuning, and deployment of custom Large Language Models (LLMs) for enterprises and startups. Whether you're building a model to automate internal processes or create customer-facing applications, PropulsionAI provides the tools, flexibility, and transparency needed to take your AI projects from concept to production in record time.

### Purpose of PropulsionAI

PropulsionAI was built with a clear mission: to democratize the development of custom LLMs, making it accessible for organizations of all sizes to create powerful, tailor-made models that align with their specific needs. By addressing common challenges such as model accuracy, data privacy, and deployment speed, PropulsionAI empowers teams to focus on innovation rather than infrastructure.

### **Core Features**

1. **Seamless Fine-Tuning Process**\
   PropulsionAI simplifies the fine-tuning process, allowing you to effortlessly customize foundational models with your own data. The platform’s intuitive interface and automated workflows enable you to fine-tune models in just a few clicks, ensuring that you can quickly achieve the performance and accuracy needed for your specific use case.
2. **Comprehensive Data Management Suite**\
   Quality data is the cornerstone of any successful AI project. PropulsionAI provides a full suite of data import and management tools, allowing you to clean, preprocess, and organize your data before it’s used for fine-tuning. This focus on data quality ensures that your models are trained on the most relevant and accurate information, leading to superior outcomes.
3. **Ownership, Transparency, and Flexibility**\
   At PropulsionAI, we believe in giving you full control over your models. Our platform is built with transparency and flexibility at its core, allowing you to oversee every aspect of the model development lifecycle. You retain complete ownership of your data and models, with the ability to customize and adapt the platform to meet your unique needs.
4. **Deploy on Your Own Cloud for Enhanced Data Security**\
   PropulsionAI offers the flexibility to deploy your models on your own cloud infrastructure, ensuring that your data remains secure and compliant with your organization’s privacy policies. Whether you choose to deploy in your own environment or on PropulsionAI’s cloud, you can be confident that your data is protected.
5. **Advanced Tools and Integrations**\
   Enhance your models with a range of powerful tools and integrations. PropulsionAI’s knowledge base allows your models to access domain-specific information, boosting their performance. The platform also offers a comprehensive SDK, API, and function-calling capabilities, enabling seamless integration with your existing systems and extending the functionality of your LLMs.

### **Why Choose PropulsionAI?**

PropulsionAI stands out for its flexibility, transparency, and commitment to user ownership. Unlike other platforms that may lock you into specific workflows or obscure critical aspects of the model lifecycle, PropulsionAI is designed to adapt to your unique requirements while keeping you in control. Whether you're a small startup or a large enterprise, PropulsionAI equips you with the tools to build, deploy, and scale your LLMs with confidence.


# Key Concepts at a Glance

Quick overview of important concepts you will encounter.

Understanding the following key concepts will help you navigate and make the most of PropulsionAI from the start. These foundational elements are central to the platform’s functionality and will guide you through your journey of building and deploying custom LLMs.

### Overview Video

{% embed url="<https://youtu.be/ekml6pU--cM?si=Q64JNhMsaQ1JE9N1>" %}
Overview Video
{% endembed %}

### **1. Projects**

Projects serve as the central workspace where you organize all related activities, models, datasets, and deployments. They provide a structured environment for managing and tracking the progress of your AI initiatives, ensuring everything is organized and accessible for you and your team.

### **2. Models & Versions**

Models are the AI engines that power your applications. In PropulsionAI, you can create and fine-tune models, with each version representing a specific state of the model as it evolves. This versioning system allows you to iterate safely, compare different approaches, and maintain control over your model development.

### **3. Datasets**

Datasets are the foundation for training and fine-tuning your models. PropulsionAI allows you to record data from external sources, upload complete datasets, or add individual dataset items. The platform’s comprehensive dataset management suite empowers you to improve responses, search and tag items, split and copy datasets, and much more, ensuring that your models are trained on high-quality, well-organized data.

### **4. Knowledge Base**

The knowledge base is a repository of domain-specific information that your models can reference to improve their accuracy and relevance. By continually updating the knowledge base, you ensure that your models stay current and perform better in specialized areas.

### **5. Deployments**

Deployments involve making your model available for use in production environments. PropulsionAI supports flexible deployment options, including on its own cloud, on-premises, or on your private cloud infrastructure, ensuring your models are secure, compliant, and accessible where you need them.

### **6. API Keys**

API keys are unique tokens that allow your applications to securely interact with PropulsionAI’s services. They are essential for accessing your deployments, managing knowledge bases, and integrating with external systems, providing secure and controlled access to your AI capabilities.

### **7. SDK & Function Calling**

The SDK (Software Development Kit) and function-calling capabilities allow you to easily integrate PropulsionAI into your existing systems. These tools extend the functionality of your applications, enabling you to leverage the full power of PropulsionAI’s models with minimal effort.

By familiarizing yourself with these key concepts, you’ll be well-equipped to harness the full potential of PropulsionAI. Whether you’re starting with your first project or refining a complex deployment, understanding these foundational elements will enable you to navigate the platform with confidence and achieve your AI goals more effectively.


# Getting Started

Step-by-step guide to set up an account and get started quickly.

Welcome to PropulsionAI! Follow these simple steps to get up and running quickly. In just a few minutes, you'll be able to create your first project, upload a dataset, and start training your custom model.

### **1. Create an Account**

To get started, go to <https://app.propulsionhq.com/signup> and create your PropulsionAI account. Simply enter your details, and you'll be ready to start building and deploying your custom models.

### **2. Create a New Project**

Once you've logged in, the first step is to create a new project. Projects are where you organize your datasets, models, and deployments. To create a new project:

* Click on the **"New"** button on the dashboard.
* Enter a name and description for your project.
* Click **"Create"** to set up your project.

### **3. Upload a Dataset**

Datasets are the foundation for training your models. You can either upload your own dataset or use a sample dataset to get started quickly.

* Navigate to the **"Datasets"** section of your project.
* Click **"New"** and enter a name and description for your dataset.
* Click **"Upload Dataset"** and select your dataset file (JSONL format is recommended).
* If you don't have a dataset ready, you can [download a sample JSONL dataset](https://huggingface.co/datasets/PropulsionAI/fast_food_copilot_qa_mini) here to try out the platform.
* Once uploaded, you will need to map the columns in your dataset file to the columns supported by PropulsionAI.
* Now, you'll be able to manage, search, and tag items within the dataset.

### **4. Create a New Model and Version**

Now that you have your dataset ready, it's time to create a model:

* Go to the **"Models"** section of your project.
* Click **"Create New Model"** and enter a name for your model.
* After creating the model, navigate inside it and, create a version by selecting **"Create Version"**.
* Configure the model version with the desired settings, such as base model, training hardware and, link it to your uploaded dataset.

### **5. Start Training**

With your model version created, you can now start training:

* Click **"Start Training"** to begin the fine-tuning process.
* Monitor the training progress and adjust parameters as needed to optimize performance.

### **6. Deploy Your Model**

Once training is complete, your model is ready for deployment:

* Go to the **"Deployments"** section of your project.
* Click **"New"** and select the model version you trained (or a base model) and the hardware you want to deploy the model on.
* **\[PRO]** Choose your deployment environment (PropulsionAI Cloud, on-premise, or your private cloud).&#x20;
* Click **"Deploy"** to make your model available for production use.

\
You're now ready to start leveraging your custom model in your applications. Explore the platform further to refine your model, integrate it with your systems, and unlock the full potential of PropulsionAI.


# Installing the SDK

PropulsionAI provides SDKs for both Node.js and Python, making it easy to integrate powerful AI capabilities into your applications. Follow the instructions below to install the SDK on your preferred platform.

### **Installing the SDK on Node.js**

You can install the PropulsionAI SDK on Node.js using either **npm** or **Yarn**.

**Using npm:**

To install the SDK using npm, run the following command in your terminal:

```bash
npm install propulsionai
```

**Using Yarn:**

If you prefer Yarn, you can install the SDK by running:

```bash
yarn add propulsionai
```

### **Installing the SDK on Python**

For Python users, the PropulsionAI SDK can be installed via **pip**:

```bash
pip install propulsionai
```

### **Next Steps**

Once the SDK is installed, you can start using it to interact with PropulsionAI’s API, manage datasets, deploy models, and more. Refer to the documentation for detailed guides on how to use the SDK for your specific use case.

{% content-ref url="/pages/Q1ohPTL0YpFjBsfGED5v" %}
[Generate API Key](/quick-start/generate-api-key)
{% endcontent-ref %}

{% content-ref url="/pages/2qBQnyCag2yMIQ7kY5ey" %}
[Using the SDK](/quick-start/using-the-sdk)
{% endcontent-ref %}


# Foundational Models

Introduction to the foundational models available and their use cases.

PropulsionAI offers a range of powerful foundational models that can be used as the starting point for your AI projects. These models have been pre-trained on vast datasets and are ready to be fine-tuned for your specific needs. Alternatively, if the pre-trained model meets your requirements, you can deploy it directly without any further fine-tuning.

### **Available Foundational Models**

1. **Meta Llama Series**
   * [**meta-llama/Meta-Llama-3.1-8B-Instruct**](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct)\
     The latest and a versatile model designed for a wide range of instructive tasks, featuring 8 billion parameters.
   * [**meta-llama/Meta-Llama-3-8B-Instruct**](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct)\
     Another robust option in the Meta Llama series, optimized for instructive tasks with 8 billion parameters.
   * [**meta-llama/Llama-2-7b-chat**](https://huggingface.co/meta-llama/Llama-2-7b-chat)\
     A strong conversational model with 7 billion parameters, ideal for chat-based applications.
2. **Mistral AI Series**
   * [**mistralai/Mistral-7B-Instruct-v0.3**](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.3)\
     A highly capable model with 7 billion parameters, optimized for instructive tasks across various domains and works interestingly well on tasks such as function calling.
   * [**mistralai/Mistral-Nemo-Instruct-2407**](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407)\
     An advanced model in the Mistral AI series, tailored for complex instructions and diverse applications.
3. **Google Gemma Series**
   * [**google/gemma-2-2b-it**](https://huggingface.co/google/gemma-2-2b-it)\
     A compact and efficient model with 2 billion parameters, suitable for lightweight applications and tasks.
   * [**google/gemma-2-9b-it**](https://huggingface.co/google/gemma-2-9b-it)\
     A more powerful model in the Gemma series, featuring 9 billion parameters for handling more complex tasks.
4. **Microsoft Phi Series**
   * [**microsoft/Phi-3-mini-4k-instruct**](https://huggingface.co/microsoft/Phi-3-mini-4k-instruct)\
     A specialized small model with 4k context window, designed for high-efficiency instructive tasks in compact applications.
5. **Qwen Series**
   * [**Qwen/Qwen2-0.5B-Instruct**](https://huggingface.co/Qwen/Qwen2-0.5B-Instruct)\
     A smaller but highly efficient model with 0.5 billion parameters, suitable for focused instructive tasks requiring less computational power.

### **Using Foundational Models**

These foundational models provide you with a solid base for your AI projects. You can choose to:

* **Fine-tune**: Customize the model to better suit your specific data and requirements by fine-tuning it with your datasets.
* **Deploy Directly**: If the pre-trained model fits your use case, deploy it directly without any additional fine-tuning. This can save time and resources, especially for applications where the model's general capabilities are sufficient.

Whether you’re looking to fine-tune a model to achieve specific results or deploy a foundational model as-is, PropulsionAI provides the tools and flexibility to meet your needs.

### **Requesting a Model**

If you need a specific model that isn’t currently available in our foundational models, we’re here to help! You can request the addition of new models to the PropulsionAI platform by either:

* **Emailing us at** <support@propulsionhq.com> with the details of the model you need.
* **Sending a message on our** [**Discord channel**](https://discord.gg/J4RF7phwYN)**,** where our support team and community are available to assist you.

We’re committed to continuously expanding our offerings to meet your needs, so don’t hesitate to reach out with your requests!

{% content-ref url="/pages/bxeVJKpKUGGjCWuKogPB" %}
[Deploying Models](/quick-start/deploying-models)
{% endcontent-ref %}

{% content-ref url="/pages/ZYsQF2uCnySIxNe8aBgg" %}
[Fine-tuning a Model](/quick-start/fine-tuning-a-model)
{% endcontent-ref %}


# Creating Datasets

Step-by-step guide for creating datasets in PropulsionAI

In PropulsionAI, datasets are the foundation for training your models. Whether you're starting with prebuilt data or generating new data from live interactions, PropulsionAI offers flexible options to get your datasets ready for fine-tuning your models. \
\
Here’s how you can do it:

### **1. Upload a Prebuilt Dataset**

The most straightforward way to get started is by uploading a prebuilt dataset. PropulsionAI supports JSONL, JSON, and CSV formats. Here’s how:

* **Step 1:** Navigate to the **"Datasets"** section of your project.
* **Step 2:** Click **"New"** and enter a name and description for your dataset.
* **Step 3:** Click **"Upload Dataset"** and select your dataset file (JSONL, JSON, or CSV).
* **Step 4:** Map the columns in your dataset file to the columns supported by PropulsionAI. This step ensures that the data is correctly interpreted for training.
* **Step 5:** Once uploaded, you'll be able to manage, search, and tag items within the dataset, setting the stage for high-quality model training.

### **2. Record Using Deployments**

Recording data directly from your model’s deployment is an efficient way to gather real-world usage data for further fine-tuning:

* **Step 1:** When creating a deployment in the **"Deployments"** section, you’ll have the option to record data directly to a dataset.
* **Step 2:** Choose to create a new dataset or select an existing one to capture interactions as they happen.
* **Step 3:** This recorded data can then be reviewed, tagged, and used for improving your model, making it more accurate and aligned with actual usage scenarios.

### **3. Add Items Manually**

If you have specific data points that you want to include, or if you need to augment an existing dataset, you can add items manually:

* **Step 1:** In the **"Datasets"** section, instead of uploading, click on **"Add Item."**
* **Step 2:** Manually enter the data you want to include, one item at a time.
* **Step 3:** This method is especially useful for refining datasets with targeted examples or for testing purposes.

### **4. Record Using SDK**

For users who are already using other platforms like OpenAI, PropulsionAI’s SDK provides a seamless way to record ongoing interactions into a dataset:

* **Step 1:** Integrate the PropulsionAI SDK into your existing application.
* **Step 2:** Use the SDK to capture conversations or interactions happening on another platform and record them directly into a PropulsionAI dataset.
* **Step 3:** This data can be further improved and utilized to fine-tune an open-source model, making it more effective and tailored to your needs.

Leveraging existing data through uploading a prebuilt dataset (Option 1) or capturing real-world interactions by recording using deployments (Option 2) are both effective ways to gather valuable data for your models. These approaches help establish a solid foundation for accurate and effective model training, ensuring that your models are well-aligned with your specific needs.<br>

With these options, you’re well on your way to building high-quality datasets that power your custom LLMs in PropulsionAI. Whether you start with prebuilt data or collect new data on the go, PropulsionAI provides the flexibility and tools you need to succeed.


# Fine-tuning a Model

Quick guide to train a model based on your own dataset.

Fine-tuning a model in PropulsionAI allows you to customize a foundational model using the dataset you've built, tailoring it to meet your specific requirements. Follow these steps to fine-tune your model:

### **1. Create a Model**

To begin, you’ll need to create a new model in your project:

* **Step 1:** Navigate to the **"Models"** section of your project.
* **Step 2:** Click **"Create New Model"** and enter a name for your model.
* **Step 3:** Once the model is created, you can move on to creating a version.

### **2. Create a Version**

With your model created, it's time to set up a version for fine-tuning:

* **Step 1:** Click **"Create Version"** within the model you've just created.
* **Step 2:** You will be presented with two options: **"From Scratch"** or **"Existing Version."** Choose **"From Scratch"** to start fresh.

### **3. Fill in Version Details**

Now you’ll need to configure the version with all the necessary details:

* **Step 3.1: Version Tag**\
  Enter a tag or name for this version to keep it organized.
* **Step 3.2: Select Dataset**\
  Choose the dataset you’ve previously uploaded or recorded, which will be used for fine-tuning.
* **Step 3.3: Choose Base Model**\
  Select one of the foundational models available, such as *Meta Llama* or *Mistral* series, that best suits your use case.
* **Step 3.4: Training Hardware**\
  Select the hardware for training. Options include L4, V100, T4, A100, and H100. Note that the hardware selection will be restricted based on the size of the foundational model chosen. Be aware that costs will be incurred, and a minimum balance is required to start training. If there isn’t enough balance, the training may fail.
* **Step 3.5: Release Notes**\
  Add any notes or descriptions relevant to this version, such as changes or improvements you expect from this fine-tuning session.
* **Step 3.6: Hyperparameters**\
  Configure the hyperparameters, including the learning rate and the number of epochs (iterations) the model will undergo during training.

Once all the details are filled in, click **"Create Version."**

### **4. Start Training**

With your version set up, you’re ready to start the fine-tuning process:

* **Step 1:** Click the **"Start Training"** button to begin the fine-tuning.
* **Step 2:** The training process will commence, leveraging the dataset and hardware you’ve selected.

### **5. Monitor Progress and Review Results**

As training progresses, you can monitor its status:

* **Step 1:** Use the logs to track the training process in real-time.
* **Step 2:** Once training is completed, review the training results to evaluate the model’s performance.

After reviewing the results, you can proceed to deploy your newly fine-tuned model, making it available for use in production environments.


# Deploying Models

Step-by-step guide to creating your first deployment.

Deploying your model on PropulsionAI enables you to make it available for real-time usage, whether it's for internal tools or customer-facing applications. Follow these steps to deploy your model:

### **1. Navigate to the Deployments Section**

* Go to the **"Deployments"** section in your project dashboard.

### **2. Create a New Deployment**

* Click **"New"** to start setting up a new deployment.

### **3. Configure the Deployment**

In the deployment setup page, you will need to fill out the following details:

* **Base URL**: This is the endpoint where your model will be accessible. You can customize the suffix if needed.
* **Hardware**: Select the hardware that best suits your model’s needs. The options include:

  * **L4**
  * **V100**
  * **T4**
  * **A100**
  * **H100**

  The hardware selection will depend on the size and complexity of your model. Be mindful that different hardware configurations come with varying costs.
* **Model Version**: Choose the model version you want to deploy. This could be a fine-tuned version or a base model if no further customization is needed.
* **Replicas**:

  * **Minimum Replicas**: Set the minimum number of replicas (instances) that should always be running. Start with 0 if you're unsure, as this will save costs when the model isn’t actively in use.
  * **Maximum Replicas**: Set the maximum number of replicas to handle increased load when your model is in high demand.

  *Note: Instances take up to 120 seconds to boot up when a request is received.*
* **Record Conversations**: Toggle this option if you want to record all interactions with your model.
  * **Dataset**: If you're recording conversations, you’ll need to select or create a dataset where these interactions will be stored.\
    \
    :exclamation:Important:  Ensure you have the necessary consents if you plan to record conversations. This is especially critical for production environments, where data privacy laws may apply. Proceed with caution.

### **4. Deploy the Model**

* After configuring the deployment settings, click **"Deploy"** to launch your model.
* After the deployment shows "Running" status, you can quickly try out the model by clicking on the "Try in Playground" button.
* Your model will now be accessible through the provided API endpoint.

### **5. Monitor and Manage Your Deployment**

* Once deployed, monitor your model’s performance and resource usage. Adjust the number of replicas or switch hardware as needed to optimize costs and performance.

***

With these steps, you’ve successfully deployed your model on PropulsionAI. Your model is now ready to handle real-time requests, and you can easily scale its deployment based on your specific needs.


# Generate API Key

API keys are essential for using the PropulsionAI SDK and integrating your models into external applications. Follow these steps to generate your API keys:

### **1. Set Up Billing**

Before generating an API key, you need to ensure that your billing information is set up:

* **Step 1:** When you sign up, you receive $25 in free credits, which will be visible in your account under the **"Billing"** section.
* **Step 2:** Although you have initial credits, you still need to set up a payment method for any additional usage. Go to the **"Billing"** section from the sidebar menu.
* **Step 3:** Click **"Add Card"** and enter your payment details to set up your billing.

### **2. Generate API Keys**

After setting up billing, you can generate API keys for your project:

* **Step 1:** Go to the **"API Keys"** section in your project dashboard.
* **Step 2:** You’ll see options to generate two types of API keys:
  * **Development Key**: This key is used for testing and development purposes.
  * **Production Key**: This key is intended for production environments where your model will be actively used by your end-users.
* **Step 3:** Click **"Generate"** next to the type of API key you need. The key will be generated and displayed on the screen.

### :exclamation:**Important**

* **Keys Visibility**: The API keys will only be visible once after generation. Even PropulsionAI cannot access your keys after they are generated. If a key is lost, it will need to be regenerated, and any applications using the old key will lose access.
* **Secure Your Keys**: Ensure that you store your API keys securely, as they are critical for accessing PropulsionAI’s API through the SDK.

\
By following these steps, you’ve successfully set up your billing and generated the API keys required to start using the PropulsionAI SDK. Remember to securely store your keys, as losing them will require regeneration, impacting your applications.


# Using the SDK

Basic examples and walkthroughs to get you using the SDK immediately.

{% content-ref url="/pages/tMRAxvFbmCHMdkBxiTVa" %}
[Installing the SDK](/introduction/installing-the-sdk)
{% endcontent-ref %}

{% content-ref url="/pages/Q1ohPTL0YpFjBsfGED5v" %}
[Generate API Key](/quick-start/generate-api-key)
{% endcontent-ref %}

**Initialize the client**

{% tabs %}
{% tab title="Typescript" %}

```
import PropulsionAI from 'propulsionai';

const client = new PropulsionAI({
  bearerToken: process.env['PROPULSIONAI_BEARER_TOKEN'],
});
```

{% endtab %}

{% tab title="Python" %}

```python
from propulsionai import PropulsionAI

client = PropulsionAI(
    # This is the default and can be omitted
    bearer_token=os.environ.get("PROPULSIONAI_BEARER_TOKEN"),
)
```

{% endtab %}
{% endtabs %}

Chat

{% tabs %}
{% tab title="Typescript" %}

<pre class="language-javascript"><code class="lang-javascript"><strong>async function main() {
</strong>    const completionCreateResponse = await client.chat.completions.create({
        deployment: '&#x3C;deployment_id>',
        messages=[
            {
                "role": "user",
                "content": "Hello, How are you?",
            }
        ],
        stream: false
    });
    
    console.log(completionCreateResponse.choices);
}
main();
</code></pre>

{% endtab %}

{% tab title="Python" %}

```python
def sync_main() -> None:
    response = client.chat.completions.create(
        deployment="<deployment_id>",
        messages=[
            {
                "role": "user",
                "content": "Hello, How are you?",
            }
        ],
        stream=False,
    )

    print(response)

sync_main()
```

{% endtab %}
{% endtabs %}

Streaming Chat

{% tabs %}
{% tab title="Typescript" %}

```python
async function main() {
    const completionCreateResponse = await client.chat.completions.create({
        deployment: '<deployment_id>',
        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();
```

{% endtab %}

{% tab title="Python" %}

```
def sync_main() -> None:
    response = client.chat.completions.create(
        deployment="<deployment_id>",
        messages=[
            {
                "role": "user",
                "content": "Hello, How are you?",
            }
        ],
        stream=True,
    )

    for data in response:
      if data:
          chunk = data.to_json()
          chunk_json = json.loads(chunk)
          
          if chunk_json["choices"] and chunk_json["choices"][0]["delta"] is not None:
              delta = chunk_json["choices"][0]["delta"]
              if "content" in delta and delta["content"] is not None:
                  sys.stdout.write(delta["content"])
                  sys.stdout.flush() # Ensure content is displayed immediately

sync_main()
```

{% endtab %}
{% endtabs %}


# Function Calling

Simple guide to understanding and implementing function calling.

{% content-ref url="/pages/tMRAxvFbmCHMdkBxiTVa" %}
[Installing the SDK](/introduction/installing-the-sdk)
{% endcontent-ref %}

Automatic Tool Calling

{% tabs %}
{% tab title="Typescript" %}
Here we define the tool function in json

```javascript
import { RunnableToolFunction } from 'propulsionai/lib/RunnableFunction';

const tools: RunnableToolFunction<any>[] = [
  {
    type: 'function',
    function: {
      name: 'list',
      description: 'list queries books by genre, and returns a list of names of books',
      parameters: {
        type: 'object',
        properties: {
          genre: { type: 'string', enum: ['mystery', 'nonfiction', 'memoir', 'romance', 'historical'] },
        },
      },
      function: list,
      parse: JSON.parse,
    },
  } as RunnableToolFunction<{ genre: string }>,
  {
    type: 'function',
    function: {
      name: 'search',
      description: 'search queries books by their name and returns a list of book names and their ids',
      parameters: {
        type: 'object',
        properties: {
          name: { type: 'string' },
        },
      },
      function: search,
      parse: JSON.parse,
    },
  } as RunnableToolFunction<{ name: string }>,
  {
    type: 'function',
    function: {
      name: 'get',
      description:
        "get returns a book's detailed information based on the id of the book. Note that this does not accept names, and only IDs, which you can get by using search.",
      parameters: {
        type: 'object',
        properties: {
          id: { type: 'string' },
        },
      },
      function: get,
      parse: JSON.parse,
    },
  } as RunnableToolFunction<{ id: string }>,
];

async function list({ genre }: { genre: string }) {
  console.log('calling list: ', genre);
  return db.filter((item) => item.genre === genre).map((item) => ({ name: item.name, id: item.id }));
}

async function search({ name }: { name: string }) {
  console.log('calling search: ', name);
  return db.filter((item) => item.name.includes(name)).map((item) => ({ name: item.name, id: item.id }));
}

async function get({ id }: { id: string }) {
  console.log('calling get: ', id);
  return db.find((item) => item.id === id);
}
```

Using `run_tools` for automatic function calling **with or without streaming**.

```javascript
async function main() {
  const runner = await client.chat.completions
    .runTools({
      deployment: '<deployment_id>',
      stream: true, // can be false
      tools, // as defined earlier
      messages: [
        {
          role: 'system',
          content:
            'Please use our book database, which you can access using functions to answer the following questions.',
        },
        {
          role: 'user',
          content:
            'I really enjoyed reading Where the Crawdads Sing, could you recommend me a book that is similar and tell me why?',
        },
      ],
    })
    .on('message', (msg) => console.log('msg', msg))
    .on('functionCallResult', (functionCallResult) => console.log('functionCallResult', functionCallResult))
    .on('content', (diff) => process.stdout.write(diff))
    .on('totalUsage', (totalUsage) => console.log('totalUsage', totalUsage))
    .on('task_id', (task_id) => console.log('task_id', task_id));

  const result = await runner.finalChatCompletion();
  console.log();
  console.log('messages');
  console.log(JSON.stringify(runner.messages));

  console.log();
  console.log('final chat completion');
  console.dir(result, { depth: null });
}

main()
```

{% endtab %}

{% tab title="Python" %}
Here we define the tool function, its parameters and examples (optional)

```python
def get_current_weather(location: str, format: str) -> str:
    """
    Retrieves the current weather for a specified location.

    This function fetches the current weather data for the given location
    and returns it in the specified format.

    Parameters:
    -----------
    location : str
        The name of the location (city, country, etc.) to get weather for.
    format : str
        The desired output format. Accepted values are 'celsius', 'fahrenheit',
        or 'kelvin' for temperature units.

    Examples:
    ---------
    >>> get_current_weather("New York", "celsius")
    'Current weather in New York: 22°C, Partly Cloudy'

    >>> get_current_weather("London", "fahrenheit")
    'Current weather in London: 59°F, Rainy'
    """
    # print(f"Function Log: Getting weather for {location} in {format} format...")
    return f'{{"temperature": 22, "description": "Partly Cloudy", "location": "{location}", "units": "{format}"}}'
```

Using `run_tools` for automatic function calling without streaming.

```python
def sync_main() -> None:
    response = client.chat.completions.run_tools(
        deployment="<deployment_id>",
        messages=[
            {
                "role": "system",
                "content": "You are a helpful assistant.",
            },
            {
                "role": "user",
                "content": "What is the weather in SF and NY?",
            },
        ],
        tools=[get_current_weather],
        stream=False,
        tool_debug=False,
    )
    print(response.to_json())
sync_main()
```

Using `run_tools` for automatic function calling while **streaming**.

```python
def sync_main() -> None:
    response = client.chat.completions.run_tools(
        deployment="<deployment_id>",
        messages=[
            {
                "role": "system",
                "content": "You are a helpful assistant.",
            },
            {
                "role": "user",
                "content": "What is the weather in SF and NY?",
            },
        ],
        tools=[get_current_weather],
        stream=True,
        tool_debug=False,
    )
    for data in response:
      if data:
          chunk = data.to_json()
          chunk_json = json.loads(chunk)
          
          if chunk_json["choices"] and chunk_json["choices"][0]["delta"] is not None:
              delta = chunk_json["choices"][0]["delta"]
              
              # Check if 'content' exists in delta and is not None
              if "content" in delta and delta["content"] is not None:
                  sys.stdout.write(delta["content"])
                  sys.stdout.flush()  # Ensure content is displayed immediately
              
              # Check for tool calls
              # if "tool_calls" in delta:
                  # print("Tool call detected:", delta["tool_calls"])
              
              # Check for finish reason
              # if "finish_reason" in chunk_json["choices"][0] and chunk_json["choices"][0]["finish_reason"] == "stop":
              #     print("\nGeneration complete.")
sync_main()
```

{% endtab %}
{% endtabs %}

Manualy manage function calling

{% tabs %}
{% tab title="Typescript" %}

```
// TODO
```

{% endtab %}

{% tab title="Python" %}

```
// TODO
```

{% endtab %}
{% endtabs %}


# 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 I**mage 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](/quick-start/using-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.<br>

### **Using with PropulsionAI SDK**

{% content-ref url="/pages/tMRAxvFbmCHMdkBxiTVa" %}
[Installing the SDK](/introduction/installing-the-sdk)
{% endcontent-ref %}

{% tabs %}
{% tab title="Typescript" %}
Using Knowledgebases for inference as simple as adding `knowledgebases` key with the array of knowledgebase codes.

```javascript
// 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();
```

{% endtab %}

{% tab title="Python" %}
Using Knowledgebases for inference as simple as adding `knowledgebases` key with the array of knowledgebase codes.

```python
# Without streaming
def sync_main() -> None:
    response = client.chat.completions.create(
        deployment="<deployment_id>",
        knowledgebases=["<knowledgebase_code_1>", "<knowledgebase_code_2>"],
        messages=[
            {
                "role": "user",
                "content": "Hello, How are you?",
            }
        ],
        stream=False,
    )

    print(response)

sync_main()
```

```python
# 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();
```

{% endtab %}
{% endtabs %}


# Projects

Overview of how to create and manage projects in PropulsionAI.


# Models & Versions

Explanation of model management, versioning, and best practices.


# Knowledge Base

How to create, manage, and leverage a knowledge base for your models.


# Datasets

Detailed guide on dataset creation, management, and integration.


# Deployments

Steps to deploy models and manage environments.


# API Keys

How to generate, manage, and secure API keys for accessing services.


# FAQs

Welcome to the PropulsionAI FAQ section!&#x20;

Here you'll find answers to some of the most common questions our users have. If you don't find the answer you're looking for, feel free to reach out to our support team.

<details>

<summary>What is PropulsionAI?</summary>

**PropulsionAI** is a platform designed to simplify and accelerate the development, fine-tuning, and deployment of custom Large Language Models (LLMs). It provides tools for managing datasets, creating models, fine-tuning, deploying, and integrating these models into your applications.

</details>

<details>

<summary>How do I get started with PropulsionAI?</summary>

To get started, sign up at <https://app.propulsionhq.com/signup>. After creating your account, you can create a new project, upload a dataset, fine-tune a model, and deploy it using the quick start guides provided in our documentation.

</details>

<details>

<summary>What are foundational models, and how can I use them?</summary>

Foundational models are pre-trained models provided by PropulsionAI that you can fine-tune with your own data or deploy directly without further customization. These models serve as a base for your AI projects, saving time and resources. You can choose a foundational model during the model creation process.

</details>

<details>

<summary>What is fine-tuning, and why do I need it?</summary>

Fine-tuning is the process of customizing a pre-trained model using your specific dataset to make it more accurate and aligned with your use case. Fine-tuning helps improve the model's performance by training it on data that is relevant to your particular application.

</details>

<details>

<summary>How do I upload a dataset?</summary>

You can upload a dataset in the **"Datasets"** section of your project. Supported formats include JSONL, JSON, and CSV. After uploading, you'll need to map the columns to ensure the data is correctly interpreted by PropulsionAI. You can also record datasets using SDK or deployments.

</details>

<details>

<summary>What happens if I lose my API keys?</summary>

If you lose your API keys, you'll need to regenerate them. This will invalidate the old keys, causing any applications using those keys to lose access. Make sure to store your keys securely as they will only be visible once during generation.

</details>

<details>

<summary>How do I set up billing?</summary>

Billing setup is required before generating API keys. You will receive $25 in free credits upon signing up. To set up billing, go to the **"Billing"** section and add a payment method by clicking **"Add Card."** Your balance will be visible in the billing section.

</details>

<details>

<summary>Can I request a specific model not available in the platform?</summary>

Yes, you can request additional models by emailing us at <support@propulsionhq.com> or sending a message on our [Discord channel](https://discord.gg/J4RF7phwYN). We continuously work to expand our model offerings to meet your needs.

</details>

<details>

<summary>How do I deploy a model?</summary>

To deploy a model, go to the **"Deployments"** section, create a new deployment, select the model version, configure the hardware, and set the number of replicas. You can also choose to record conversations if needed. Once configured, click **"Deploy"** to make your model available for production use.

</details>

<details>

<summary>What is the Knowledge Base, and how do I use it?</summary>

The Knowledge Base is a feature that allows you to store and manage domain-specific information that your models can reference. You can create a Knowledge Base by uploading files (PDF, DOCX, images) or adding textual content manually. It can be accessed in the Playground or through the SDK to enhance your model's accuracy and relevance.

</details>

<details>

<summary>What is the cost associated with using PropulsionAI?</summary>

Costs in PropulsionAI are based on the duration of training and deployment runs, determined by your hardware selection. Additionally, storage costs apply to datasets, and while charges for the Knowledge Base (storage, reads, and writes) will be implemented later, it's currently free during the beta period. Monitor your balance in the billing section to manage your budget effectively.

</details>


# Understanding Usage Costs

PropulsionAI is designed to provide powerful, flexible AI tools that scale with your needs. Understanding the costs associated with using these tools is crucial for managing your projects effectively. This page breaks down how costs are incurred and offers guidance on how to optimize your budget.

### **1. Training Runs**

**Costs are incurred based on the duration of your training runs.**

* The hardware you select plays a significant role in determining these costs. More powerful hardware, like A100 or H100 GPUs, will incur higher costs due to their advanced capabilities. Conversely, selecting less powerful hardware like L4 or T4 GPUs will help keep costs lower.

:bulb: **Tip:** Estimate the expected training time and choose hardware that balances performance and cost according to your project’s needs.

### **2. Deployment Runs**

**Costs accumulate based on the duration your model is deployed.**

* Similar to training, the cost of deploying a model depends on the hardware selected and the time the deployment remains active. Whether your model is set to scale with demand or maintain a fixed number of instances, these choices impact your costs.

:bulb: **Tip:** Scale your deployments dynamically to meet demand while minimizing idle time, which can help optimize costs.

### **3. Knowledge Base**

**While in beta, Knowledge Base usage is free, but charges will apply in the future for storage, reads, and writes.**

* The Knowledge Base allows you to store, retrieve, and manage domain-specific information. Once out of beta, you’ll be charged for the storage used, as well as for reading from and writing to the Knowledge Base.

:bulb: **Tip:** Optimize your Knowledge Base by storing only the most relevant information and minimizing unnecessary reads and writes.

### **4. Datasets**

**Costs are associated with the storage of your datasets.**

* When you upload and manage datasets in PropulsionAI, storage costs apply based on the size and number of datasets. Ensuring that you only store necessary and high-quality data can help control these costs.

:bulb: **Tip:** Regularly review and clean your datasets to avoid storing redundant or outdated data, thus keeping storage costs manageable.

### **Monitoring and Managing Costs**

To keep your expenses in check, PropulsionAI provides a detailed **billing** section where you can monitor your balance, view your usage history, and add funds as needed. Here are some strategies for managing costs:

* **Choose Appropriate Hardware**: Balance your need for performance with your budget by selecting hardware that aligns with your project requirements.
* **Monitor Usage**: Keep an eye on your training and deployment durations to avoid unnecessary costs.
* **Leverage Free Features During Beta**: Take advantage of the Knowledge Base while it’s free, and use this time to plan how you’ll manage these costs once charges are implemented.

Understanding these cost factors will allow you to better plan and manage your AI projects, ensuring that you get the most value from PropulsionAI while staying within budget.


# Community & Support

How to get help, contribute, and join the PropulsionAI community.

At PropulsionAI, we believe that a strong community and reliable support are key to helping you succeed with your AI projects. Whether you’re just getting started or need advanced technical assistance, we’re here to help. Explore the resources below to connect with other users, get answers to your questions, and find the support you need.

### **1. Join the Community**

Connect with fellow PropulsionAI users, share your experiences, and learn from others in our growing community. Here's how you can get involved:

* **Discord Channel**: [Join our Discord community](https://discord.gg/J4RF7phwYN) to participate in discussions, ask questions, and get real-time support from both the PropulsionAI team and other users. Whether you’re troubleshooting an issue or sharing tips, Discord is the place to be.

### **2. Documentation & Tutorials**

Our comprehensive documentation and tutorials are designed to help you make the most of PropulsionAI:

* **Documentation**: Explore our documentation for detailed guides on every aspect of the platform, from setting up your first project to deploying complex models.
* **Tutorials**: Check out our tutorials section for step-by-step walkthroughs on specific tasks and use cases. Whether you're a beginner or an experienced user, our tutorials can help you level up your skills.

### **3. Contact Support**

If you need personalized assistance, our support team is ready to help:

* **Email Support**: Reach out to us directly via email at <support@propulsionhq.com>. We strive to respond to all inquiries promptly and thoroughly.
* **Support Chat**: For immediate assistance, use the chat feature available in the bottom right corner of the platform. Our support team or a community member will be there to help you in real-time.

### **4. Stay Updated**

Keep up with the latest news, updates, and releases from PropulsionAI:

* **Newsletter**: Subscribe to our newsletter to receive regular updates on new features, tutorials, community highlights, and more.
* **Social Media**: Follow us on [Twitter](https://x.com/propulsion_ai), [LinkedIn](https://www.linkedin.com/company/propulsionhq/), and [GitHub](https://github.com/propulsion-ai) for announcements, tips, and to see what others are building with PropulsionAI.


# Our Commitment

Our commitment towards transparency, ownership, privacy and open-source.

At PropulsionAI, our mission goes beyond providing cutting-edge AI tools. We are deeply committed to the principles of transparency, ownership, and privacy. These values are the foundation of our platform, guiding every decision we make and every feature we develop. Here’s how our commitment benefits you:

### **1. Transparency**

Transparency is at the heart of everything we do:

* **Clear Communication**: We believe in open and honest communication with our users. Whether it’s about pricing, features, or platform updates, we strive to provide clear and comprehensive information. There are no hidden fees, and we ensure that you understand the full scope of our services.
* **Model Insights**: With PropulsionAI, you have full visibility into your models. From training data to model performance, we provide detailed insights that allow you to understand how your models work and make informed decisions.
* **Platform Roadmap**: We share our platform roadmap with our users, giving you a glimpse into future features and improvements. Your feedback directly influences our development priorities, ensuring that we build the tools you need.

### **2. Ownership**

We believe that you should have complete control over your data and models:

* **Data Ownership**: Your data is yours, and it stays that way. We do not share your data with any third parties, use it to train our or other models, or employ it in any way other than as directed by you. You have full control over how your data is used within the platform.
* **Data Deletion**: You can request the deletion of all your data at any point. We ensure that once requested, your data is permanently removed from our systems, giving you peace of mind.
* **Custom Deployments for Pro Customers**: Pro customers have the option to host their data, training, and deployments on their own cloud infrastructure. This ensures that not a bit of your data ever leaves your secure environment, providing the highest level of data sovereignty.
* **On-Prem Deployment for Enterprise Customers**: For our enterprise customers, we offer the option of air-gapped on-premises deployment, including features such as Single Sign-On (SSO). This allows you to integrate PropulsionAI seamlessly into your existing infrastructure while keeping all data securely within your organization.

### **3. Privacy**

Protecting your privacy is one of our highest priorities:

* **Data Security**: We implement robust security measures to protect your data at all times. From encryption to access controls, we ensure that your data is safe from unauthorized access.
* **Privacy by Design**: Our platform is built with privacy in mind from the ground up. We adhere to strict privacy standards and ensure that our processes and technologies align with global data protection regulations.
* **No Data Sharing**: We do not share your data with third parties, use it to train other models, or utilize it in any other way beyond your intended purposes. Your data remains confidential and under your control.

### **4. Commitment to Open Source**

Our commitment to open source reflects our belief in a more open and collaborative future:

* **Open Source Contributions**: We actively contribute to the open-source community, supporting projects that foster innovation and transparency in AI development.
* **An Open Future**: We envision a future where open source plays a crucial role in advancing AI technology, ensuring that the benefits of AI are accessible to all. Our platform is built with open standards in mind, and we encourage the use and contribution of open-source technologies.

### **Our Promise to You**

We are dedicated to building a platform that respects your values and meets your needs. Our commitment to transparency, ownership, and privacy ensures that you can trust PropulsionAI to support your AI projects without compromising your principles. With options for custom and on-prem deployments, and our strong inclination towards open source, we are committed to delivering a platform that empowers you while maintaining the highest standards of data security and openness.


# What we do

Crafting Tomorrow’s AI with Seamless LLM Fine-Tuning

## Video overview

Got 2 minutes? Check out a video overview of our product:

{% embed url="<https://www.youtube.com/watch?v=b7SVJBkACKo>" %}


# Our Features

## Dataset Management

* **Data Integration**: Collect data from a wide range of sources, including embedded agent collectors, databases, cloud storage services like Google Drive and OneDrive.
* **Data Cleaning and Transformation**: Utilize our proprietary AI model, "Astro," to automate the preprocessing and transformation of data into formats suitable for instruction-based LLMs.

## Efficient Model Training and Fine-Tuning

* **Customizable Fine-Tuning**: Leverage your own hardware or use PropulsionAI's infrastructure for fine-tuning models to meet specific requirements.
* **Instruction-Based LLM Preparation**: Convert data into formats such as question and answer formats, significantly reducing the time and effort needed for model training.

## Comprehensive Model Evaluation

* **Orion Model**: Evaluate your trained LLMs against publicly available models like Claude and GPT-4, as well as previous versions of your own models, to obtain detailed performance reports.
* **Performance Metrics**: Gain insights into model accuracy, efficiency, and other critical performance indicators.

## Seamless Deployment

* **Flexible Deployment Options**: Deploy your models on PropulsionAI's service with an OpenAI-compatible REST API or on your own hardware.
* **OpenAI-Compatible API**: Ensure compatibility and ease of integration with existing systems and workflows.

## Future-Proof Features

* **Reinforcement Learning with Human Feedback (RLHF)**: Upcoming updates will include RLHF to enhance model training and performance.
* **Function Calling and State Management**: Our platform supports function calling via engineered system prompts and state management using LLM State Machines.


# Why Choose PropulsionAI?

PropulsionAI is designed to be the backbone of your AI development projects, offering unparalleled support and automation at every step. Our platform not only saves time but also ensures the highest s

* **Accelerate Development**: Reduce the time needed to go from data collection to model deployment.
* **Enhance Accuracy**: Utilize advanced evaluation tools to ensure your models meet the highest standards.
* **Simplify Integration**: Deploy your models effortlessly with our OpenAI-compatible API.
* **Stay Ahead**: Benefit from cutting-edge features and continuous updates, keeping you at the forefront of AI technology.

Join us on this journey to transform how you develop and deploy AI solutions. With PropulsionAI, the future of custom LLMs is here, and it's more accessible and powerful than ever before.

{% content-ref url="/pages/qJqVkMpFdsundt5OXq9z" %}
[Product Guide](/product-guide/product-guide)
{% endcontent-ref %}

{% content-ref url="/pages/b6bMWf4IAb2SyGwFvhKd" %}
[Developer Guide](/developer-guide/generate-an-api-key)
{% endcontent-ref %}


# Product Guide

## Create an Account

To begin your journey with PropulsionAI, follow these steps to create an account:

**Sign Up**: Visit our <https://app.propulsionhq.com/signup>. Fill in the required details to create your account.

**Default Team and Project**: Upon creating an account, you will be assigned a default team and a default project. These will serve as your starting points for managing your models and data.

## Projects Overview

Once your account is set up, you can manage your AI projects. From the Projects section, you have two main paths to follow:

{% content-ref url="/pages/gtbs0Uo3lkRMaIm246sL" %}
[Deploy an Open Source Model](/product-guide/deploy-an-open-source-model)
{% endcontent-ref %}

{% content-ref url="/pages/s8c9bUjkDoImY8SYbsa7" %}
[Train Your Own Model](/product-guide/train-your-own-model)
{% endcontent-ref %}


# Deploy an Open Source Model

Deploying an open-source model is straightforward. Follow these steps:

* **Select a Model**: Choose an open-source model from our library or upload your own.
* **Deploy the Model**: Click on the "Deploy" button to initiate the deployment process.

**Optional Steps:**

* **Auto Record Conversations into a Dataset**: Enable this feature to automatically record all conversations into a dataset for future training or analysis.
* **Upload Knowledge Base**: Optionally, you can upload a knowledge base to enhance the model's responses with specific information relevant to your needs.


# Train Your Own Model

To train your own custom model, follow these steps:

* **Upload Dataset**: Prepare and upload your dataset. Ensure it is in the appropriate format (e.g., Q\&A format for instruction-based LLMs).
* **Create a Model Version**: Navigate to the "Models" section and click on "Create New Version" to define a new version of your model.
* **Start Training**: Click on the "Start Training" button to begin the training process. Monitor the training progress through the dashboard.
* **Deployment**: Once training is complete, you can deploy your model:
  * **Deploy the Model**: Click on the "Deploy" button.
  * **Auto Record Conversations into a Dataset** (optional): Enable this feature for continuous improvement.
  * **Upload Knowledge Base** (optional): Add a knowledge base to enhance the model's capabilities.


# Generate an API Key

To use the PropulsionAI services, you need an API key. Follow these steps to generate one

1. **Log In**: Sign in to your PropulsionAI account.
2. **API Key Section**: Navigate to the "API Keys" section in your account settings.
3. **Generate Key**: Click on "Generate New API Key" and copy the key for future use. Keep it secure and do not share it publicly.


# Install PropulsionAI

You can interact with PropulsionAI either through our SDKs or directly via the REST API.

{% tabs %}
{% tab title="NodeJS" %}

```javascript
npm install propulsionai
// Using Yarn
yarn add propulsionai
```

{% endtab %}

{% tab title="Python" %}

```python
pip install propulsionai
```

{% endtab %}
{% endtabs %}


# Chat

To perform a basic chat completion:

{% tabs %}
{% tab title="NodeJS (TS)" %}

```typescript
import PropulsionAI from 'propulsionai';
import {
  ModelChatResponse,
  ModelChatParams
} from 'propulsionai/resources/models';

const p8n = new PropulsionAI({
  bearerToken: process.env['PROPULSIONAI_BEARER_TOKEN'] as string,
});

async function main() {
  try {
    let deployment_tag: string = '<deployment_tag>';
    let params: ModelChatParams = {
      messages: [
        {
          role: 'system',
          content: "You are an amazing poet.",
        },
        {
          role: 'user',
          content: "Can you write a poem about Tesla, the innovator?",
        },
      ],
      model: 'auto',
      stream: false,
      wait: true,
    };
    let response: ModelChatResponse;
    try{
      response = await p8n.models.ep(deployment_tag, params);
    }catch(e){
      console.log('Error:', e);
      return;
    }
    console.log("Task ID:", response.task_id);
    if(response.choices) {
      response.choices.forEach((choice) => {
        console.log(`${choice.message?.role}: ${choice.message?.content}`);
      });
    }
  } catch (error) {
    console.error('Error during model call:', error);
  }
}

main();

```

{% endtab %}

{% tab title="NodeJS (JS)" %}

```javascript
import PropulsionAI from 'propulsionai';

const p8n = new PropulsionAI({
  bearerToken: process.env['PROPULSIONAI_BEARER_TOKEN'],
});

async function main() {
  try {
    let deployment_tag = '<deployment_tag>';
    let params = {
      messages: [
        {
          role: 'system',
          content: "You are an amazing poet.",
        },
        {
          role: 'user',
          content: "Can you write a poem about Tesla, the innovator?",
        },
      ],
      model: 'auto',
      stream: false,
      wait: true,
    };
    let response;
    try{
      response = await p8n.models.ep(deployment_tag, params);
    }catch(e){
      console.log('Error:', e);
      return;
    }
    console.log("Task ID:", response.task_id);
    if(response.choices) {
      response.choices.forEach((choice) => {
        console.log(`${choice.message?.role}: ${choice.message?.content}`);
      });
    }
  } catch (error) {
    console.error('Error during model call:', error);
  }
}

main();
```

{% endtab %}

{% tab title="Python" %}

```python
import os
from propulsionai import AsyncPropulsionAI
from propulsionai.models import ModelChatResponse

# Initialize AsyncPropulsionAI with bearer token from environment variables
p8n = AsyncPropulsionAI(
    bearer_token=os.environ.get("PROPULSIONAI_BEARER_TOKEN"),
)

async def main() -> None:
    try:
        response: ModelChatResponse = await p8n.models.ep(
            '<deployment_tag>',
            messages=[
                {
                    "role": "system",
                    "content": "You are an amazing poet.",
                },
                {
                    "role": 'user',
                    "content": "Can you write a poem about Tesla, the innovator?",
                },
            ],
            model="auto",
            stream=False,
            wait=True,
        )
        print(response.id)
        print(response.content)
    except Exception as e:
        print(f"Error during model call: {e}")

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

```

{% endtab %}

{% tab title="cURL" %}

```bash
# Inference Call
curl -X "POST" "https://api.propulsionhq.com/api/v1/chat/<deployment_tag>?wait=true" \
     -H 'Authorization: Bearer <PROPULSIONAI_BEARER_TOKEN>' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "messages": [
    {
      "role": "system",
      "content": "You are an amazing poet."
    },
    {
      "role": "user",
      "content": "Can you write a poem about Tesla, the innovator?"
    }
  ],
  "model": "auto",
}'
```

{% endtab %}
{% endtabs %}


# Function Calling

To perform a function calling:

{% tabs %}
{% tab title="NodeJS (TS)" %}

```typescript
import PropulsionAI from 'propulsionai';
import {
  ModelChatResponse,
  ModelChatParams
} from 'propulsionai/resources/models';

// Initialize PropulsionAI with bearer token from environment variables
const p8n = new PropulsionAI({
  bearerToken: process.env['PROPULSIONAI_BEARER_TOKEN'] as string,
});

// Example dummy function hardcoded to return the same weather
// In production, this could be your backend API or an external API
interface WeatherParameters {
  location: string;
  unit?: string;
}
function getCurrentWeather(parameters: WeatherParameters): string {
  let { location } = parameters;

  if (location.toLowerCase().includes("tokyo")) {
    return JSON.stringify({ location: "Tokyo", temperature: "10", unit: "celsius" });
  } else if (location.toLowerCase().includes("san francisco")) {
    return JSON.stringify({ location: "San Francisco", temperature: "72", unit: "fahrenheit" });
  } else if (location.toLowerCase().includes("paris")) {
    return JSON.stringify({ location: "Paris", temperature: "22", unit: "fahrenheit" });
  } else {
    return JSON.stringify({ location, temperature: "unknown" });
  }
}

async function main() {
  const tools: Array<ModelChatParams.Tool> = [
    {
      type: "function",
      function: {
        name: "get_current_weather",
        description: "Get the current weather in a given location",
        function: getCurrentWeather, // Optional: Link your actual function
        parameters: {
          type: "object",
          properties: {
            location: {
              type: "string",
              description: "The city and state, e.g., San Francisco, CA",
            },
            unit: {
              type: "string",
              enum: ["celsius", "fahrenheit"]
            },
          },
          required: ["location"],
          example: `get_current_weather("Tokyo", "celsius")`
        },
      },
    },
  ];
  let deployment_tag: string = '<deployment_tag>';
  let params: ModelChatParams = {
    tools: tools,
    messages: [
      {
        role: 'system',
        content: "You are a weatherman.",
      },
      {
        role: 'user',
        content: "What is the weather of Tokyo?",
      },
    ],
    model: 'auto',
    stream: false,
    wait: true,
  };

  let response: ModelChatResponse;
  try {
    response = await p8n.models.epAuto(deployment_tag, params);
  } catch (e) {
    console.log('Error:', e);
    return;
  }
  console.log("Task ID:", response.task_id);
  if (response.choices) {
    response.choices.forEach((choice) => {
      console.log(`${choice.message?.role}: ${choice.message?.content}`);
    });
  }
  if (response.toolCalls) {
    response.toolCalls.forEach((toolCall) => {
      console.log(`${toolCall.function?.name}: ${JSON.stringify(toolCall.function?.parameters)}`);
    });
  }
}

main();
```

{% endtab %}

{% tab title="NodeJS (JS)" %}

```javascript
import PropulsionAI from 'propulsionai';
// Initialize PropulsionAI with bearer token from environment variables
const p8n = new PropulsionAI({
  bearerToken: process.env['PROPULSIONAI_BEARER_TOKEN'],
});

// Example dummy function hardcoded to return the same weather
// In production, this could be your backend API or an external API
function getCurrentWeather(parameters) {
  let { location } = parameters;

  if (location.toLowerCase().includes("tokyo")) {
    return JSON.stringify({ location: "Tokyo", temperature: "10", unit: "celsius" });
  } else if (location.toLowerCase().includes("san francisco")) {
    return JSON.stringify({ location: "San Francisco", temperature: "72", unit: "fahrenheit" });
  } else if (location.toLowerCase().includes("paris")) {
    return JSON.stringify({ location: "Paris", temperature: "22", unit: "fahrenheit" });
  } else {
    return JSON.stringify({ location, temperature: "unknown" });
  }
}

async function main() {
  const tools = [
    {
      type: "function",
      function: {
        name: "get_current_weather",
        description: "Get the current weather in a given location",
        function: getCurrentWeather, // Optional: Link your actual function
        parameters: {
          type: "object",
          properties: {
            location: {
              type: "string",
              description: "The city and state, e.g., San Francisco, CA",
            },
            unit: {
              type: "string",
              enum: ["celsius", "fahrenheit"]
            },
          },
          required: ["location"],
          example: `get_current_weather("Tokyo", "celsius")` // Optional: Provide an example
        },
      },
    },
  ];
  let deployment_tag = '<deployment_tag>';
  let params = {
    tools: tools,
    messages: [
      {
        role: 'system',
        content: "You are a weatherman.",
      },
      {
        role: 'user',
        content: "What is the weather of Tokyo in F?",
      },
    ],
    model: 'auto',
    stream: false,
    wait: true,
  };

  let response;
  try {
    response = await p8n.models.epAuto(deployment_tag, params);
  } catch (e) {
    console.log('Error:', e);
    return;
  }
  console.log("Task ID:", response.task_id);
  if (response.choices) {
    response.choices.forEach((choice) => {
      console.log(`${choice.message?.role}: ${choice.message?.content}`);
    });
  }
  if (response.toolCalls) {
    response.toolCalls.forEach((toolCall) => {
      console.log(`${toolCall.function?.name}: ${JSON.stringify(toolCall.function?.parameters)}`);
    });
  }
}

main();
```

{% endtab %}

{% tab title="Python" %}

```python
import os
from typing import Any, Dict, Callable, Coroutine
from propulsionai import AsyncPropulsionAI
from propulsionai.models import ModelChatResponse

# Initialize AsyncPropulsionAI with bearer token from environment variables
p8n = AsyncPropulsionAI(
    bearer_token=os.environ.get("PROPULSIONAI_BEARER_TOKEN"),
)

# Example dummy function hard coded to return the same weather
# In production, this could be your backend API or an external API
async def get_current_weather(location: str, unit: str = "fahrenheit") -> str:
    if "tokyo" in location.lower():
        return '{"location": "Tokyo", "temperature": "10", "unit": "celsius"}'
    elif "san francisco" in location.lower():
        return '{"location": "San Francisco", "temperature": "72", "unit": "fahrenheit"}'
    elif "paris" in location.lower():
        return '{"location": "Paris", "temperature": "22", "unit": "fahrenheit"}'
    else:
        return f'{{"location": "{location}", "temperature": "unknown"}}'

# Function map to map the function name to the actual function
available_function_map: Dict[str, Callable[..., Coroutine[Any, Any, str]]] = {
    "get_current_weather": get_current_weather,
}

async def main() -> None:
    tools = [
        {
            "type": "function",
            "function": {
                "name": "get_current_weather",
                "description": "Get the current weather in a given location",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "location": {
                            "type": "string",
                            "description": "The city and state, e.g., San Francisco, CA",
                        },
                        "unit": { 
                            "type": "string", 
                            "enum": ["celsius", "fahrenheit"] 
                        },
                    },
                    "required": ["location"],
                },
            },
        },
    ]
    
    try:
        response: ModelChatResponse = await p8n.models.ep_auto(
            '<deployment_tag>',
            available_function_map=available_function_map,
            tools=tools,
            messages=[
                {
                    "role": "system",
                    "content": "You are a weatherman.",
                },
                {
                    "role": 'user',
                    "content": "What is the weather of Tokyo?",
                },
            ],
            model="auto",
            stream=False,
            wait=True,
        )
        print(response.id)
        print(response.content)
    except Exception as e:
        print(f"Error during model call: {e}")

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())


```

{% endtab %}

{% tab title="cURL" %}

```bash
# Inference Call
curl -X "POST" "https://api.propulsionhq.com/api/v1/chat/<deployment_tag>?wait=true" \
     -H 'Authorization: Bearer <PROPULSIONAI_BEARER_TOKEN>' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d '{
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_current_weather",
        "description": "Get the current weather in a given location",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "The city and state, e.g., San Francisco, CA"
            },
            "unit": { 
              "type": "string", 
              "enum": ["celsius", "fahrenheit"] 
            }
          },
          "required": ["location"]
        }
      }
    }
  ],
  "tool_choice": "auto",
  "messages": [
    {
      "role": "system",
      "content": "You are a weatherman."
    },
    {
      "role": "user",
      "content": "What is the weather of Tokyo"
    }
  ],
  "model": "auto"
}'

```

{% endtab %}
{% endtabs %}


# Knowledge base

To use a private, secure and encrypted Knowledge base:

## Create a Knowledge base.

1. Login to PropulsionAI
2. Goto Knowledge base.
3. Create a new Knowledge base.
4. Upload documents to Knowledge base.

{% hint style="info" %}
For large documents, wait for document processing to be completed.
{% endhint %}

## Inference

{% tabs %}
{% tab title="NodeJS (TS)" %}

```javascript
import PropulsionAI from 'propulsionai';
import {
  ModelChatResponse,
  ModelChatParams
} from 'propulsionai/resources/models';

const p8n = new PropulsionAI({
  bearerToken: process.env['PROPULSIONAI_BEARER_TOKEN'] as string,
});

async function main() {
  try {
    let deployment_tag: string = '<deployment_tag>';
    let knowledgebases: Array<string> = ["<knowledgebase_id>"]
    let params: ModelChatParams = {
      knowledgebases: knowledgebases,
      messages: [
        {
          role: 'user',
          content: "What are the key improvements in US-X2090249-B00?",
        },
      ],
      model: 'auto',
      stream: false,
      wait: true,
    };
    let response: ModelChatResponse;
    try{
      response = await p8n.models.ep(deployment_tag, params);
    }catch(e){
      console.log('Error:', e);
      return;
    }
    console.log("Task ID:", response.task_id);
    if(response.choices) {
      response.choices.forEach((choice) => {
        console.log(`${choice.message?.role}: ${choice.message?.content}`);
      });
    }
  } catch (error) {
    console.error('Error during model call:', error);
  }
}

main();

```

{% endtab %}

{% tab title="NodeJS (JS)" %}

```
import PropulsionAI from 'propulsionai';

const p8n = new PropulsionAI({
  bearerToken: process.env['PROPULSIONAI_BEARER_TOKEN'],
});

async function main() {
  try {
    let deployment_tag = '<deployment_tag>';
    let knowledgebases = ["<knowledgebase_id>"]
    let params = {
      knowledgebases: knowledgebases,
      messages: [
        {
          role: 'user',
          content: "What are the key improvements in US-X2090249-B00?",
        },
      ],
      model: 'auto',
      stream: false,
      wait: true,
    };
    let response;
    try{
      response = await p8n.models.ep(deployment_tag, params);
    }catch(e){
      console.log('Error:', e);
      return;
    }
    console.log("Task ID:", response.task_id);
    if(response.choices) {
      response.choices.forEach((choice) => {
        console.log(`${choice.message?.role}: ${choice.message?.content}`);
      });
    }
  } catch (error) {
    console.error('Error during model call:', error);
  }
}

main();

```

{% endtab %}

{% tab title="Python" %}

```python
import os
from propulsionai import AsyncPropulsionAI
from propulsionai.models import ModelChatResponse

# Initialize AsyncPropulsionAI with bearer token from environment variables
p8n = AsyncPropulsionAI(
    bearer_token=os.environ.get("PROPULSIONAI_BEARER_TOKEN"),
)

async def main() -> None:
    try:
        response: ModelChatResponse = await p8n.models.ep_auto(
            '<deployment_tag>',
            knowledgebases=[<knowledgebase_id_1>, <knowledgebase_id_2>],
            messages=[
                {
                    "role": "user",
                    "content": "Share 3 key features about under-development KB-9982 drone.",
                },
            ],
            model="auto",
            stream=False,
            wait=True,
        )
        print(response)
    except Exception as e:
        print(f"Error during model call: {e}")

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

```

{% endtab %}

{% tab title="cURL" %}

```bash
# Inference Call
curl -X "POST" "https://api.propulsionhq.com/api/v1/chat/<deployment_tag>?wait=true" \
     -H 'Authorization: Bearer <PROPULSIONAI_BEARER_TOKEN>' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d '{
  "knowledgebases": [<knowledgebase_id_1>, <knowledgebase_id_2>],
  "messages": [
    {
      "role": "user",
      "content": "Share 3 key features about under-development KB-9982 drone."
    }
  ],
  "model": "auto",
  "stream": false
}'

```

{% endtab %}
{% endtabs %}


# Support

We're here to assist you with any questions or issues you may have.

### GitHub Projects

We offer SDKs for both Node.js and Python to help you integrate PropulsionAI into your projects seamlessly. You can find our SDKs on GitHub:

* **Node.js SDK**: [propulsion-ai/propulsionai-node](https://github.com/propulsion-ai/propulsionai-node)
* **Python SDK**: [propulsionai-python](https://github.com/propulsion-ai/propulsionai-python)

### Contact Support

If you need direct assistance or have specific questions, please reach out to our support team:

* **Email**: <dev-support@propulsionhq.com>

### Community Support

Join our community on Discord to get help from other developers and the PropulsionAI team. Our Discord channel will be launching soon, so stay tuned for updates!

### Frequently Asked Questions

For quick answers to common questions, visit our FAQ.

Thank you for using PropulsionAI! We’re here to ensure you have a smooth and productive experience.


