maxim

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 6 Imported by: 2

README

Maxim Go Library

Breaking Change (v0.2.0): Types have been refactored from the logging package to the schemas package. Update imports from github.com/maximhq/maxim-go/logging to github.com/maximhq/maxim-go/schemas for types such as MaximLLMResult, Usage, ChatCompletionToolCall, and related structs.

Documentation

Overview

Package maxim provides the Maxim SDK for Go, enabling LLM observability, tracing, and logging across OpenAI, Azure, Gemini, Bedrock, and other providers.

Breaking Change Notice (v0.2.0)

Types such as MaximLLMResult, Usage, ChatCompletionToolCall, and related structs have been refactored from the logging package to the schemas package. If you were importing these types from github.com/maximhq/maxim-go/logging, update your imports to use github.com/maximhq/maxim-go/schemas instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StrPtr

func StrPtr(str string) *string

Types

type Maxim

type Maxim struct {
	// contains filtered or unexported fields
}

func Init

func Init(c *MaximSDKConfig) *Maxim

Maxim is the main client for the Maxim SDK. It provides access to various Maxim features like logging. The client should be initialized with Init() and cleaned up with Cleanup().

Example usage:

config := &maxim.MaximSDKConfig{
	ApiKey: "your-api-key",
	Debug:  true,
}
client := maxim.Init(config)
defer client.Cleanup()

// Now you can use the client to access Maxim features
logger, err := client.GetLogger(&logging.LoggerConfig{
	Id: "your-log-repo-id",
})

func (*Maxim) Cleanup

func (m *Maxim) Cleanup()

Cleanup Maxim SDK state and flushes all logs in all the loggers. It should be called when the application is shutting down to ensure all logs are sent to the server.

Example usage:

config := &maxim.MaximSDKConfig{
	ApiKey: "your-api-key",
	Debug:  true,
}
client := maxim.Init(config)
defer client.Cleanup() // This ensures all logs are flushed before the application exits

func (*Maxim) GetLogger

func (m *Maxim) GetLogger(c *logging.LoggerConfig) (*logging.Logger, error)

GetLogger returns a logger instance for the given configuration. It inherits the authentication and debug from Maxim instance.

Example usage:

config := &maxim.MaximSDKConfig{
	ApiKey: "your-api-key",
	Debug:  true,
}
client := maxim.Init(config)
defer client.Cleanup()

logger, err := client.GetLogger(&logging.LoggerConfig{
	Id: "your-log-repo-id",
})
if err != nil {
	// handle error
}

The SDK automatically handles flushing logs when Cleanup() is called.

func (*Maxim) GetPromptVersion added in v0.1.12

func (m *Maxim) GetPromptVersion(versionId, promptId string) (*apis.PromptVersion, error)

GetPromptVersion fetches a specific version of a prompt.

Parameters:

  • versionId: The version ID you want to query.
  • promptId: The prompt ID whose versions you want to query.

Returns:

  • *apis.PromptVersion: The prompt version if successful, or nil with an error.
  • error: An error if the request fails.

Example usage:

client := maxim.Init(&maxim.MaximSDKConfig{
	ApiKey: "your-api-key",
})
promptVersion, err := client.GetPromptVersion("version-id", "prompt-id")
if err != nil {
	// handle error
}

type MaximSDKConfig

type MaximSDKConfig struct {
	BaseUrl *string
	ApiKey  string
	Debug   bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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