Documentation
¶
Overview ¶
Package comments provides functionality for managing comments on traces, observations, and sessions in Langfuse.
This package allows you to add contextual comments to your traces and observations for collaboration and debugging purposes. Comments can be attached to various object types including traces, observations, sessions, and prompts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides methods for interacting with the Langfuse comments API.
The client handles HTTP communication for comment-related operations including creating, retrieving, and listing comments on various object types.
func NewClient ¶
NewClient creates a new comments client with the provided HTTP client.
The resty client should be pre-configured with authentication and base URL.
func (*Client) Create ¶
func (c *Client) Create(ctx context.Context, createComment *CreateCommentRequest) (*CommentEntry, error)
Create creates a new comment.
func (*Client) List ¶
func (c *Client) List(ctx context.Context, params ListParams) (*ListComments, error)
List retrieves a list of comments based on the provided parameters.
type CommentEntry ¶
type CommentEntry struct {
ID string `json:"id,omitempty"`
ProjectID string `json:"projectId,omitempty"`
CreatedAt time.Time `json:"createdAt,omitempty"`
UpdatedAt time.Time `json:"updatedAt,omitempty"`
ObjectType CommentObjectType `json:"objectType"`
ObjectID string `json:"objectId"`
Content string `json:"content"`
AuthorUserID string `json:"authorUserId,omitempty"`
}
CommentEntry represents a comment attached to an object in Langfuse.
Comments provide a way to add contextual information, feedback, or notes to traces, observations, sessions, or prompts. They include author information and timestamps for collaboration and audit purposes.
type CommentObjectType ¶
type CommentObjectType string
CommentObjectType represents the type of object that can have comments attached.
Comments can be attached to different types of objects in Langfuse, including traces, observations, sessions, and prompts.
const ( ObjectTypeTrace CommentObjectType = "TRACE" ObjectTypeObservation CommentObjectType = "OBSERVATION" ObjectTypeSession CommentObjectType = "SESSION" ObjectTypePrompt CommentObjectType = "PROMPT" )
type CreateCommentRequest ¶
type CreateCommentRequest struct {
ProjectID string `json:"projectId,omitempty"`
ObjectType CommentObjectType `json:"objectType"`
ObjectID string `json:"objectId"`
Content string `json:"content"`
AuthorUserID string `json:"authorUserId,omitempty"`
}
CreateCommentRequest represents the parameters for creating a new comment.
ProjectID, ObjectType, ObjectID, and Content are required fields. AuthorUserID is optional and will be set based on the API key if not provided.
type ListComments ¶
type ListComments struct {
Metadata common.ListMetadata `json:"meta"`
Data []CommentEntry `json:"data"`
}
ListComments represents the paginated response from the list comments API.
It contains pagination metadata and an array of comments matching the query criteria.
type ListParams ¶
type ListParams struct {
Page int
Limit int
ObjectType CommentObjectType
ObjectID string
}
ListParams defines the query parameters for filtering and paginating comment listings.
Use ObjectType and ObjectID to filter comments for specific objects. Page and Limit control pagination.
func (*ListParams) ToQueryString ¶
func (query *ListParams) ToQueryString() string
ToQueryString converts the ListParams to a URL query string.