Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
vblagoje committed Apr 24, 2024
1 parent 1540227 commit 31f7792
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from haystack import tracing, component

from haystack import component, tracing
from haystack_integrations.tracing.langfuse import LangfuseTracer

from langfuse import Langfuse
Expand All @@ -14,5 +13,4 @@ def __init__(self, name: str):

@component.output_types(name=str, trace_url=str)
def run(self):
return {"name": self.name,
"trace_url": self.tracer.get_trace_url()}
return {"name": self.name, "trace_url": self.tracer.get_trace_url()}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class LangfuseSpan(Span):
def __init__(self, span: "Union[langfuse.client.StatefulSpanClient, langfuse.client.StatefulTraceClient]") -> None:
self._span = span
# locally cache tags
self._data = {}
self._data: Dict[str, Any] = {}

def set_tag(self, key: str, value: Any) -> None:
coerced_value = tracing_utils.coerce_tag_value(value)
Expand Down Expand Up @@ -106,4 +106,4 @@ def current_span(self) -> Span:
return self._context[-1]

def get_trace_url(self) -> str:
return self._tracer.get_trace_url()
return self._tracer.get_trace_url()
13 changes: 7 additions & 6 deletions integrations/langfuse/tests/test_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

@pytest.mark.integration
@pytest.mark.skipif(
not os.environ.get("LANGFUSE_SECRET_KEY", None) and not os.environ.get("LANGFUSE_PUBLIC_KEY", None),
reason="Export an env var called LANGFUSE_SECRET_KEY and LANGFUSE_PUBLIC_KEY containing Langfuse credentials.",
)
not os.environ.get("LANGFUSE_SECRET_KEY", None) and not os.environ.get("LANGFUSE_PUBLIC_KEY", None),
reason="Export an env var called LANGFUSE_SECRET_KEY and LANGFUSE_PUBLIC_KEY containing Langfuse credentials.",
)
def test_tracing_integration():

pipe = Pipeline()
Expand Down Expand Up @@ -46,9 +46,10 @@ def test_tracing_integration():

try:
# GET request with Basic Authentication on the Langfuse API
response = requests.get(url+uuid, auth=HTTPBasicAuth(os.environ.get("LANGFUSE_PUBLIC_KEY"),
os.environ.get("LANGFUSE_SECRET_KEY")))
response = requests.get(
url + uuid, auth=HTTPBasicAuth(os.environ.get("LANGFUSE_PUBLIC_KEY"), os.environ.get("LANGFUSE_SECRET_KEY"))
)

assert response.status_code == 200, f"Failed to retrieve data from Langfuse API: {response.status_code}"
except requests.exceptions.RequestException as e:
assert False, f"Failed to retrieve data from Langfuse API: {e}"
assert False, f"Failed to retrieve data from Langfuse API: {e}"

0 comments on commit 31f7792

Please sign in to comment.