Skip to content

Commit

Permalink
Merge branch 'AIEvents' into OpenAIIntegration
Browse files Browse the repository at this point in the history
  • Loading branch information
mirackara committed Mar 1, 2024
2 parents db50304 + 03ee380 commit e13a5de
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions v3/newrelic/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ func (app *Application) RecordCustomEvent(eventType string, params map[string]in
}
}

// RecordLlmFeedbackEvent adds a Llm Feedback event.
// RecordLlmFeedbackEvent adds a LLM Feedback event.
// An error is logged if eventType or params is invalid.
func (app *Application) RecordLlmFeedbackEvent(trace_id string, rating any, category string, message string, metadata map[string]interface{}) {
func (app *Application) RecordLLMFeedbackEvent(trace_id string, rating any, category string, message string, metadata map[string]interface{}) {
if app == nil || app.app == nil {
return
}
Expand Down
9 changes: 9 additions & 0 deletions v3/newrelic/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,15 @@ type Config struct {
DynoNamePrefixesToShorten []string
}

// AIMonitoring controls the behavior of AI monitoring features.
AIMonitoring struct {
Enabled bool
// Indicates whether streams will be instrumented
Streaming struct {
Enabled bool
}
}

// AIMonitoring controls the behavior of AI monitoring features.
AIMonitoring struct {
Enabled bool
Expand Down
3 changes: 1 addition & 2 deletions v3/newrelic/internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func testApp(replyfn func(*internal.ConnectReply), cfgfn func(*Config), t testin

func TestRecordLLMFeedbackEventSuccess(t *testing.T) {
app := testApp(nil, nil, t)
app.RecordLlmFeedbackEvent("traceid", "5", "informative", "message", validParams)
app.RecordLLMFeedbackEvent("traceid", "5", "informative", "message", validParams)
app.expectNoLoggedErrors(t)
app.ExpectCustomEvents(t, []internal.WantEvent{{
Intrinsics: map[string]interface{}{
Expand All @@ -309,7 +309,6 @@ func TestRecordLLMFeedbackEventSuccess(t *testing.T) {
},
}})
}

func TestRecordCustomEventSuccess(t *testing.T) {
app := testApp(nil, nil, t)
app.RecordCustomEvent("myType", validParams)
Expand Down

0 comments on commit e13a5de

Please sign in to comment.