8000 GitHub - JariusOS/slop-standard: The place for SLOP
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

JariusOS/slop-standard

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SLOP: Because AI shouldn't be complicated

🎯 WHAT SLOP IS:

  • A pattern for AI APIs with 5 basic endpoints
  • Regular HTTP/HTTPS requests with JSON data
  • A standard way to talk to any AI service
  • Based on REST: GET and POST what you need

🚫 WHAT SLOP IS NOT:

  • A framework or library you install
  • A new technology or language
  • A specific company's product
  • An additional abstraction in any way

πŸ’‘ SLOP simply says: "AI services should work through plain web requests using patterns we've used for decades."

That's it. Just a pattern. ✨


1. CORE BELIEFS

  • Everything is an HTTP request
  • Every tool is an API endpoint
  • Every AI is accessible
  • Every developer is welcome

2. MINIMUM VIABLE ENDPOINTS

  • POST /chat // Talk to AI
  • POST /tools // Use tools
  • POST /memory // Remember stuff
  • GET /resources // Get knowledge/files/data
  • POST /pay // Handle money (optional)

3. CONNECTIONS

  • WebSocket for real-time
  • SSE for streaming
  • HTTP for everything else

🀝 THE SLOP PROMISE:

1. OPEN

  • Free to use
  • Open source
  • No vendor lock
  • Community driven

2. SIMPLE

  • REST based
  • JSON only
  • Standard HTTP
  • Zero dependencies

3. FLEXIBLE

  • Any AI model
  • Any tool
  • Any platform

πŸ“– ENDPOINT OPERATIONS (v0.0.1)

πŸ’¬ CHAT

  • POST /chat - Send messages to AI
  • GET /chat/:id - Get a specific chat
  • GET /chat - List recent chats

πŸ› οΈ TOOLS

  • GET /tools - List available tools
  • POST /tools/:tool_id - Use a specific tool
  • GET /tools/:tool_id - Get tool details

🧠 MEMORY

  • POST /memory - Store a key-value pair
  • GET /memory/:key - Get value by key
  • GET /memory - List all keys
  • PUT /memory/:key - Update existing value
  • DELETE /memory/:key - Delete a key-value pair
  • POST /memory/query - Search with semantic query

πŸ“š RESOURCES

  • GET /resources - List available resources
  • GET /resources/:id - Get a specific resource
  • GET /resources/search?q=query - Search resources

πŸ’³ PAY

  • POST /pay - Create a payment
  • GET /pay/:id - Get payment status

πŸš€ API EXAMPLES - ALL ENDPOINTS

πŸ’¬ CHAT ENDPOINTS

POST /chat

// REQUEST
POST /chat
{
  "messages": [
    {"role": "user", "content": "Hello, what's the weather like?"}
  ],
  "model": "any-model-id"
}

// RESPONSE
{
  "id": "chat_123",
  "message": {
    "role": "assistant", 
    "content": "I don't have real-time weather data. You could check a weather service for current conditions."
  }
}

GET /chat/:id

// REQUEST
GET /chat/chat_123

// RESPONSE
{
  "id": "chat_123",
  "messages": [
    {"role": "user", "content": "Hello, what's the weather like?"},
    {"role": "assistant", "content": "I don't have real-time weather data. You could check a weather service for current conditions."}
  ],
  "model": "any-model-id",
  "created_at": "2023-05-15T10:30:00Z"
}

GET /chat

// REQUEST
GET /chat

// RESPONSE
{
  "chats": [
    {
      "id": "chat_123",
      "snippet": "Hello, what's the weather like?",
      "created_at": "2023-05-15T10:30:00Z"
    },
    {
      "id": "chat_456",
      "snippet": "Tell me about Mars",
      "created_at": "2023-05-14T14:20:00Z"
    }
  ]
}

πŸ› οΈ TOOLS ENDPOINTS

GET /tools

// REQUEST
GET /tools

// RESPONSE
{
  "tools": [
    {
      "id": "calculator",
      "description": "Performs mathematical calculations",
      "parameters": {
        "expression": "string"
      }
    },
    {
      "id": "weather",
      "description": "Gets current weather",
      "parameters": {
        "location": "string"
      }
    }
  ]
}

POST /tools/:tool_id

// REQUEST
POST /tools/calculator
{
  "expression": "15 * 7"
}

// RESPONSE
{
  "result": 105
}

GET /tools/:tool_id

// REQUEST
GET /tools/calculator

// RESPONSE
{
  "id": "calculator",
  "description": "Performs mathematical calculations",
  "parameters": {
    "expression": {
      "type": "string",
      "description": "Mathematical expression to evaluate"
    }
  },
  "example": "15 * 7"
}

🧠 MEMORY ENDPOINTS

POST /memory

// REQUEST
POST /memory
{
  "key": "user_preference",
  "value": {
    "theme": "dark",
    "language": "en"
  }
}

// RESPONSE
{
  "status": "stored"
}

GET /memory/:key

// REQUEST
GET /memory/user_preference

// RESPONSE
{
  "key": "user_preference",
  "value": {
    "theme": "dark",
    "language": "en"
  },
  "created_at": "2023-05-15T10:30:00Z"
}

GET /memory

// REQUEST
GET /memory

