ai-lab-transformers-playground/postman/AI_Lab_API.postman_collecti...

614 lines
16 KiB
JSON

{
"info": {
"_postman_id": "ai-lab-api-collection",
"name": "AI Lab API - Complete Collection",
"description": "Complete Postman collection for AI Lab API with all endpoints for NLP pipelines using transformers",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "ai-lab"
},
"variable": [
{
"key": "base_url",
"value": "http://localhost:8000",
"type": "string",
"description": "Base URL for AI Lab API"
}
],
"item": [
{
"name": "🏠 Core Endpoints",
"item": [
{
"name": "Root - API Information",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/",
"host": ["{{base_url}}"],
"path": [""]
},
"description": "Get API information and available endpoints"
},
"response": []
},
{
"name": "Health Check",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/health",
"host": ["{{base_url}}"],
"path": ["health"]
},
"description": "Check API health status and loaded pipelines"
},
"response": []
}
],
"description": "Core API endpoints for health check and information"
},
{
"name": "💭 Sentiment Analysis",
"item": [
{
"name": "Analyze Sentiment - Positive",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"text\": \"I absolutely love this project! It's amazing and well-designed.\"\n}"
},
"url": {
"raw": "{{base_url}}/sentiment",
"host": ["{{base_url}}"],
"path": ["sentiment"]
},
"description": "Analyze sentiment of positive text"
},
"response": []
},
{
"name": "Analyze Sentiment - Negative",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"text\": \"This is terrible and I hate it completely.\"\n}"
},
"url": {
"raw": "{{base_url}}/sentiment",
"host": ["{{base_url}}"],
"path": ["sentiment"]
},
"description": "Analyze sentiment of negative text"
},
"response": []
},
{
"name": "Analyze Sentiment - Custom Model",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"text\": \"This product is okay, nothing special.\",\n \"model_name\": \"cardiffnlp/twitter-roberta-base-sentiment-latest\"\n}"
},
"url": {
"raw": "{{base_url}}/sentiment",
"host": ["{{base_url}}"],
"path": ["sentiment"]
},
"description": "Analyze sentiment using custom model"
},
"response": []
},
{
"name": "Batch Sentiment Analysis",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"texts\": [\n \"I love this!\",\n \"This is terrible.\",\n \"It's okay, nothing special.\",\n \"Amazing product, highly recommended!\",\n \"Worst experience ever.\"\n ]\n}"
},
"url": {
"raw": "{{base_url}}/sentiment/batch",
"host": ["{{base_url}}"],
"path": ["sentiment", "batch"]
},
"description": "Analyze sentiment for multiple texts"
},
"response": []
}
],
"description": "Sentiment analysis endpoints for analyzing emotional tone"
},
{
"name": "🏷️ Named Entity Recognition",
"item": [
{
"name": "Extract Entities - People & Organizations",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"text\": \"Elon Musk is the CEO of Tesla and SpaceX. He was born in South Africa and now lives in California.\"\n}"
},
"url": {
"raw": "{{base_url}}/ner",
"host": ["{{base_url}}"],
"path": ["ner"]
},
"description": "Extract named entities from text"
},
"response": []
},
{
"name": "Extract Entities - Geographic",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"text\": \"The meeting will be held in Paris, France on Monday. We'll then travel to London, United Kingdom.\"\n}"
},
"url": {
"raw": "{{base_url}}/ner",
"host": ["{{base_url}}"],
"path": ["ner"]
},
"description": "Extract geographic entities"
},
"response": []
},
{
"name": "Batch NER Processing",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"texts\": [\n \"Apple Inc. is headquartered in Cupertino, California.\",\n \"Microsoft was founded by Bill Gates and Paul Allen.\",\n \"The conference will be in Tokyo, Japan next month.\"\n ]\n}"
},
"url": {
"raw": "{{base_url}}/ner/batch",
"host": ["{{base_url}}"],
"path": ["ner", "batch"]
},
"description": "Extract entities from multiple texts"
},
"response": []
}
],
"description": "Named Entity Recognition endpoints for extracting people, places, organizations"
},
{
"name": "❓ Question Answering",
"item": [
{
"name": "Simple Q&A",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"question\": \"What is the capital of France?\",\n \"context\": \"France is a country in Europe. Paris is the capital and largest city of France. The city is known for the Eiffel Tower and the Louvre Museum.\"\n}"
},
"url": {
"raw": "{{base_url}}/qa",
"host": ["{{base_url}}"],
"path": ["qa"]
},
"description": "Answer questions based on context"
},
"response": []
},
{
"name": "Technical Q&A",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"question\": \"What programming language is mentioned?\",\n \"context\": \"FastAPI is a modern, fast web framework for building APIs with Python 3.7+. It provides automatic interactive API documentation and is built on top of Starlette and Pydantic.\"\n}"
},
"url": {
"raw": "{{base_url}}/qa",
"host": ["{{base_url}}"],
"path": ["qa"]
},
"description": "Answer technical questions"
},
"response": []
}
],
"description": "Question Answering endpoints for extracting answers from context"
},
{
"name": "🎭 Fill Mask",
"item": [
{
"name": "Fill Simple Mask",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"text\": \"The capital of France is [MASK].\"\n}"
},
"url": {
"raw": "{{base_url}}/fillmask",
"host": ["{{base_url}}"],
"path": ["fillmask"]
},
"description": "Predict masked words in sentences"
},
"response": []
},
{
"name": "Fill Technical Mask",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"text\": \"Python is a popular [MASK] language for machine learning.\"\n}"
},
"url": {
"raw": "{{base_url}}/fillmask",
"host": ["{{base_url}}"],
"path": ["fillmask"]
},
"description": "Fill technical context masks"
},
"response": []
},
{
"name": "Batch Fill Mask",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"texts\": [\n \"The weather today is [MASK].\",\n \"I like to eat [MASK] for breakfast.\",\n \"The best programming language is [MASK].\"\n ]\n}"
},
"url": {
"raw": "{{base_url}}/fillmask/batch",
"host": ["{{base_url}}"],
"path": ["fillmask", "batch"]
},
"description": "Fill masks in multiple texts"
},
"response": []
}
],
"description": "Fill Mask endpoints for predicting masked words"
},
{
"name": "🛡️ Content Moderation",
"item": [
{
"name": "Check Safe Content",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"text\": \"This is a wonderful day and I'm feeling great!\"\n}"
},
"url": {
"raw": "{{base_url}}/moderation",
"host": ["{{base_url}}"],
"path": ["moderation"]
},
"description": "Check safe, non-toxic content"
},
"response": []
},
{
"name": "Check Potentially Toxic Content",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"text\": \"I hate everything and everyone around me!\"\n}"
},
"url": {
"raw": "{{base_url}}/moderation",
"host": ["{{base_url}}"],
"path": ["moderation"]
},
"description": "Check potentially toxic content"
},
"response": []
},
{
"name": "Batch Content Moderation",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"texts\": [\n \"Have a great day!\",\n \"I'm so angry right now!\",\n \"Thank you for your help.\",\n \"This is completely stupid!\"\n ]\n}"
},
"url": {
"raw": "{{base_url}}/moderation/batch",
"host": ["{{base_url}}"],
"path": ["moderation", "batch"]
},
"description": "Moderate multiple texts for toxicity"
},
"response": []
}
],
"description": "Content Moderation endpoints for detecting toxic or harmful content"
},
{
"name": "✍️ Text Generation",
"item": [
{
"name": "Generate Creative Text",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"text\": \"Once upon a time in a magical forest\"\n}"
},
"url": {
"raw": "{{base_url}}/textgen",
"host": ["{{base_url}}"],
"path": ["textgen"]
},
"description": "Generate creative text from prompt"
},
"response": []
},
{
"name": "Generate Technical Text",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"text\": \"FastAPI is a modern Python web framework that\"\n}"
},
"url": {
"raw": "{{base_url}}/textgen",
"host": ["{{base_url}}"],
"path": ["textgen"]
},
"description": "Generate technical documentation text"
},
"response": []
},
{
"name": "Batch Text Generation",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"texts\": [\n \"In the future, AI will\",\n \"The best way to learn programming is\",\n \"Climate change is\"\n ]\n}"
},
"url": {
"raw": "{{base_url}}/textgen/batch",
"host": ["{{base_url}}"],
"path": ["textgen", "batch"]
},
"description": "Generate text from multiple prompts"
},
"response": []
}
],
"description": "Text Generation endpoints for creating text from prompts"
},
{
"name": "🧪 Testing & Examples",
"item": [
{
"name": "Complete Pipeline Test",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"text\": \"AI Lab is an amazing project for learning NLP!\"\n}"
},
"url": {
"raw": "{{base_url}}/sentiment",
"host": ["{{base_url}}"],
"path": ["sentiment"]
},
"description": "Test with project-related text"
},
"response": []
},
{
"name": "Error Handling Test - Empty Text",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"text\": \"\"\n}"
},
"url": {
"raw": "{{base_url}}/sentiment",
"host": ["{{base_url}}"],
"path": ["sentiment"]
},
"description": "Test error handling with empty text"
},
"response": []
},
{
"name": "Error Handling Test - Invalid Model",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"text\": \"Test text\",\n \"model_name\": \"non-existent-model\"\n}"
},
"url": {
"raw": "{{base_url}}/sentiment",
"host": ["{{base_url}}"],
"path": ["sentiment"]
},
"description": "Test error handling with invalid model"
},
"response": []
}
],
"description": "Testing endpoints and error handling examples"
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"// Pre-request script for all requests",
"console.log('Making request to: ' + pm.request.url);",
"",
"// Add timestamp to request",
"pm.globals.set('request_timestamp', new Date().toISOString());"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"// Common tests for all requests",
"pm.test('Response time is less than 30 seconds', function () {",
" pm.expect(pm.response.responseTime).to.be.below(30000);",
"});",
"",
"pm.test('Response has Content-Type header', function () {",
" pm.expect(pm.response.headers.get('Content-Type')).to.include('application/json');",
"});",
"",
"// Log response for debugging",
"console.log('Response status:', pm.response.status);",
"console.log('Response time:', pm.response.responseTime + 'ms');"
]
}
}
]
}