Skip to content

Commit 8475d99

Browse files
committed
more fixing from linting instructions
- removing unused imports changing != to is not removing f strings with no assignment removing double defined functions
1 parent 31b875f commit 8475d99

File tree

5 files changed

+5
-24
lines changed

5 files changed

+5
-24
lines changed

ai_agent_instrumentation/opentelemetry-instrumentation-langchain-v2/src/opentelemetry/instrumentation/langchain_v2/callback_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def on_chat_model_start(
186186
model_id = kwargs["invocation_params"]["model_id"]
187187

188188
name = self._get_name_from_callback(serialized, kwargs=kwargs)
189-
if model_id != None:
189+
if model_id is not None:
190190
name = model_id
191191

192192
span = self._create_span(
@@ -223,7 +223,7 @@ def on_llm_start(
223223
model_id = kwargs["invocation_params"]["model_id"]
224224

225225
name = self._get_name_from_callback(serialized, kwargs=kwargs)
226-
if model_id != None:
226+
if model_id is not None:
227227
name = model_id
228228

229229
span = self._create_span(

ai_agent_instrumentation/opentelemetry-instrumentation-langchain-v2/tests/conftest.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,24 +58,6 @@ def scrub_aws_credentials(response):
5858
return response
5959

6060

61-
@pytest.fixture(scope="module")
62-
def vcr_config():
63-
return {
64-
"filter_headers": [
65-
("authorization", "AWS4-HMAC-SHA256 REDACTED"),
66-
("x-amz-date", "REDACTED_DATE"),
67-
("x-amz-security-token", "REDACTED_TOKEN"),
68-
("x-amz-content-sha256", "REDACTED_CONTENT_HASH"),
69-
],
70-
"filter_query_parameters": [
71-
("X-Amz-Security-Token", "REDACTED"),
72-
("X-Amz-Signature", "REDACTED"),
73-
],
74-
"decode_compressed_response": True,
75-
"before_record_response": scrub_aws_credentials,
76-
}
77-
78-
7961
@pytest.fixture(scope="session")
8062
def instrument_langchain(tracer_provider):
8163
langchain_instrumentor = LangChainInstrumentor()

ai_agent_instrumentation/opentelemetry-instrumentation-langchain-v2/tests/test_agents.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def test_agents_with_events_with_content(instrument_with_content, span_exporter,
8181
agent_executor = AgentExecutor(agent=agent, tools=tools)
8282

8383
prompt = "What is AWS?"
84-
response = agent_executor.invoke({"input": prompt})
84+
agent_executor.invoke({"input": prompt})
8585

8686
spans = span_exporter.get_finished_spans()
8787

ai_agent_instrumentation/opentelemetry-instrumentation-langchain-v2/tests/test_chains.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import ast
2-
import os
32

43
import boto3
54
import pytest

ai_agent_instrumentation/opentelemetry-instrumentation-langchain-v2/tests/test_langgraph_agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ def calculate(state: State):
7272

7373
assert "gen_ai.prompt" in calculate_task_span.attributes
7474
assert "gen_ai.completion" in calculate_task_span.attributes
75-
assert f"What's 5 + 5?" in calculate_task_span.attributes["gen_ai.prompt"]
75+
assert "What's 5 + 5?" in calculate_task_span.attributes["gen_ai.prompt"]
7676

7777
langgraph_span = next(span for span in spans if span.name == "chain LangGraph")
7878
assert "gen_ai.prompt" in langgraph_span.attributes
7979
assert "gen_ai.completion" in langgraph_span.attributes
80-
assert f"What's 5 + 5?" in langgraph_span.attributes["gen_ai.prompt"]
80+
assert "What's 5 + 5?" in langgraph_span.attributes["gen_ai.prompt"]
8181
assert response in langgraph_span.attributes["gen_ai.completion"]
8282

8383

0 commit comments

Comments
 (0)