Skip to content

Commit

Permalink
chore: add data layer telemetry (#1812)
Browse files Browse the repository at this point in the history
* chore: add data layer telemetry

* fix: import
  • Loading branch information
willydouhard authored Jan 28, 2025
1 parent c482389 commit 6cf2aee
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to Chainlit will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [2.0.603] - 2025-01-28

### Added

- Data layer initialization to the telemetry

### Fixed

- Gap between the word `Used` and tool name in step name

## [2.0.602] - 2025-01-27

### Fixed
Expand Down
7 changes: 6 additions & 1 deletion backend/chainlit/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,21 @@ def get_data_layer():

else:
from chainlit.config import config
from chainlit.telemetry import trace_event

if config.code.data_layer:
# When @data_layer is configured, call it to get data layer.
_data_layer = config.code.data_layer()
elif database_url := os.environ.get("DATABASE_URL"):
# Default to Chainlit data layer if DATABASE_URL specified.
from .chainlit_data_layer import ChainlitDataLayer

trace_event("Init Chainlit official data layer")

if os.environ.get("LITERAL_API_KEY"):
warnings.warn(
"Both LITERAL_API_KEY and DATABASE_URL specified. Ignoring Literal AI data layer and relying on data layer pointing to DATABASE_URL."
)

bucket_name = os.environ.get("BUCKET_NAME")

# AWS S3
Expand Down Expand Up @@ -102,6 +105,8 @@ def get_data_layer():
# When LITERAL_API_KEY is defined, use Literal AI data layer
from .literalai import LiteralDataLayer

trace_event("Init Literal AI data layer")

# support legacy LITERAL_SERVER variable as fallback
server = os.environ.get("LITERAL_API_URL") or os.environ.get(
"LITERAL_SERVER"
Expand Down
2 changes: 1 addition & 1 deletion backend/chainlit/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
except metadata.PackageNotFoundError:
# Case where package metadata is not available, default to a 'non-outdated' version.
# Ref: config.py::load_settings()
__version__ = "2.0.602"
__version__ = "2.0.603"
2 changes: 1 addition & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "chainlit"
version = "2.0.602"
version = "2.0.603"
keywords = [
'LLM',
'Agents',
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/chat/Messages/Message/Step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function Step({
<div className="flex flex-col flex-grow w-0">
<p
className={cn(
'flex items-center group/step',
'flex items-center gap-1 group/step',
isError && 'text-red-500',
hasContent && 'cursor-pointer',
!using && 'text-muted-foreground hover:text-foreground',
Expand All @@ -50,9 +50,9 @@ export default function Step({
)}
{hasContent ? (
open ? (
<ChevronUp className="invisible group-hover/step:visible !size-4 ml-1" />
<ChevronUp className="invisible group-hover/step:visible !size-4" />
) : (
<ChevronDown className="invisible group-hover/step:visible !size-4 ml-1" />
<ChevronDown className="invisible group-hover/step:visible !size-4" />
)
) : null}
</p>
Expand Down

0 comments on commit 6cf2aee

Please sign in to comment.