Skip to content

Commit a0da684

Browse files
committed
Format
1 parent 8a80f3a commit a0da684

File tree

1 file changed

+15
-39
lines changed

1 file changed

+15
-39
lines changed

tests/mlmodel_langchain/test_vectorstore.py

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,8 @@
2828
)
2929
from testing_support.validators.validate_custom_event import validate_custom_event_count
3030
from testing_support.validators.validate_custom_events import validate_custom_events
31-
from testing_support.validators.validate_error_trace_attributes import (
32-
validate_error_trace_attributes,
33-
)
34-
from testing_support.validators.validate_transaction_metrics import (
35-
validate_transaction_metrics,
36-
)
31+
from testing_support.validators.validate_error_trace_attributes import validate_error_trace_attributes
32+
from testing_support.validators.validate_transaction_metrics import validate_transaction_metrics
3733

3834
from newrelic.api.background_task import background_task
3935
from newrelic.api.llm_custom_attributes import WithLlmCustomAttributes
@@ -137,9 +133,7 @@ def test_vectorstore_modules_instrumented():
137133
name="test_vectorstore:test_pdf_pagesplitter_vectorstore_in_txn",
138134
scoped_metrics=[("Llm/vectorstore/LangChain/similarity_search", 1)],
139135
rollup_metrics=[("Llm/vectorstore/LangChain/similarity_search", 1)],
140-
custom_metrics=[
141-
(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1),
142-
],
136+
custom_metrics=[(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1)],
143137
background_task=True,
144138
)
145139
@validate_attributes("agent", ["llm"])
@@ -169,9 +163,7 @@ def test_pdf_pagesplitter_vectorstore_in_txn(set_trace_info, embedding_openai_cl
169163
name="test_vectorstore:test_pdf_pagesplitter_vectorstore_in_txn_no_content",
170164
scoped_metrics=[("Llm/vectorstore/LangChain/similarity_search", 1)],
171165
rollup_metrics=[("Llm/vectorstore/LangChain/similarity_search", 1)],
172-
custom_metrics=[
173-
(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1),
174-
],
166+
custom_metrics=[(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1)],
175167
background_task=True,
176168
)
177169
@validate_attributes("agent", ["llm"])
@@ -229,9 +221,7 @@ def test_pdf_pagesplitter_vectorstore_ai_monitoring_disabled(set_trace_info, emb
229221
name="test_vectorstore:test_async_pdf_pagesplitter_vectorstore_in_txn",
230222
scoped_metrics=[("Llm/vectorstore/LangChain/asimilarity_search", 1)],
231223
rollup_metrics=[("Llm/vectorstore/LangChain/asimilarity_search", 1)],
232-
custom_metrics=[
233-
(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1),
234-
],
224+
custom_metrics=[(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1)],
235225
background_task=True,
236226
)
237227
@validate_attributes("agent", ["llm"])
@@ -265,9 +255,7 @@ async def _test():
265255
name="test_vectorstore:test_async_pdf_pagesplitter_vectorstore_in_txn_no_content",
266256
scoped_metrics=[("Llm/vectorstore/LangChain/asimilarity_search", 1)],
267257
rollup_metrics=[("Llm/vectorstore/LangChain/asimilarity_search", 1)],
268-
custom_metrics=[
269-
(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1),
270-
],
258+
custom_metrics=[(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1)],
271259
background_task=True,
272260
)
273261
@validate_attributes("agent", ["llm"])
@@ -341,23 +329,20 @@ async def _test():
341329
"ingest_source": "Python",
342330
"error": True,
343331
},
344-
),
332+
)
345333
]
346334

347335

