Documentation
¶
Overview ¶
Package service holds what every AI service in a pipeline has in common, whatever it does: transcription, generation or synthesis.
A concrete service embeds Base rather than a bare frame processor, which is what gives it the behavior the rest of the pipeline expects of a service: describing itself to the processors around it, and describing itself again when asked.
Index ¶
- type Base
- func (b *Base) BroadcastServiceMetadata(ctx context.Context)
- func (b *Base) ProcessFrame(ctx context.Context, f frames.Frame, dir processor.Direction) error
- func (b *Base) PushFrame(ctx context.Context, f frames.Frame, dir processor.Direction) error
- func (b *Base) SettingsUpdated(ctx context.Context)
- type MetadataDescriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
Base is the foundation of every AI service. Embed it in a concrete service and pass the concrete value as self, the same way a frame processor is built:
type Synth struct{ *service.Base }
func NewSynth() *Synth {
s := &Synth{}
s.Base = service.New("Synth", s)
return s
}
Implement MetadataDescriber on the concrete service to have it described to the pipeline.
func New ¶
New builds a service Base named name on behalf of self, the concrete service embedding it.
func (*Base) BroadcastServiceMetadata ¶
BroadcastServiceMetadata sends this service's metadata both ways through the pipeline, so processors on either side of it learn what it is. It does nothing for a service that does not describe itself.
func (*Base) ProcessFrame ¶
ProcessFrame handles what every service handles. A concrete service overrides it and calls this first.
func (*Base) PushFrame ¶
PushFrame forwards a frame, and describes the service to the pipeline once it has started.
The metadata goes out after the StartFrame rather than while it is being handled, so the processors it reaches have been started themselves and are ready to make sense of it.
func (*Base) SettingsUpdated ¶
SettingsUpdated records that this service's settings have actually changed.
New settings may be the ones that make the service work, so a service written off for a rejected model or voice is given another chance rather than being left unable to take work for the rest of the run. Call it from a settings update that changed something, and not from one that changed nothing.
type MetadataDescriber ¶
type MetadataDescriber interface {
// ServiceMetadataFrame is the metadata to broadcast, or nil to broadcast
// nothing.
ServiceMetadataFrame() frames.ServiceMetadata
}
MetadataDescriber is implemented by a service that describes itself to the rest of the pipeline: the name it answers to, and whatever else downstream processors need to know about it, such as the turn-taking a transcriber with its own end-of-turn detection recommends.
Each call must return a fresh frame. The metadata goes out in both directions, as two frames, so the two halves cannot share one.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package llm is the shared base for streaming LLM services.
|
Package llm is the shared base for streaming LLM services. |
|
Package mcp connects a jargo LLM to Model Context Protocol tool servers.
|
Package mcp connects a jargo LLM to Model Context Protocol tool servers. |
|
Package settings holds the part of a service's configuration that can change while the pipeline is running: the model, the voice, the language, the sampling knobs an LLM exposes.
|
Package settings holds the part of a service's configuration that can change while the pipeline is running: the model, the voice, the language, the sampling knobs an LLM exposes. |
|
Package stt is the shared base for speech-to-text services.
|
Package stt is the shared base for speech-to-text services. |
|
Package tts is the shared base for text-to-speech services.
|
Package tts is the shared base for text-to-speech services. |
|
Package wsservice is the shared base for services that talk to a provider over a WebSocket held open for the length of a call.
|
Package wsservice is the shared base for services that talk to a provider over a WebSocket held open for the length of a call. |
|
Package wsutil holds small shared helpers for the provider WebSocket clients.
|
Package wsutil holds small shared helpers for the provider WebSocket clients. |