// RESPONSE
{
  "keys": [
    {
      "key": "user_preference",
      "created_at": "2023-05-15T10:30:00Z"
    },
    {
      "key": "search_history",
      "created_at": "2023-05-14T14:20:00Z"
    }
  ]
}

PUT /memory/:key

// REQUEST
PUT /memory/user_preference
{
  "value": {
    "theme": "light",
    "language": "en"
  }
}

// RESPONSE
{
  "status": "updated",
  "previous_value": {
    "theme": "dark",
    "language": "en"
  }
}

DELETE /memory/:key

// REQUEST
DELETE /memory/user_preference

// RESPONSE
{
  "status": "deleted"
}

POST /memory/query

// REQUEST
POST /memory/query
{
  "query": "What theme settings do I have?",
  "limit": 1
}

// RESPONSE
{
  "results": [
    {
      "key": "user_preference",
      "value": {
        "theme": "dark",
        "language": "en"
      },
      "score": 0.92
    }
  ]
}

πŸ“š RESOURCES ENDPOINTS

GET /resources

// REQUEST
GET /resources

// RESPONSE
{
  "resources": [
    {
      "id": "mars-101",
      "title": "Mars: The Red Planet",
      "type": "article"
    },
    {
      "id": "document-123",
      "name": "project_plan.pdf",
      "type": "file"
    }
  ]
}

GET /resources/:id

// REQUEST
GET /resources/mars-101

// RESPONSE
{
  "id": "mars-101",
  "title": "Mars: The Red Planet",
  "type": "article",
  "content": "Mars is the fourth planet from the Sun and the second-smallest planet in the Solar System...",
  "metadata": {
    "source": "astronomy-db",
    "last_updated": "2023-05-10"
  }
}

GET /resources/search

// REQUEST
GET /resources/search?q=mars

// RESPONSE
{
  "results": [
    {
      "id": "mars-101",
      "title": "Mars: The Red Planet",
      "type": "article",
      "score": 0.98
    },
    {
      "id": "solar-system",
      "title": "Our Solar System",
      "type": "article",
      "score": 0.75
    }
  ]
}

πŸ’³ PAY ENDPOINTS

POST /pay

// REQUEST
POST /pay
{
  "amount": 5.00,
  "currency": "USD",
  "description": "API usage - 1000 tokens",
  "payment_method": "card_token_123"
}

// RESPONSE
{
  "transaction_id": "tx_987654",
  "status": "success",
  "receipt_url": "https://api.example.com/receipts/tx_987654"
}

GET /pay/:id

// REQUEST
GET /pay/tx_987654

// RESPONSE
{
  "transaction_id": "tx_987654",
  "amount": 5.00,
  "currency": "USD",
  "description": "API usage - 1000 tokens",
  "status": "success",
  "created_at": "2023-05-15T10:30:00Z",
  "receipt_url": "https://api.example.com/receipts/tx_987654"
}

πŸ” AUTH EXAMPLES

Authentication in SLOP uses standard HTTP headers. Here are examples in both JavaScript and Python:

JavaScript Example

// Using fetch
const callSlop = async (endpoint, data) => {
  const response = await fetch(`https://api.example.com${endpoint}`, {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer your-token-here',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(data)
  });
  return response.json();
};

// Using axios
const axios = require('axios');
const api = axios.create({
  baseURL: 'https://api.example.com',
  headers: {
    'Authorization': 'Bearer your-token-here'
  }
});

// Make authenticated requests
await api.post('/chat', {
  messages: [{ content: 'Hello!' }]
});

Python Example

import requests

# Using requests
headers = {
    'Authorization': 'Bearer your-token-here',
    'Content-Type': 'application/json'
}

# Function to make authenticated requests
def call_slop(endpoint, data=None):
    base_url = 'https://api.example.com'
    method = 'GET' if data is None else 'POST'
    response = requests.request(
        method=method,
        url=f'{base_url}{endpoint}',
        headers=headers,
        json=data
    )
    return response.json()

# Make authenticated requests
chat_response = call_slop('/chat', {
    'messages': [{'content': 'Hello!'}]
})

Remember: SLOP uses standard HTTP auth - no special endpoints needed! πŸ”‘

πŸ›‘οΈ SCOPE HEADERS FOR LIMITING AI SCOPE

SLOP uses standard HTTP headers to control AI safety and permissions:

X-SLOP-Scope: chat.read,tools.calculator,memory.user.read

Common Scopes

chat.read # Read chat history chat.write # Send messages tools.* # Access all tools tools.safe.* # Access only safe tools memory.user.* # Full user memory access memory..read # Read-only memory access

Examples

# Safe: Calculator within scope
POST /tools/calculator
X-SLOP-Scope: tools.calculator.execute
{
    "expression": "2 + 2"
}

# Blocked: No execute permission
POST /tools/system-cmd
X-SLOP-Scope: tools.calculator.execute
{
    "cmd": "rm -rf /"
}

// RESPONSE
{
    "error": "Scope violation: tools.execute-code requires explicit permission",
    "permitted": false
}

Remember: Security through simplicity! πŸ”’


Let's collab! SLOP Discord: https://discord.com/invite/nwXJMnHmXP

πŸŽ‰ Enjoy using SLOP! πŸŽ‰

About

The place for SLOP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0