internal

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package internal is awesome sauce.

Index

Constants

This section is empty.

Variables

View Source
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

func DecodeJSON(d *json.Decoder, out any, r io.ReadSeeker) (bool, error)

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

func Logger(ctx context.Context) *slog.Logger

Logger retrieves a slog.Logger from the context if any, otherwise returns slog.Default().

func MimeByExt

func MimeByExt(ext string) string

MimeByExt returns the mime type for the given extension.

It works around OS-specific bugs for audio and markdown.

func TypeName

func TypeName(v any) string

TypeName returns the unqualified type name, dereferencing pointers as needed.

func WithLogger

func WithLogger(ctx context.Context, logger *slog.Logger) context.Context

WithLogger injects a slog.Logger into the context. It can be retrieved with Logger().

Types

type BadError

type BadError struct {
	Err error
}

BadError is a bad error that must stop the smoke test.

func (*BadError) Error

func (b *BadError) Error() string

func (*BadError) Unwrap

func (b *BadError) Unwrap() error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL