Before you start logging you will have to create a LogRepository on the Maxim dashboard. To create a log repository,click on Logs and the
click on + icon on the sidebar. You can use the ID of that repository to push logs.
import "github.com/maximhq/maxim-go/logging"// ... in function 1trace := logger.Trace(&logging.TraceConfig{Id: "trace-id"})// ... in function 2trace := logger.Trace(&logging.TraceConfig{Id: "trace-id"})// it returns the same trace objecttrace.AddTag("key", "value")
import "github.com/maximhq/maxim-go/logging"// ... in function 1session := logger.Session(&logging.SessionConfig{Id: "session-id"})// ... in function 2session := logger.Session(&logging.SessionConfig{Id: "session-id"})// it returns the same session objectsession.AddTag("key", "value")
A Retrieval is a special type of Span in Maxim, which represents a retrieval query to a knowledge base or vector database.
Adding a Retrieval to a Trace
import "github.com/maximhq/maxim-go/logging"retrieval := span.AddRetrieval(&logging.RetrievalConfig{ Id: "retrieval-id", Name: "name", Metadata: map[string]string{"key": "value"}})retrieval.SetInput("How many PTO days do I have?")retrieval.SetOutput([]string{"doc1", "doc2"})retrieval.End()