From 9991c6ea4cc7cda5bae603ab718a32724b34549a Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 21 Jun 2024 20:21:44 -0300 Subject: [PATCH] refactor: Update Component class to use private _tracing_service variable --- src/backend/base/langflow/base/models/model.py | 2 +- .../base/langflow/custom/custom_component/component.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/base/langflow/base/models/model.py b/src/backend/base/langflow/base/models/model.py index 89973faab..81f124fd7 100644 --- a/src/backend/base/langflow/base/models/model.py +++ b/src/backend/base/langflow/base/models/model.py @@ -140,7 +140,7 @@ class LCModelComponent(Component): inputs: Union[list, dict] = messages or {} try: runnable = runnable.with_config( - {"run_name": self.display_name, "project_name": self.tracing_service.project_name} + {"run_name": self.display_name, "project_name": self._tracing_service.project_name} ) if stream: return runnable.stream(inputs) diff --git a/src/backend/base/langflow/custom/custom_component/component.py b/src/backend/base/langflow/custom/custom_component/component.py index 9a01e62ff..17b054e26 100644 --- a/src/backend/base/langflow/custom/custom_component/component.py +++ b/src/backend/base/langflow/custom/custom_component/component.py @@ -118,11 +118,11 @@ class Component(CustomComponent): async def build_results(self): inputs = self.get_trace_as_inputs() metadata = self.get_trace_as_metadata() - with self.tracing_service.trace_context( + with self._tracing_service.trace_context( f"{self.display_name} ({self.vertex.id})", self.trace_type, inputs, metadata ): _results, _artifacts = await self._build_results() - self.tracing_service.set_outputs(_results) + self._tracing_service.set_outputs(_results) return _results, _artifacts @@ -180,8 +180,8 @@ class Component(CustomComponent): _artifacts[output.name] = artifact self._artifacts = _artifacts self._results = _results - if self.tracing_service: - self.tracing_service.set_outputs(_results) + if self._tracing_service: + self._tracing_service.set_outputs(_results) return _results, _artifacts def custom_repr(self):