# Prof Prom (`sanatjha/prof-prom`) Actor

Professional Prompt generation

- **URL**: https://apify.com/sanatjha/prof-prom.md
- **Developed by:** [Sanat Jha](https://apify.com/sanatjha) (community)
- **Categories:** AI, Agents
- **Stats:** 1 total users, 0 monthly users, 50.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Professional Prompt Improver with Groq AI

An Apify Actor that takes your basic prompt and transforms it into a detailed, professional, and highly effective prompt optimized for your target AI model using Groq AI.

### 🌟 Features

- **Multi-Model Support**: Optimizes prompts for popular AI models including:
  - GPT-4 & GPT-3.5 Turbo (OpenAI)
  - Claude 3 (Opus, Sonnet, Haiku) (Anthropic)
  - Gemini Pro & Ultra (Google)
  - Llama 3 (Meta)
  - Mixtral (Mistral AI)

- **Intelligent Optimization**: Uses Groq AI to craft prompts that:
  - Maintain your original intent and goals
  - Add relevant context and background
  - Include clear, specific instructions
  - Define desired output format and structure
  - Leverage model-specific strengths
  - Follow best practices for each model

- **Model-Aware**: Understands each model's characteristics:
  - Context window sizes
  - Strengths and capabilities
  - Best practices and optimization techniques

### 🚀 Quick Start

#### Running Locally

1. Install dependencies:
```bash
pip install -r requirements.txt
````

2. Run the Actor:

```bash
apify run
```

#### Deploy to Apify

1. Log in to Apify:

```bash
apify login
```

2. Push to Apify Platform:

```bash
apify push
```

### 📝 Input

The Actor accepts the following input parameters:

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `user_prompt` | string | Yes | Your original prompt that you want to improve |
| `target_model` | string | Yes | The AI model you plan to use (e.g., "gpt-4", "claude-3-opus") |
| `groq_api_key` | string | Yes | Your Groq API key ([get one here](https://console.groq.com)) |

#### Example Input

```json
{
  "user_prompt": "Write a blog post about AI",
  "target_model": "gpt-4",
  "groq_api_key": "gsk_..."
}
```

### 📤 Output

The Actor outputs a dataset with the following structure:

```json
{
  "original_prompt": "Write a blog post about AI",
  "improved_prompt": "You are an expert technology writer specializing in artificial intelligence...",
  "target_model": "gpt-4",
  "model_characteristics": {
    "strengths": "advanced reasoning, complex tasks, creative writing, code generation",
    "context_window": "8K-32K tokens",
    "best_practices": "Use clear instructions, provide examples, break complex tasks into steps"
  },
  "prompt_length": 1247,
  "improvement_ratio": 45.6,
  "timestamp": "2025-12-12T10:12:26.000Z"
}
```

### 🎯 Use Cases

- **Content Creation**: Transform simple content requests into detailed briefs
- **Code Generation**: Create comprehensive coding prompts with examples and constraints
- **Analysis Tasks**: Craft detailed analytical prompts with specific frameworks
- **Creative Writing**: Develop rich creative prompts with style guides and context
- **Research**: Build thorough research prompts with methodology and scope

### 🔧 How It Works

1. **Input Processing**: Receives your basic prompt and target model selection
2. **Model Analysis**: Identifies the characteristics and best practices for your chosen model
3. **Prompt Engineering**: Uses Groq AI (Mixtral-8x7B) to craft an optimized prompt that:
   - Expands on your original idea
   - Adds relevant context and structure
   - Incorporates model-specific optimizations
   - Includes clear instructions and formatting
4. **Output Generation**: Returns the improved prompt ready to use with your target model

### 📊 Supported Models

#### OpenAI

- **GPT-4**: Advanced reasoning, complex tasks (8K-32K tokens)
- **GPT-3.5 Turbo**: Fast responses, general tasks (4K-16K tokens)

#### Anthropic

- **Claude 3 Opus**: Nuanced understanding, long-form content (200K tokens)
- **Claude 3 Sonnet**: Balanced performance, creative tasks (200K tokens)
- **Claude 3 Haiku**: Speed and efficiency (200K tokens)

#### Google

- **Gemini Pro**: Multimodal understanding, reasoning (32K tokens)
- **Gemini Ultra**: Advanced reasoning, complex problem-solving (32K tokens)

#### Meta

- **Llama 3 70B**: Strong reasoning, code generation (8K tokens)
- **Llama 3 8B**: Efficient, fast inference (8K tokens)

#### Mistral AI

- **Mixtral 8x7B**: Mixture of experts, multilingual (32K tokens)

### 🔑 Getting a Groq API Key

1. Visit [console.groq.com](https://console.groq.com)
2. Sign up or log in
3. Navigate to API Keys section
4. Create a new API key
5. Copy and use it in the Actor input

### 📁 Project Structure

```text
.actor/
├── actor.json              # Actor configuration
├── input_schema.json       # Input validation schema
└── output_schema.json      # Output data schema
src/
└── main.py                 # Main Actor logic
requirements.txt            # Python dependencies
Dockerfile                  # Container definition
```

### 🛠️ Technical Details

- **Runtime**: Python 3.11+
- **Framework**: Apify SDK for Python
- **AI Provider**: Groq AI (using Mixtral-8x7B-32768)
- **Temperature**: 0.7 (balanced creativity and consistency)
- **Max Tokens**: 2048 (detailed prompts)

### 📚 Resources

- [Apify Platform Documentation](https://docs.apify.com/platform)
- [Apify Python SDK](https://docs.apify.com/sdk/python)
- [Groq AI Documentation](https://console.groq.com/docs)
- [Prompt Engineering Guide](https://www.promptingguide.ai/)

### 💡 Tips for Best Results

1. **Be Specific**: Even basic prompts benefit from some specificity
2. **Choose the Right Model**: Select the model that matches your task complexity
3. **Review Output**: The improved prompt is a starting point - customize as needed
4. **Iterate**: Run multiple times with different models to compare approaches
5. **Combine**: Use improved prompts as templates for similar tasks

### 🤝 Support

- [Join Apify Discord](https://discord.com/invite/jyEM2PRvMU)
- [Apify Documentation](https://docs.apify.com)
- [Report Issues](https://github.com/apify/apify-sdk-python/issues)

### 📄 License

This Actor is provided as-is under the Apache 2.0 License.

***

Built with ❤️ using [Apify](https://apify.com) and [Groq AI](https://groq.com)

# Actor input Schema

## `user_prompt` (type: `string`):

The original prompt you want to improve and expand

## `target_model` (type: `string`):

The AI model you plan to use with the improved prompt

## `groq_api_key` (type: `string`):

Your Groq API key for prompt improvement (get one at https://console.groq.com)

## Actor input object example

```json
{
  "user_prompt": "Write a blog post about AI",
  "target_model": "gpt-4o"
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset containing original prompts, improved prompts, and metadata

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("sanatjha/prof-prom").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("sanatjha/prof-prom").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call sanatjha/prof-prom --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=sanatjha/prof-prom",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Prof Prom",
        "description": "Professional Prompt generation",
        "version": "1.0",
        "x-build-id": "7HLkKNyFKWbMUG3T8"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/sanatjha~prof-prom/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-sanatjha-prof-prom",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/sanatjha~prof-prom/runs": {
            "post": {
                "operationId": "runs-sync-sanatjha-prof-prom",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/sanatjha~prof-prom/run-sync": {
            "post": {
                "operationId": "run-sync-sanatjha-prof-prom",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "user_prompt",
                    "target_model",
                    "groq_api_key"
                ],
                "properties": {
                    "user_prompt": {
                        "title": "User Prompt",
                        "type": "string",
                        "description": "The original prompt you want to improve and expand"
                    },
                    "target_model": {
                        "title": "Target AI Model",
                        "enum": [
                            "o1",
                            "gpt-4o",
                            "gpt-4.1",
                            "claude-3-5-sonnet",
                            "claude-3-opus",
                            "gemini-1-5-pro",
                            "gemini-1-5-flash",
                            "llama-3-1-405b",
                            "deepseek-r1",
                            "mistral-large-2"
                        ],
                        "type": "string",
                        "description": "The AI model you plan to use with the improved prompt",
                        "default": "gpt-4o"
                    },
                    "groq_api_key": {
                        "title": "Groq API Key",
                        "type": "string",
                        "description": "Your Groq API key for prompt improvement (get one at https://console.groq.com)"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
