Skip to content

Commit

Permalink
feat: Log during initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanKadri committed Nov 8, 2023
1 parent 41d81f8 commit 942fe44
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/nr_openai_observability/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def perform_patch_bedrock():
import botocore

try:
logger.info("Instrumenting AWS Bedrock")
botocore.client.ClientCreator.create_client = _patched_call(
botocore.client.ClientCreator.create_client, patcher_aws_create_api
)
Expand Down
15 changes: 13 additions & 2 deletions src/nr_openai_observability/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def initialization(
metadata: Dict[str, Any] = {},
metadata_callback: Optional[Callable] = None,
):
logger.info("Initializing New Relic AI Monitoring plugin")
if application_name != "":
logger.warn(
"The application_name parameter is being deprecated in favor of deriving the application name from the Python Agent's configuration"
Expand All @@ -26,7 +27,17 @@ def initialization(
perform_patch()
return monitor

def record_ai_feedback_event(rating, message_id, category = None, conversation_id = None, request_id = None, message = None):
event = build_ai_feedback_event(category, rating, message_id, conversation_id, request_id, message)

def record_ai_feedback_event(
rating,
message_id,
category=None,
conversation_id=None,
request_id=None,
message=None,
):
event = build_ai_feedback_event(
category, rating, message_id, conversation_id, request_id, message
)

monitor.record_event(event, FeedbackEventName)

0 comments on commit 942fe44

Please sign in to comment.