Documentation
¶
Overview ¶
Package internal is awesome sauce.
Index ¶
- Variables
- func DecodeJSON(d *json.Decoder, out any, r io.ReadSeeker) (bool, error)
- func JSONSchemaFor(t reflect.Type) *jsonschema.Schema
- func LogTransport(t http.RoundTripper) http.RoundTripper
- func Logger(ctx context.Context) *slog.Logger
- func MimeByExt(ext string) string
- func TypeName(v any) string
- 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 JSONSchemaFor ¶
func JSONSchemaFor(t reflect.Type) *jsonschema.Schema
JSONSchemaFor returns the JSON schema for the given type.
Many providers (including OpenAI) struggle with $ref that jsonschema package uses by default.
func LogTransport ¶
func LogTransport(t http.RoundTripper) http.RoundTripper
LogTransport logs the transport to help debugging.
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.
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 internaltest is awesome sauce for unit testing.
|
Package internaltest is awesome sauce for unit testing. |
|
Package myrecorder has HTTP recording logic.
|
Package myrecorder has HTTP recording logic. |
|
Package sse provides Server-Sent Events (SSE) processing utilities.
|
Package sse provides Server-Sent Events (SSE) processing utilities. |