Skip to content

Commit

Permalink
defaults for each contextvar (#1586)
Browse files Browse the repository at this point in the history
* defaults for each contextvar

* one more

* update api doc

* relock

* lock and api dump

---------

Co-authored-by: Josh Reini <[email protected]>
  • Loading branch information
sfc-gh-pmardziel and sfc-gh-jreini authored Oct 25, 2024
1 parent bfb8ad0 commit 241e59a
Show file tree
Hide file tree
Showing 20 changed files with 6,316 additions and 6,082 deletions.
1,558 changes: 754 additions & 804 deletions poetry.lock

Large diffs are not rendered by default.

1,119 changes: 574 additions & 545 deletions src/apps/langchain/poetry.lock

Large diffs are not rendered by default.

1,347 changes: 686 additions & 661 deletions src/apps/llamaindex/poetry.lock

Large diffs are not rendered by default.

1,546 changes: 751 additions & 795 deletions src/apps/nemo/poetry.lock

Large diffs are not rendered by default.

248 changes: 128 additions & 120 deletions src/benchmark/poetry.lock

Large diffs are not rendered by default.

246 changes: 127 additions & 119 deletions src/core/poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/core/trulens/core/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def __init__(
kwargs["connector"] = connector
kwargs["feedbacks"] = feedbacks
kwargs["recording_contexts"] = contextvars.ContextVar(
"recording_contexts"
"recording_contexts", default=None
)

super().__init__(**kwargs)
Expand Down
2 changes: 1 addition & 1 deletion src/core/trulens/core/feedback/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class EndpointSetup:
"""Name of variable that stores the callback noted above."""

_context_endpoints: ClassVar[contextvars.ContextVar] = (
contextvars.ContextVar("endpoints")
contextvars.ContextVar("endpoints", default={})
)
_context_endpoints.set({})

Expand Down
6 changes: 4 additions & 2 deletions src/core/trulens/core/instruments.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ class WithInstrumentCallbacks:
Needs to be mixed into [App][trulens.core.app.App].
"""

_context_contexts = contextvars.ContextVar("context_contexts")
_context_contexts = contextvars.ContextVar(
"context_contexts", default=set()
)
"""ContextVars for storing collections of RecordingContext ."""
_context_contexts.set(set())

_stack_contexts = contextvars.ContextVar("stack_contexts")
_stack_contexts = contextvars.ContextVar("stack_contexts", default={})
"""ContextVars for storing call stacks."""
_stack_contexts.set({})

Expand Down
2 changes: 1 addition & 1 deletion src/core/trulens/core/utils/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ class SerialModel(pydantic.BaseModel):
"""

formatted_objects: ClassVar[ContextVar[Set[int]]] = ContextVar(
"formatted_objects"
"formatted_objects", default=set()
)

def __rich_repr__(self) -> rich.repr.Result:
Expand Down
611 changes: 319 additions & 292 deletions src/dashboard/poetry.lock

Large diffs are not rendered by default.

248 changes: 128 additions & 120 deletions src/feedback/poetry.lock

Large diffs are not rendered by default.

264 changes: 136 additions & 128 deletions src/providers/bedrock/poetry.lock

Large diffs are not rendered by default.

575 changes: 299 additions & 276 deletions src/providers/cortex/poetry.lock

Large diffs are not rendered by default.

859 changes: 443 additions & 416 deletions src/providers/huggingface/poetry.lock

Large diffs are not rendered by default.

593 changes: 308 additions & 285 deletions src/providers/langchain/poetry.lock

Large diffs are not rendered by default.

1,226 changes: 627 additions & 599 deletions src/providers/litellm/poetry.lock

Large diffs are not rendered by default.

1,173 changes: 601 additions & 572 deletions src/providers/openai/poetry.lock

Large diffs are not rendered by default.

766 changes: 424 additions & 342 deletions src/trulens_eval/poetry.lock

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions tests/unit/static/golden/api.trulens.3.11.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ trulens:
lows: {}
trulens.benchmark:
__class__: builtins.module
__version__: 1.0.1
__version__: 1.1.0
highs: {}
lows:
__version__: builtins.str
Expand Down Expand Up @@ -231,6 +231,7 @@ trulens.core.database.base.DB:
get_app: builtins.function
get_apps: builtins.function
get_datasets: builtins.function
get_db_revision: builtins.function
get_feedback: builtins.function
get_feedback_count_by_status: builtins.function
get_feedback_defs: builtins.function
Expand Down Expand Up @@ -1628,7 +1629,7 @@ trulens.core.utils.trulens.Other:
attributes: {}
trulens.dashboard:
__class__: builtins.module
__version__: 1.0.2a0
__version__: 1.1.0
highs:
run_dashboard: builtins.function
stop_dashboard: builtins.function
Expand Down Expand Up @@ -1902,7 +1903,7 @@ trulens.dashboard.ux.styles.ResultCategoryType:
value: enum.property
trulens.feedback:
__class__: builtins.module
__version__: 1.0.1
__version__: 1.1.0
highs:
Embeddings: pydantic._internal._model_construction.ModelMetaclass
GroundTruthAggregator: pydantic._internal._model_construction.ModelMetaclass
Expand Down

0 comments on commit 241e59a

Please sign in to comment.