Documentation
¶
Overview ¶
Package internal provides shared utilities for the genai library.
Index ¶
- Variables
- func DecodeJSON(d *json.Decoder, out any, r io.ReadSeeker) (bool, error)
- func Logger(ctx context.Context) *slog.Logger
- func MimeByExt(ext string) string
- func TypeName(v any) string
- func UnmarshalJSON(data []byte, out any) error
- func WithLogger(ctx context.Context, logger *slog.Logger) context.Context
- type BadError
- type Validatable
Constants ¶
This section is empty.
Variables ¶
var BeLenient = true
BeLenient is used by all clients to enable or disable httpjson.Client.Lenient.
It is true by default. Tests must manually set it to false.
Functions ¶
func DecodeJSON ¶
DecodeJSON is duplicate from httpjson.go in https://github.com/maruel/httpjson.
func Logger ¶
Logger retrieves a slog.Logger from the context if any, otherwise returns slog.Default().
func MimeByExt ¶
MimeByExt returns the mime type for the given extension.
It works around OS-specific bugs for audio and markdown.
func UnmarshalJSON ¶ added in v0.4.1
UnmarshalJSON is like json.Unmarshal but respects BeLenient.
When strict (!BeLenient), it uses DisallowUnknownFields and provides detailed error messages about extra keys via DecodeJSON.
Types ¶
type BadError ¶
type BadError struct {
Err error
}
BadError is a bad error that must stop the smoke test.
type Validatable ¶
type Validatable interface {
// Validate ensures the object is valid.
Validate() error
}
Validatable is an interface to an object that can be validated.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bb is a separate package so it can be imported by genai while being internal and exported so cmp.Diff() isn't unhappy.
|
Package bb is a separate package so it can be imported by genai while being internal and exported so cmp.Diff() isn't unhappy. |
|
Package cli provides process helpers for CLI-based providers.
|
Package cli provides process helpers for CLI-based providers. |
|
cmd
|
|
|
autofix-weekly-regen
command
Command autofix-weekly-regen asks pi.dev to repair weekly model regeneration failures.
|
Command autofix-weekly-regen asks pi.dev to repair weekly model regeneration failures. |
|
gen-realtimespeech
command
Command gen-realtimespeech regenerates the realtime speech FLAC fixtures with llama-tts.
|
Command gen-realtimespeech regenerates the realtime speech FLAC fixtures with llama-tts. |
|
update-servers
command
Command update-servers checks for newer releases of llama.cpp and ollama servers used by llamacppsrv and ollamasrv, updates the version constants, and regenerates test recordings.
|
Command update-servers checks for newer releases of llama.cpp and ollama servers used by llamacppsrv and ollamasrv, updates the version constants, and regenerates test recordings. |
|
Package ghrelease provides shared helpers for downloading and extracting GitHub release assets.
|
Package ghrelease provides shared helpers for downloading and extracting GitHub release assets. |
|
Package internaltest is awesome sauce for unit testing.
|
Package internaltest is awesome sauce for unit testing. |
|
Package msgutil provides shared message utilities for subprocess-based providers.
|
Package msgutil provides shared message utilities for subprocess-based providers. |
|
Package myrecorder has HTTP recording logic.
|
Package myrecorder has HTTP recording logic. |
|
Package realtime provides cancellable WebSocket I/O with bounded reads for realtime providers.
|
Package realtime provides cancellable WebSocket I/O with bounded reads for realtime providers. |
|
Package realtimetest provides scripted WebSocket peers, session checks and a fake session.
|
Package realtimetest provides scripted WebSocket peers, session checks and a fake session. |
|
Package sse provides Server-Sent Events (SSE) processing utilities.
|
Package sse provides Server-Sent Events (SSE) processing utilities. |