Documentation
¶
Overview ¶
Package examples holds photon's runnable examples. Each subdirectory is a standalone program; see README.md.
The package itself exists for one reason: `photon init` scaffolds new projects from these programs, and embedding them here means the templates are the examples - compiled and tested with the rest of the module - rather than string constants that can quietly stop compiling.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var FS embed.FS
FS holds the source of the template programs.
View Source
var Templates = map[string]string{
"minimal": "hello/main.go",
"api": "api/main.go",
"agent": "agent/main.go",
"openai-proxy": "openai-proxy/main.go",
}
Templates maps a `photon init -template` name to the example it copies.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Command agent streams an AI agent's work to a browser as it happens: what it is thinking, which tools it calls, what they return, and the answer, token by token.
|
Command agent streams an AI agent's work to a browser as it happens: what it is thinking, which tools it calls, what they return, and the answer, token by token. |
|
Command api is a small JSON API: grouped routes with middleware, JSON in and out, structured errors, and authentication on part of the tree.
|
Command api is a small JSON API: grouped routes with middleware, JSON in and out, structured errors, and authentication on part of the tree. |
|
Command hello is the smallest useful photon server.
|
Command hello is the smallest useful photon server. |
|
Command middleware shows how middleware composes in photon, and that it is ordinary net/http middleware.
|
Command middleware shows how middleware composes in photon, and that it is ordinary net/http middleware. |
|
Command openai-proxy is an OpenAI-compatible gateway: it accepts Chat Completions requests, forwards them to an upstream model server, and relays the streamed answer to the client token by token.
|
Command openai-proxy is an OpenAI-compatible gateway: it accepts Chat Completions requests, forwards them to an upstream model server, and relays the streamed answer to the client token by token. |
|
Command production shows the parts of running a server that are not the handler: lifecycle, health checks, timeouts, and logging that an operator can actually read.
|
Command production shows the parts of running a server that are not the handler: lifecycle, health checks, timeouts, and logging that an operator can actually read. |
|
Command security shows what photon protects you from by default, and the few things it deliberately leaves to you.
|
Command security shows what photon protects you from by default, and the few things it deliberately leaves to you. |
|
Command stream is a tour of photon's server-sent events.
|
Command stream is a tour of photon's server-sent events. |
Click to show internal directories.
Click to hide internal directories.