# Using the platform

## Getting Started with VYSP.AI API

Welcome to VYSP.AI, your trusted platform for AI security. This guide will help you get started with our API, walking you through the signup process, creating a gate, and using our Python library to protect a demo ChatGPT application.

To skip this tutorial and just get started with a demo project, check out the Python demo project [here](/python-client/demo-project-flask-python.md) and the TypeScript/JavaScript demo project [here](/javascript-client/demo-project-next.js.md).

### Step 1: Sign Up

1. Visit our signup page: <https://dashboard.vysp.ai/signup>.
2. Fill in the required details: your name, email, password, and other necessary information.
3. Verify your email address through the link sent to your inbox.
4. Sign up for MFA with an authenticator application. All Tenant administrators are required to enable multi-factor authentication.
5. Log in to the dashboard using your newly created credentials.

### Step 2: Creating a Gate

1. Once logged in, navigate to the Gates section: <https://dashboard.vysp.ai/gates>.
2. Click on "Create Gate".
3. Provide a name for your gate and click create.
4. Click on the Gate ID Link to view the details and modify the configuration.

### Step 3: Adding Rules

1. Once you're on the Gate Detail page, click on "Add Rule" under the newly created Input Flow.
2. Click "Create Rule" at the top right of the modal display.
3. In the "Create Rule" modal, type "prompt\_injection\_rule" in the "Rule Name" text box, and select "Prompt Injection Detection" for "Rule Type".
4. Create the rule.&#x20;

### Step 4: Retrieve your keys!

Tenant and Gate API Keys allow you to use your new Gate to protect your AI application.

1. In the top right corner, click on the dropdown menu with your username.&#x20;
2. Click the "Copy" button to copy your Tenant API Key. Save it someplace you'll remember!
3. On the Gate Detail Page, click the "Copy" button to copy your Gate API Key. Save this too!

### Step 5: Using the Python Library

#### Installation

First, you need to install the VYSP.AI Python library. You can do this using pip:

```bash
pip install vysp-python
```

#### Basic Usage

Here is an example of how to perform input and output checks using the library:

```python
from vysp import VYSPClient

# Initialize the client
client = VYSPClient(tenant_api_key='your_tenant_key', gate_api_key='your_gate_key')

prompt = 'What is VYSP.AI?'

# Perform an input check
input_response = client.check_input(client_ref_user_id='123', prompt=prompt)
print(input_response)

model_output = 'VYSP.AI is a product that allows you to configure AI guardrails easier.'

# Perform an output check
output_response = client.check_output(client_ref_user_id='123', prompt=prompt, model_output=model_output)
print(output_response)
```

Replace `'your_tenant_key'` and `'your_gate_key'` with your actual API keys.

#### Protecting a Demo ChatGPT Application

Here is a step-by-step guide to integrating VYSP.AI with a ChatGPT application using the OpenAI Python library:

**1. Import Necessary Libraries**

```python
import openai
from vysp import VYSPClient
```

**2. Set Up Your OpenAI API Key and VYSP.AI API Key**

Make sure you have your OpenAI API key and VYSP.AI API key ready.

```python
openai.api_key = 'your-openai-api-key'
client = VYSPClient(tenant_api_key='your_tenant_key', gate_api_key='your_gate_key')
```

**3. Create a Function to Send Requests through VYSP.AI**

Create a function that sends input and output through the VYSP.AI gate for validation.

```python
def secure_openai_query(prompt):
    # Validate input using VYSP.AI
    input_response = client.check_input(client_ref_user_id='123', prompt=prompt)
    
    if not input_response['flagged']:
        # Send the prompt to OpenAI's ChatGPT
        response = openai.Completion.create(
            engine="gpt-4o",
            messages=[
                {"role": "system", "content": "You are a helpful assistant."},
                {"role": "user", "content": prompt}
            ],
        )
        
        output = response.completion.choices[0].message.content
        
        # Validate output using VYSP.AI
        output_response = client.check_output(client_ref_user_id='123', prompt=prompt, model_output=output)
        
        if output_response['flagged']:
            return output
        else:
            return "The response has been flagged as unsafe by VYSP.AI."
    else:
        return "The input has been flagged as unsafe by VYSP.AI."
```

**4. Test the Integration**

You can now test your integration by querying the OpenAI model:

```python
prompt = "What is the capital of France?"
response = secure_openai_query(prompt)
print(response)
```

This function first validates the input prompt with VYSP.AI. If the input is deemed safe, it proceeds to send the prompt to OpenAI's GPT-4o model. After receiving the response, it validates the output with VYSP.AI. If both input and output are safe, it returns the model's response; otherwise, it returns an appropriate message.

### Conclusion

You have successfully set up your VYSP.AI account, created a gate, and integrated the VYSP.AI security layer into a demo ChatGPT application. For more advanced configurations and features, refer to our detailed [documentation](https://docs.vysp.ai/python-client/quick-setup-with-python-client-library).

Feel free to reach out to our support team if you have any questions or need further assistance.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vysp.ai/using-the-platform.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
