@@ -37,13 +37,15 @@ def request_vcr():
37
37
yield get_request_vcr ()
38
38
39
39
40
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
40
41
@pytest .mark .snapshot (ignores = IGNORE_FIELDS )
41
42
def test_openai_llm_sync (langchain_openai , request_vcr ):
42
43
llm = langchain_openai .OpenAI ()
43
44
with request_vcr .use_cassette ("openai_completion_sync.yaml" ):
44
45
llm .invoke ("Can you explain what Descartes meant by 'I think, therefore I am'?" )
45
46
46
47
48
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
47
49
@pytest .mark .snapshot (ignores = IGNORE_FIELDS )
48
50
def test_openai_llm_sync_multiple_prompts (langchain_openai , request_vcr ):
49
51
llm = langchain_openai .OpenAI ()
@@ -56,6 +58,7 @@ def test_openai_llm_sync_multiple_prompts(langchain_openai, request_vcr):
56
58
)
57
59
58
60
61
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
59
62
@pytest .mark .asyncio
60
63
@pytest .mark .snapshot (ignores = IGNORE_FIELDS )
61
64
async def test_openai_llm_async (langchain_openai , request_vcr ):
@@ -64,6 +67,7 @@ async def test_openai_llm_async(langchain_openai, request_vcr):
64
67
await llm .agenerate (["Which team won the 2019 NBA finals?" ])
65
68
66
69
70
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
67
71
@pytest .mark .snapshot (ignores = IGNORE_FIELDS )
68
72
def test_openai_llm_error (langchain , langchain_openai , request_vcr ):
69
73
import openai # Imported here because the os env OPENAI_API_KEY needs to be set via langchain fixture before import
@@ -79,6 +83,7 @@ def test_openai_llm_error(langchain, langchain_openai, request_vcr):
79
83
llm .generate ([12345 , 123456 ])
80
84
81
85
86
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
82
87
@pytest .mark .skipif (LANGCHAIN_VERSION < (0 , 2 ), reason = "Requires separate cassette for langchain v0.1" )
83
88
@pytest .mark .snapshot
84
89
def test_cohere_llm_sync (langchain_cohere , request_vcr ):
@@ -87,6 +92,7 @@ def test_cohere_llm_sync(langchain_cohere, request_vcr):
87
92
llm .invoke ("What is the secret Krabby Patty recipe?" )
88
93
89
94
95
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
90
96
@pytest .mark .skipif (
91
97
LANGCHAIN_VERSION < (0 , 2 ) or sys .version_info < (3 , 10 ),
92
98
reason = "Requires separate cassette for langchain v0.1, Python 3.9" ,
@@ -186,8 +192,7 @@ async def test_openai_chat_model_async_generate(langchain_openai, request_vcr):
186
192
def test_openai_embedding_query (langchain_openai , request_vcr ):
187
193
with mock .patch ("langchain_openai.OpenAIEmbeddings._get_len_safe_embeddings" , return_value = [0.0 ] * 1536 ):
188
194
embeddings = langchain_openai .OpenAIEmbeddings ()
189
- with request_vcr .use_cassette ("openai_embedding_query.yaml" ):
190
- embeddings .embed_query ("this is a test query." )
195
+ embeddings .embed_query ("this is a test query." )
191
196
192
197
193
198
@pytest .mark .snapshot
@@ -227,6 +232,7 @@ def test_pinecone_vectorstore_similarity_search(langchain_openai, request_vcr):
227
232
vectorstore .similarity_search ("Who was Alan Turing?" , 1 )
228
233
229
234
235
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
230
236
@pytest .mark .snapshot (ignores = IGNORE_FIELDS )
231
237
def test_lcel_chain_simple (langchain_core , langchain_openai , request_vcr ):
232
238
prompt = langchain_core .prompts .ChatPromptTemplate .from_messages (
@@ -239,6 +245,7 @@ def test_lcel_chain_simple(langchain_core, langchain_openai, request_vcr):
239
245
chain .invoke ({"input" : "how can langsmith help with testing?" })
240
246
241
247
248
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
242
249
@pytest .mark .snapshot (ignores = IGNORE_FIELDS )
243
250
def test_lcel_chain_complicated (langchain_core , langchain_openai , request_vcr ):
244
251
prompt = langchain_core .prompts .ChatPromptTemplate .from_template (
@@ -268,6 +275,7 @@ def test_lcel_chain_complicated(langchain_core, langchain_openai, request_vcr):
268
275
chain .invoke ({"topic" : "chickens" , "style" : "a 90s rapper" })
269
276
270
277
278
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
271
279
@pytest .mark .asyncio
272
280
@pytest .mark .snapshot (ignores = IGNORE_FIELDS )
273
281
async def test_lcel_chain_simple_async (langchain_core , langchain_openai , request_vcr ):
@@ -315,6 +323,7 @@ def test_lcel_chain_batch_311(langchain_core, langchain_openai, request_vcr):
315
323
chain .batch (inputs = ["chickens" , "pigs" ])
316
324
317
325
326
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
318
327
@pytest .mark .snapshot (ignores = IGNORE_FIELDS )
319
328
def test_lcel_chain_nested (langchain_core , langchain_openai , request_vcr ):
320
329
"""
@@ -367,6 +376,7 @@ def test_lcel_chain_non_dict_input(langchain_core):
367
376
sequence .invoke (1 )
368
377
369
378
379
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
370
380
@pytest .mark .snapshot (ignores = IGNORE_FIELDS )
371
381
def test_lcel_with_tools_openai (langchain_core , langchain_openai , request_vcr ):
372
382
import langchain_core .tools
@@ -387,6 +397,7 @@ def add(a: int, b: int) -> int:
387
397
llm_with_tools .invoke ("What is the sum of 1 and 2?" )
388
398
389
399
400
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
390
401
@pytest .mark .snapshot (ignores = IGNORE_FIELDS )
391
402
def test_lcel_with_tools_anthropic (langchain_core , langchain_anthropic , request_vcr ):
392
403
import langchain_core .tools
@@ -413,16 +424,15 @@ def test_faiss_vectorstore_retrieval(langchain_community, langchain_openai, requ
413
424
pytest .skip ("langchain-community not installed which is required for this test." )
414
425
pytest .importorskip ("faiss" , reason = "faiss required for this test." )
415
426
with mock .patch ("langchain_openai.OpenAIEmbeddings._get_len_safe_embeddings" , return_value = [[0.0 ] * 1536 ]):
416
- with request_vcr .use_cassette ("openai_embedding_query.yaml" ):
417
- faiss = langchain_community .vectorstores .faiss .FAISS .from_texts (
418
- ["this is a test query." ],
419
- embedding = langchain_openai .OpenAIEmbeddings (),
420
- )
421
- retriever = faiss .as_retriever ()
427
+ faiss = langchain_community .vectorstores .faiss .FAISS .from_texts (
428
+ ["this is a test query." ], embedding = langchain_openai .OpenAIEmbeddings ()
429
+ )
430
+ retriever = faiss .as_retriever ()
422
431
with request_vcr .use_cassette ("openai_retrieval_embedding.yaml" ):
423
432
retriever .invoke ("What was the message of the last test query?" )
424
433
425
434
435
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
426
436
@pytest .mark .snapshot (ignores = IGNORE_FIELDS )
427
437
def test_streamed_chain (langchain_core , langchain_openai , streamed_response_responder ):
428
438
client = streamed_response_responder (
@@ -444,6 +454,7 @@ def test_streamed_chain(langchain_core, langchain_openai, streamed_response_resp
444
454
pass
445
455
446
456
457
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
447
458
@pytest .mark .snapshot (ignores = IGNORE_FIELDS )
448
459
def test_streamed_chat (langchain_openai , streamed_response_responder ):
449
460
client = streamed_response_responder (
@@ -459,6 +470,7 @@ def test_streamed_chat(langchain_openai, streamed_response_responder):
459
470
pass
460
471
461
472
473
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
462
474
@pytest .mark .snapshot (ignores = IGNORE_FIELDS )
463
475
def test_streamed_llm (langchain_openai , streamed_response_responder ):
464
476
client = streamed_response_responder (
@@ -520,6 +532,7 @@ async def test_astreamed_chat(langchain_openai, async_streamed_response_responde
520
532
pass
521
533
522
534
535
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
523
536
@pytest .mark .snapshot (
524
537
ignores = IGNORE_FIELDS ,
525
538
token = "tests.contrib.langchain.test_langchain.test_streamed_llm" ,
@@ -539,8 +552,7 @@ async def test_astreamed_llm(langchain_openai, async_streamed_response_responder
539
552
pass
540
553
541
554
542
- # TODO: needs fixing in follow-up
543
- @pytest .mark .skip (reason = "Problematic test that needs fixing" )
555
+ @flaky (until = 1754218112 , reason = "Problematic test that needs fixing" )
544
556
@pytest .mark .snapshot (ignores = (IGNORE_FIELDS + ["meta.langchain.request.inputs.0" ]))
545
557
def test_streamed_json_output_parser (langchain , langchain_core , langchain_openai , streamed_response_responder ):
546
558
client = streamed_response_responder (
0 commit comments