348336
@reset_core_stats_engine()
349337
@validate_error_trace_attributes(
350-
callable_name(AssertionError),
351-
required_params={"user": ["vector_store_id"], "intrinsic": [], "agent": []},
338+
callable_name(AssertionError), required_params={"user": ["vector_store_id"], "intrinsic": [], "agent": []}
352339
)
353340
@validate_custom_events(events_with_context_attrs(vectorstore_error_events))
354341
@validate_transaction_metrics(
355342
name="test_vectorstore:test_vectorstore_error",
356343
scoped_metrics=[("Llm/vectorstore/LangChain/similarity_search", 1)],
357344
rollup_metrics=[("Llm/vectorstore/LangChain/similarity_search", 1)],
358-
custom_metrics=[
359-
(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1),
360-
],
345+
custom_metrics=[(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1)],
361346
background_task=True,
362347
)
363348
@background_task()
@@ -376,17 +361,14 @@ def test_vectorstore_error(set_trace_info, embedding_openai_client, loop):
376361
@reset_core_stats_engine()
377362
@disabled_ai_monitoring_record_content_settings
378363
@validate_error_trace_attributes(
379-
callable_name(AssertionError),
380-
required_params={"user": ["vector_store_id"], "intrinsic": [], "agent": []},
364+
callable_name(AssertionError), required_params={"user": ["vector_store_id"], "intrinsic": [], "agent": []}
381365
)
382366
@validate_custom_events(vectorstore_events_sans_content(vectorstore_error_events))
383367
@validate_transaction_metrics(
384368
name="test_vectorstore:test_vectorstore_error_no_content",
385369
scoped_metrics=[("Llm/vectorstore/LangChain/similarity_search", 1)],
386370
rollup_metrics=[("Llm/vectorstore/LangChain/similarity_search", 1)],
387-
custom_metrics=[
388-
(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1),
389-
],
371+
custom_metrics=[(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1)],
390372
background_task=True,
391373
)
392374
@background_task()
@@ -403,17 +385,14 @@ def test_vectorstore_error_no_content(set_trace_info, embedding_openai_client):
403385

404386
@reset_core_stats_engine()
405387
@validate_error_trace_attributes(
406-
callable_name(AssertionError),
407-
required_params={"user": ["vector_store_id"], "intrinsic": [], "agent": []},
388+
callable_name(AssertionError), required_params={"user": ["vector_store_id"], "intrinsic": [], "agent": []}
408389
)
409390
@validate_custom_events(events_with_context_attrs(vectorstore_error_events))
410391
@validate_transaction_metrics(
411392
name="test_vectorstore:test_async_vectorstore_error",
412393
scoped_metrics=[("Llm/vectorstore/LangChain/asimilarity_search", 1)],
413394
rollup_metrics=[("Llm/vectorstore/LangChain/asimilarity_search", 1)],
414-
custom_metrics=[
415-
(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1),
416-
],
395+
custom_metrics=[(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1)],
417396
background_task=True,
418397
)
419398
@background_task()
@@ -437,17 +416,14 @@ async def _test():
437416
@reset_core_stats_engine()
438417
@disabled_ai_monitoring_record_content_settings
439418
@validate_error_trace_attributes(
440-
callable_name(AssertionError),
441-
required_params={"user": ["vector_store_id"], "intrinsic": [], "agent": []},
419+
callable_name(AssertionError), required_params={"user": ["vector_store_id"], "intrinsic": [], "agent": []}
442420
)
443421
@validate_custom_events(vectorstore_events_sans_content(vectorstore_error_events))
444422
@validate_transaction_metrics(
445423
name="test_vectorstore:test_async_vectorstore_error_no_content",
446424
scoped_metrics=[("Llm/vectorstore/LangChain/asimilarity_search", 1)],
447425
rollup_metrics=[("Llm/vectorstore/LangChain/asimilarity_search", 1)],
448-
custom_metrics=[
449-
(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1),
450-
],
426+
custom_metrics=[(f"Supportability/Python/ML/LangChain/{langchain.__version__}", 1)],
451427
background_task=True,
452428
)
453429
@background_task()

0 commit comments

Comments
 (0)