Skip to content

Added prompt and generation event names in track_llm_events #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.8.5] - 2025-03-28
### Added
- prompt_event_name and generation_event_name to track_llm_events

## [1.8.4] - 2025-03-17
### Added
- thread_id to track_llm_events
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "trubrics"
version = "1.8.4"
version = "1.8.5"
requires-python = ">=3.10"
license = { text = "Apache 2.0" }
authors = [
Expand Down
6 changes: 6 additions & 0 deletions trubrics/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ def track_llm(
user_id: str,
prompt: str,
generation: str,
prompt_event_name: str = "Prompt",
generation_event_name: str = "Generation",
assistant_id: str | None = None,
properties: dict | None = None,
timestamp: datetime | None = None,
Expand All @@ -127,6 +129,8 @@ def track_llm(
user_id (str): The ID of the user.
prompt (str): The prompt given to the LLM.
generation (str): The generated response from the LLM.
prompt_event_name (str): The name given to the prompt event in Trubrics.
generation_event_name (str): The name given to the generation event in Trubrics.
assistant_id (str | None): The ID of the assistant.
properties (dict | None): Additional properties to track.
timestamp (datetime | None): The timestamp of the generation event. If None, the current time in UTC is used.
Expand All @@ -138,6 +142,8 @@ def track_llm(
"user_id": user_id,
"prompt": prompt,
"generation": generation,
"prompt_event_name": prompt_event_name,
"generation_event_name": generation_event_name,
"assistant_id": assistant_id,
"properties": properties,
"timestamp": (
Expand Down
Loading