Slop.Router (slop v0.1.0)
View SourceA Phoenix router extension for implementing SLOP (Simple Language Open Protocol) endpoints.
This module provides a macro that can be used in a Phoenix router to quickly set up the standard SLOP endpoints for AI interactions.
Usage
defmodule MyAppWeb.Router do
use Phoenix.Router
# Your existing pipeline definitions
pipeline :api do
plug :accepts, ["json"]
end
# Use the SLOP router in a scope
scope "/api/slop", MyAppWeb do
pipe_through :api
use Slop.Router, controllers: [
chat: MyAppWeb.SlopChatController,
tools: MyAppWeb.SlopToolsController,
memory: MyAppWeb.SlopMemoryController,
resources: MyAppWeb.SlopResourcesController,
pay: MyAppWeb.SlopPayController,
info: MyAppWeb.SlopInfoController
]
end
end
Configuration
The use Slop.Router
macro accepts a keyword list with the following options:
:controllers
- A map of SLOP endpoint types to controller modules that will handle the corresponding requests. You only need to specify the controllers for the endpoints you want to implement.