From 198d55972067daa439c16c50b74ce6f463c92e46 Mon Sep 17 00:00:00 2001 From: Kyle Verhoog Date: Tue, 11 Feb 2025 14:30:30 -0500 Subject: [PATCH] update tests for latest --- .riot/requirements/12135c7.txt | 107 ++++++++++++++++ .riot/requirements/1282607.txt | 111 +++++++++++++++++ .riot/requirements/13d45e0.txt | 105 ++++++++++++++++ .riot/requirements/14825e2.txt | 98 +++++++++++++++ .riot/requirements/173c2c6.txt | 96 +++++++++++++++ .riot/requirements/1e5948b.txt | 102 ++++++++++++++++ .riot/requirements/6f5fdb6.txt | 101 +++++++++++++++ .riot/requirements/eddebbc.txt | 99 +++++++++++++++ riotfile.py | 4 +- .../cassettes/cohere_completion_sync.yaml | 93 -------------- .../cassettes/cohere_completion_sync_0_2.yaml | 85 +++++++++++++ .../cohere_completion_sync_latest.yaml | 66 ++++++++++ ...openai_chat_completion_async_generate.yaml | 115 ++++++++++-------- tests/contrib/langchain/test_langchain.py | 40 +++++- ...ain.test_langchain.test_ai21_llm_sync.json | 10 +- ...n.test_langchain.test_cohere_llm_sync.json | 10 +- ...st_langchain.test_cohere_llm_sync_0_2.json | 31 +++++ ....test_langchain.test_lcel_chain_batch.json | 63 ++-------- ...langchain.test_lcel_chain_batch_async.json | 19 ++- ...langchain.test_lcel_chain_complicated.json | 27 ++-- ...test_langchain.test_lcel_chain_simple.json | 29 ++--- ...angchain.test_lcel_chain_simple_async.json | 31 +++-- ...langchain.test_lcel_with_tools_openai.json | 19 +-- ...test_openai_chat_model_async_generate.json | 21 ++-- ...chat_model_sync_call_langchain_openai.json | 18 +-- ...odel_sync_call_langchain_openai_async.json | 11 +- ....test_openai_chat_model_sync_generate.json | 27 ++-- ...est_openai_chat_model_vision_generate.json | 10 +- ...openai_chat_model_vision_generate_0_2.json | 43 +++++++ ...nai_chat_model_vision_generate_latest.json | 42 +++++++ ....test_langchain.test_openai_llm_async.json | 20 +-- ....test_langchain.test_openai_llm_error.json | 14 +-- ...n.test_langchain.test_openai_llm_sync.json | 18 +-- ...test_openai_llm_sync_multiple_prompts.json | 22 ++-- ...inecone_vectorstore_similarity_search.json | 14 +-- 35 files changed, 1355 insertions(+), 366 deletions(-) create mode 100644 .riot/requirements/12135c7.txt create mode 100644 .riot/requirements/1282607.txt create mode 100644 .riot/requirements/13d45e0.txt create mode 100644 .riot/requirements/14825e2.txt create mode 100644 .riot/requirements/173c2c6.txt create mode 100644 .riot/requirements/1e5948b.txt create mode 100644 .riot/requirements/6f5fdb6.txt create mode 100644 .riot/requirements/eddebbc.txt delete mode 100644 tests/contrib/langchain/cassettes/cohere_completion_sync.yaml create mode 100644 tests/contrib/langchain/cassettes/cohere_completion_sync_0_2.yaml create mode 100644 tests/contrib/langchain/cassettes/cohere_completion_sync_latest.yaml create mode 100644 tests/snapshots/tests.contrib.langchain.test_langchain.test_cohere_llm_sync_0_2.json create mode 100644 tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_vision_generate_0_2.json create mode 100644 tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_vision_generate_latest.json diff --git a/.riot/requirements/12135c7.txt b/.riot/requirements/12135c7.txt new file mode 100644 index 00000000000..7da1c49966d --- /dev/null +++ b/.riot/requirements/12135c7.txt @@ -0,0 +1,107 @@ +# +# This file is autogenerated by pip-compile with Python 3.10 +# by the following command: +# +# pip-compile --allow-unsafe --no-annotate .riot/requirements/12135c7.in +# +ai21==3.0.1 +ai21-tokenizer==0.12.0 +aiohappyeyeballs==2.4.6 +aiohttp==3.10.11 +aiosignal==1.3.2 +annotated-types==0.7.0 +anthropic==0.45.2 +anyio==4.8.0 +async-timeout==4.0.3 +attrs==25.1.0 +boto3==1.36.17 +botocore==1.36.17 +certifi==2025.1.31 +charset-normalizer==3.4.1 +cohere==5.13.12 +coverage[toml]==7.6.12 +dataclasses-json==0.6.7 +distro==1.9.0 +exceptiongroup==1.2.2 +fastavro==1.10.0 +filelock==3.17.0 +frozenlist==1.5.0 +fsspec==2025.2.0 +greenlet==3.0.3 +h11==0.14.0 +httpcore==1.0.7 +httpx==0.27.2 +httpx-sse==0.4.0 +huggingface-hub==0.28.1 +hypothesis==6.45.0 +idna==3.10 +iniconfig==2.0.0 +jiter==0.8.2 +jmespath==1.0.1 +jsonpatch==1.33 +jsonpointer==3.0.0 +langchain==0.3.18 +langchain-anthropic==0.3.7 +langchain-aws==0.2.12 +langchain-cohere==0.4.2 +langchain-community==0.3.17 +langchain-core==0.3.34 +langchain-openai==0.3.5 +langchain-pinecone==0.2.3 +langchain-tests==0.3.11 +langchain-text-splitters==0.3.6 +langsmith==0.3.8 +marshmallow==3.26.1 +mock==5.1.0 +multidict==6.1.0 +mypy-extensions==1.0.0 +numexpr==2.8.5 +numpy==1.26.4 +openai==1.61.1 +opentracing==2.4.0 +orjson==3.10.15 +packaging==24.2 +pinecone==5.4.2 +pinecone-client==4.1.2 +pinecone-plugin-inference==3.1.0 +pinecone-plugin-interface==0.0.7 +pluggy==1.5.0 +propcache==0.2.1 +psutil==6.1.1 +pydantic==2.10.6 +pydantic-core==2.27.2 +pydantic-settings==2.7.1 +pytest==8.3.4 +pytest-asyncio==0.23.7 +pytest-cov==6.0.0 +pytest-mock==3.14.0 +pytest-randomly==3.10.1 +pytest-socket==0.7.0 +python-dateutil==2.9.0.post0 +python-dotenv==1.0.1 +pyyaml==6.0.2 +regex==2024.11.6 +requests==2.32.3 +requests-toolbelt==1.0.0 +respx==0.22.0 +s3transfer==0.11.2 +sentencepiece==0.2.0 +six==1.17.0 +sniffio==1.3.1 +sortedcontainers==2.4.0 +sqlalchemy==2.0.38 +syrupy==4.8.1 +tenacity==8.5.0 +tiktoken==0.8.0 +tokenizers==0.21.0 +tomli==2.2.1 +tqdm==4.67.1 +types-pyyaml==6.0.12.20241230 +types-requests==2.32.0.20241016 +typing-extensions==4.12.2 +typing-inspect==0.9.0 +urllib3==2.3.0 +vcrpy==7.0.0 +wrapt==1.17.2 +yarl==1.18.3 +zstandard==0.23.0 diff --git a/.riot/requirements/1282607.txt b/.riot/requirements/1282607.txt new file mode 100644 index 00000000000..68233f3fdf9 --- /dev/null +++ b/.riot/requirements/1282607.txt @@ -0,0 +1,111 @@ +# +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: +# +# pip-compile --allow-unsafe --no-annotate .riot/requirements/1282607.in +# +ai21==3.0.1 +ai21-tokenizer==0.12.0 +aiohappyeyeballs==2.4.4 +aiohttp==3.10.11 +aiosignal==1.3.2 +annotated-types==0.7.0 +anthropic==0.45.2 +anyio==4.8.0 +async-timeout==4.0.3 +attrs==25.1.0 +boto3==1.36.13 +botocore==1.36.13 +certifi==2025.1.31 +charset-normalizer==3.4.1 +cohere==5.13.11 +coverage[toml]==7.6.10 +dataclasses-json==0.6.7 +defusedxml==0.7.1 +distro==1.9.0 +exceptiongroup==1.2.2 +fastavro==1.10.0 +filelock==3.17.0 +frozenlist==1.5.0 +fsspec==2025.2.0 +greenlet==3.0.3 +h11==0.14.0 +httpcore==1.0.7 +httpx==0.27.2 +httpx-sse==0.4.0 +huggingface-hub==0.28.1 +hypothesis==6.45.0 +idna==3.10 +importlib-metadata==8.6.1 +iniconfig==2.0.0 +jiter==0.8.2 +jmespath==1.0.1 +jsonpatch==1.33 +jsonpointer==3.0.0 +langchain==0.3.17 +langchain-anthropic==0.3.5 +langchain-aws==0.2.12 +langchain-cohere==0.4.2 +langchain-community==0.3.16 +langchain-core==0.3.33 +langchain-openai==0.3.3 +langchain-pinecone==0.2.2 +langchain-tests==0.3.10 +langchain-text-splitters==0.3.5 +langsmith==0.3.5 +marshmallow==3.26.1 +mock==5.1.0 +multidict==6.1.0 +mypy-extensions==1.0.0 +numexpr==2.8.5 +numpy==1.26.4 +openai==1.61.0 +opentracing==2.4.0 +orjson==3.10.15 +packaging==24.2 +pinecone==5.4.2 +pinecone-client==4.1.2 +pinecone-plugin-inference==3.1.0 +pinecone-plugin-interface==0.0.7 +pluggy==1.5.0 +propcache==0.2.1 +psutil==6.1.1 +pydantic==2.10.6 +pydantic-core==2.27.2 +pydantic-settings==2.7.1 +pytest==8.3.4 +pytest-asyncio==0.23.7 +pytest-cov==6.0.0 +pytest-mock==3.14.0 +pytest-randomly==3.10.1 +pytest-socket==0.7.0 +python-dateutil==2.9.0.post0 +python-dotenv==1.0.1 +pyyaml==6.0.2 +regex==2024.11.6 +requests==2.32.3 +requests-toolbelt==1.0.0 +respx==0.22.0 +s3transfer==0.11.2 +sentencepiece==0.2.0 +six==1.17.0 +sniffio==1.3.1 +sortedcontainers==2.4.0 +sqlalchemy==2.0.37 +syrupy==4.8.1 +tenacity==8.5.0 +tiktoken==0.8.0 +tokenizers==0.21.0 +tomli==2.2.1 +tqdm==4.67.1 +types-pyyaml==6.0.12.20241230 +types-requests==2.31.0.6 +types-urllib3==1.26.25.14 +typing-extensions==4.12.2 +typing-inspect==0.9.0 +urllib3==1.26.20 +vcrpy==7.0.0 +wrapt==1.17.2 +yarl==1.18.3 +zipp==3.21.0 +zstandard==0.23.0 diff --git a/.riot/requirements/13d45e0.txt b/.riot/requirements/13d45e0.txt new file mode 100644 index 00000000000..9f6f8bf917a --- /dev/null +++ b/.riot/requirements/13d45e0.txt @@ -0,0 +1,105 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# pip-compile --allow-unsafe --no-annotate .riot/requirements/13d45e0.in +# +ai21==3.0.1 +ai21-tokenizer==0.12.0 +aiohappyeyeballs==2.4.6 +aiohttp==3.10.11 +aiosignal==1.3.2 +annotated-types==0.7.0 +anthropic==0.45.2 +anyio==4.8.0 +attrs==25.1.0 +boto3==1.36.17 +botocore==1.36.17 +certifi==2025.1.31 +charset-normalizer==3.4.1 +cohere==5.13.12 +coverage[toml]==7.6.12 +dataclasses-json==0.6.7 +distro==1.9.0 +exceptiongroup==1.2.2 +fastavro==1.10.0 +filelock==3.17.0 +frozenlist==1.5.0 +fsspec==2025.2.0 +greenlet==3.0.3 +h11==0.14.0 +httpcore==1.0.7 +httpx==0.27.2 +httpx-sse==0.4.0 +huggingface-hub==0.28.1 +hypothesis==6.45.0 +idna==3.10 +iniconfig==2.0.0 +jiter==0.8.2 +jmespath==1.0.1 +jsonpatch==1.33 +jsonpointer==3.0.0 +langchain==0.3.18 +langchain-anthropic==0.3.7 +langchain-aws==0.2.12 +langchain-cohere==0.4.2 +langchain-community==0.3.17 +langchain-core==0.3.34 +langchain-openai==0.3.5 +langchain-pinecone==0.2.3 +langchain-tests==0.3.11 +langchain-text-splitters==0.3.6 +langsmith==0.3.8 +marshmallow==3.26.1 +mock==5.1.0 +multidict==6.1.0 +mypy-extensions==1.0.0 +numexpr==2.8.5 +numpy==1.26.4 +openai==1.61.1 +opentracing==2.4.0 +orjson==3.10.15 +packaging==24.2 +pinecone==5.4.2 +pinecone-client==4.1.2 +pinecone-plugin-inference==3.1.0 +pinecone-plugin-interface==0.0.7 +pluggy==1.5.0 +propcache==0.2.1 +psutil==6.1.1 +pydantic==2.10.6 +pydantic-core==2.27.2 +pydantic-settings==2.7.1 +pytest==8.3.4 +pytest-asyncio==0.23.7 +pytest-cov==6.0.0 +pytest-mock==3.14.0 +pytest-randomly==3.10.1 +pytest-socket==0.7.0 +python-dateutil==2.9.0.post0 +python-dotenv==1.0.1 +pyyaml==6.0.2 +regex==2024.11.6 +requests==2.32.3 +requests-toolbelt==1.0.0 +respx==0.22.0 +s3transfer==0.11.2 +sentencepiece==0.2.0 +six==1.17.0 +sniffio==1.3.1 +sortedcontainers==2.4.0 +sqlalchemy==2.0.38 +syrupy==4.8.1 +tenacity==8.5.0 +tiktoken==0.8.0 +tokenizers==0.21.0 +tqdm==4.67.1 +types-pyyaml==6.0.12.20241230 +types-requests==2.32.0.20241016 +typing-extensions==4.12.2 +typing-inspect==0.9.0 +urllib3==2.3.0 +vcrpy==7.0.0 +wrapt==1.17.2 +yarl==1.18.3 +zstandard==0.23.0 diff --git a/.riot/requirements/14825e2.txt b/.riot/requirements/14825e2.txt new file mode 100644 index 00000000000..ca0bdb3cc8d --- /dev/null +++ b/.riot/requirements/14825e2.txt @@ -0,0 +1,98 @@ +# +# This file is autogenerated by pip-compile with Python 3.10 +# by the following command: +# +# pip-compile --allow-unsafe --no-annotate .riot/requirements/14825e2.in +# +ai21==3.0.1 +ai21-tokenizer==0.12.0 +aiohappyeyeballs==2.4.4 +aiohttp==3.11.11 +aiosignal==1.3.2 +annotated-types==0.7.0 +anthropic==0.26.0 +anyio==4.8.0 +async-timeout==4.0.3 +attrs==25.1.0 +boto3==1.34.51 +botocore==1.34.51 +certifi==2025.1.31 +charset-normalizer==3.4.1 +cohere==5.4.0 +coverage[toml]==7.6.10 +dataclasses-json==0.6.7 +defusedxml==0.7.1 +distro==1.9.0 +exceptiongroup==1.2.2 +faiss-cpu==1.8.0 +fastavro==1.10.0 +filelock==3.17.0 +frozenlist==1.5.0 +fsspec==2025.2.0 +greenlet==3.0.3 +h11==0.14.0 +httpcore==1.0.7 +httpx==0.27.2 +httpx-sse==0.4.0 +huggingface-hub==0.28.1 +hypothesis==6.45.0 +idna==3.10 +iniconfig==2.0.0 +jmespath==1.0.1 +jsonpatch==1.33 +jsonpointer==3.0.0 +langchain==0.1.20 +langchain-anthropic==0.1.11 +langchain-aws==0.1.3 +langchain-cohere==0.1.4 +langchain-community==0.0.38 +langchain-core==0.1.52 +langchain-openai==0.1.6 +langchain-pinecone==0.1.0 +langchain-text-splitters==0.0.2 +langsmith==0.1.147 +marshmallow==3.26.1 +mock==5.1.0 +multidict==6.1.0 +mypy-extensions==1.0.0 +numexpr==2.8.5 +numpy==1.26.4 +openai==1.30.3 +opentracing==2.4.0 +orjson==3.10.15 +packaging==23.2 +pinecone-client==3.2.2 +pluggy==1.5.0 +propcache==0.2.1 +psutil==6.1.1 +pydantic==2.10.6 +pydantic-core==2.27.2 +pytest==8.3.4 +pytest-asyncio==0.23.7 +pytest-cov==6.0.0 +pytest-mock==3.14.0 +pytest-randomly==3.10.1 +python-dateutil==2.9.0.post0 +pyyaml==6.0.2 +regex==2024.11.6 +requests==2.32.3 +requests-toolbelt==1.0.0 +respx==0.22.0 +s3transfer==0.10.4 +sentencepiece==0.2.0 +six==1.17.0 +sniffio==1.3.1 +sortedcontainers==2.4.0 +sqlalchemy==2.0.37 +tenacity==8.5.0 +tiktoken==0.8.0 +tokenizers==0.19.1 +tomli==2.2.1 +tqdm==4.67.1 +types-requests==2.32.0.20241016 +typing-extensions==4.12.2 +typing-inspect==0.9.0 +urllib3==2.0.7 +vcrpy==7.0.0 +wrapt==1.17.2 +yarl==1.18.3 diff --git a/.riot/requirements/173c2c6.txt b/.riot/requirements/173c2c6.txt new file mode 100644 index 00000000000..ddbf6042050 --- /dev/null +++ b/.riot/requirements/173c2c6.txt @@ -0,0 +1,96 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# pip-compile --allow-unsafe --no-annotate .riot/requirements/173c2c6.in +# +ai21==3.0.1 +ai21-tokenizer==0.12.0 +aiohappyeyeballs==2.4.4 +aiohttp==3.11.11 +aiosignal==1.3.2 +annotated-types==0.7.0 +anthropic==0.26.0 +anyio==4.8.0 +attrs==25.1.0 +boto3==1.34.51 +botocore==1.34.51 +certifi==2025.1.31 +charset-normalizer==3.4.1 +cohere==5.4.0 +coverage[toml]==7.6.10 +dataclasses-json==0.6.7 +defusedxml==0.7.1 +distro==1.9.0 +exceptiongroup==1.2.2 +faiss-cpu==1.8.0 +fastavro==1.10.0 +filelock==3.17.0 +frozenlist==1.5.0 +fsspec==2025.2.0 +greenlet==3.0.3 +h11==0.14.0 +httpcore==1.0.7 +httpx==0.27.2 +httpx-sse==0.4.0 +huggingface-hub==0.28.1 +hypothesis==6.45.0 +idna==3.10 +iniconfig==2.0.0 +jmespath==1.0.1 +jsonpatch==1.33 +jsonpointer==3.0.0 +langchain==0.1.20 +langchain-anthropic==0.1.11 +langchain-aws==0.1.3 +langchain-cohere==0.1.4 +langchain-community==0.0.38 +langchain-core==0.1.52 +langchain-openai==0.1.6 +langchain-pinecone==0.1.0 +langchain-text-splitters==0.0.2 +langsmith==0.1.147 +marshmallow==3.26.1 +mock==5.1.0 +multidict==6.1.0 +mypy-extensions==1.0.0 +numexpr==2.8.5 +numpy==1.26.4 +openai==1.30.3 +opentracing==2.4.0 +orjson==3.10.15 +packaging==23.2 +pinecone-client==3.2.2 +pluggy==1.5.0 +propcache==0.2.1 +psutil==6.1.1 +pydantic==2.10.6 +pydantic-core==2.27.2 +pytest==8.3.4 +pytest-asyncio==0.23.7 +pytest-cov==6.0.0 +pytest-mock==3.14.0 +pytest-randomly==3.10.1 +python-dateutil==2.9.0.post0 +pyyaml==6.0.2 +regex==2024.11.6 +requests==2.32.3 +requests-toolbelt==1.0.0 +respx==0.22.0 +s3transfer==0.10.4 +sentencepiece==0.2.0 +six==1.17.0 +sniffio==1.3.1 +sortedcontainers==2.4.0 +sqlalchemy==2.0.37 +tenacity==8.5.0 +tiktoken==0.8.0 +tokenizers==0.19.1 +tqdm==4.67.1 +types-requests==2.32.0.20241016 +typing-extensions==4.12.2 +typing-inspect==0.9.0 +urllib3==2.0.7 +vcrpy==7.0.0 +wrapt==1.17.2 +yarl==1.18.3 diff --git a/.riot/requirements/1e5948b.txt b/.riot/requirements/1e5948b.txt new file mode 100644 index 00000000000..eb5c27427f9 --- /dev/null +++ b/.riot/requirements/1e5948b.txt @@ -0,0 +1,102 @@ +# +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: +# +# pip-compile --allow-unsafe --no-annotate .riot/requirements/1e5948b.in +# +ai21==3.0.1 +ai21-tokenizer==0.12.0 +aiohappyeyeballs==2.4.6 +aiohttp==3.11.12 +aiosignal==1.3.2 +annotated-types==0.7.0 +anthropic==0.26.0 +anyio==4.8.0 +async-timeout==4.0.3 +attrs==25.1.0 +boto3==1.34.51 +botocore==1.34.51 +certifi==2025.1.31 +charset-normalizer==3.4.1 +cohere==5.13.12 +coverage[toml]==7.6.12 +dataclasses-json==0.6.7 +defusedxml==0.7.1 +distro==1.9.0 +exceptiongroup==1.2.2 +fastavro==1.10.0 +filelock==3.17.0 +frozenlist==1.5.0 +fsspec==2025.2.0 +greenlet==3.0.3 +h11==0.14.0 +httpcore==1.0.7 +httpx==0.27.2 +httpx-sse==0.4.0 +huggingface-hub==0.28.1 +hypothesis==6.45.0 +idna==3.10 +importlib-metadata==8.6.1 +iniconfig==2.0.0 +jiter==0.8.2 +jmespath==1.0.1 +jsonpatch==1.33 +jsonpointer==3.0.0 +langchain==0.2.0 +langchain-anthropic==0.1.13 +langchain-aws==0.1.6 +langchain-cohere==0.1.8 +langchain-core==0.2.0 +langchain-openai==0.1.7 +langchain-pinecone==0.1.3 +langchain-text-splitters==0.2.1 +langsmith==0.1.147 +marshmallow==3.26.1 +mock==5.1.0 +multidict==6.1.0 +mypy-extensions==1.0.0 +numexpr==2.8.5 +numpy==1.26.4 +openai==1.61.1 +opentracing==2.4.0 +orjson==3.10.15 +packaging==23.2 +pinecone-client==5.0.1 +pinecone-plugin-inference==1.1.0 +pinecone-plugin-interface==0.0.7 +pluggy==1.5.0 +propcache==0.2.1 +psutil==6.1.1 +pydantic==2.10.6 +pydantic-core==2.27.2 +pytest==8.3.4 +pytest-asyncio==0.23.7 +pytest-cov==6.0.0 +pytest-mock==3.14.0 +pytest-randomly==3.10.1 +python-dateutil==2.9.0.post0 +pyyaml==6.0.2 +regex==2024.11.6 +requests==2.32.3 +requests-toolbelt==1.0.0 +respx==0.22.0 +s3transfer==0.10.4 +sentencepiece==0.2.0 +six==1.17.0 +sniffio==1.3.1 +sortedcontainers==2.4.0 +sqlalchemy==2.0.38 +tenacity==8.5.0 +tiktoken==0.8.0 +tokenizers==0.21.0 +tomli==2.2.1 +tqdm==4.67.1 +types-requests==2.31.0.6 +types-urllib3==1.26.25.14 +typing-extensions==4.12.2 +typing-inspect==0.9.0 +urllib3==1.26.20 +vcrpy==7.0.0 +wrapt==1.17.2 +yarl==1.18.3 +zipp==3.21.0 diff --git a/.riot/requirements/6f5fdb6.txt b/.riot/requirements/6f5fdb6.txt new file mode 100644 index 00000000000..6a65d8a8499 --- /dev/null +++ b/.riot/requirements/6f5fdb6.txt @@ -0,0 +1,101 @@ +# +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: +# +# pip-compile --allow-unsafe --no-annotate .riot/requirements/6f5fdb6.in +# +ai21==3.0.1 +ai21-tokenizer==0.12.0 +aiohappyeyeballs==2.4.4 +aiohttp==3.11.11 +aiosignal==1.3.2 +annotated-types==0.7.0 +anthropic==0.26.0 +anyio==4.8.0 +async-timeout==4.0.3 +attrs==25.1.0 +boto3==1.34.51 +botocore==1.34.51 +certifi==2025.1.31 +charset-normalizer==3.4.1 +cohere==5.4.0 +coverage[toml]==7.6.10 +dataclasses-json==0.6.7 +defusedxml==0.7.1 +distro==1.9.0 +exceptiongroup==1.2.2 +faiss-cpu==1.8.0 +fastavro==1.10.0 +filelock==3.17.0 +frozenlist==1.5.0 +fsspec==2025.2.0 +greenlet==3.0.3 +h11==0.14.0 +httpcore==1.0.7 +httpx==0.27.2 +httpx-sse==0.4.0 +huggingface-hub==0.28.1 +hypothesis==6.45.0 +idna==3.10 +importlib-metadata==8.6.1 +iniconfig==2.0.0 +jmespath==1.0.1 +jsonpatch==1.33 +jsonpointer==3.0.0 +langchain==0.1.20 +langchain-anthropic==0.1.11 +langchain-aws==0.1.3 +langchain-cohere==0.1.4 +langchain-community==0.0.38 +langchain-core==0.1.52 +langchain-openai==0.1.6 +langchain-pinecone==0.1.0 +langchain-text-splitters==0.0.2 +langsmith==0.1.147 +marshmallow==3.26.1 +mock==5.1.0 +multidict==6.1.0 +mypy-extensions==1.0.0 +numexpr==2.8.5 +numpy==1.26.4 +openai==1.30.3 +opentracing==2.4.0 +orjson==3.10.15 +packaging==23.2 +pinecone-client==3.2.2 +pluggy==1.5.0 +propcache==0.2.1 +psutil==6.1.1 +pydantic==2.10.6 +pydantic-core==2.27.2 +pytest==8.3.4 +pytest-asyncio==0.23.7 +pytest-cov==6.0.0 +pytest-mock==3.14.0 +pytest-randomly==3.10.1 +python-dateutil==2.9.0.post0 +pyyaml==6.0.2 +regex==2024.11.6 +requests==2.32.3 +requests-toolbelt==1.0.0 +respx==0.22.0 +s3transfer==0.10.4 +sentencepiece==0.2.0 +six==1.17.0 +sniffio==1.3.1 +sortedcontainers==2.4.0 +sqlalchemy==2.0.37 +tenacity==8.5.0 +tiktoken==0.8.0 +tokenizers==0.19.1 +tomli==2.2.1 +tqdm==4.67.1 +types-requests==2.31.0.6 +types-urllib3==1.26.25.14 +typing-extensions==4.12.2 +typing-inspect==0.9.0 +urllib3==1.26.20 +vcrpy==7.0.0 +wrapt==1.17.2 +yarl==1.18.3 +zipp==3.21.0 diff --git a/.riot/requirements/eddebbc.txt b/.riot/requirements/eddebbc.txt new file mode 100644 index 00000000000..f17e8820f0b --- /dev/null +++ b/.riot/requirements/eddebbc.txt @@ -0,0 +1,99 @@ +# +# This file is autogenerated by pip-compile with Python 3.10 +# by the following command: +# +# pip-compile --allow-unsafe --no-annotate .riot/requirements/eddebbc.in +# +ai21==3.0.1 +ai21-tokenizer==0.12.0 +aiohappyeyeballs==2.4.4 +aiohttp==3.11.11 +aiosignal==1.3.2 +annotated-types==0.7.0 +anthropic==0.26.0 +anyio==4.8.0 +async-timeout==4.0.3 +attrs==25.1.0 +boto3==1.34.51 +botocore==1.34.51 +certifi==2025.1.31 +charset-normalizer==3.4.1 +cohere==5.13.11 +coverage[toml]==7.6.10 +dataclasses-json==0.6.7 +defusedxml==0.7.1 +distro==1.9.0 +exceptiongroup==1.2.2 +fastavro==1.10.0 +filelock==3.17.0 +frozenlist==1.5.0 +fsspec==2025.2.0 +greenlet==3.0.3 +h11==0.14.0 +httpcore==1.0.7 +httpx==0.27.2 +httpx-sse==0.4.0 +huggingface-hub==0.28.1 +hypothesis==6.45.0 +idna==3.10 +iniconfig==2.0.0 +jiter==0.8.2 +jmespath==1.0.1 +jsonpatch==1.33 +jsonpointer==3.0.0 +langchain==0.2.0 +langchain-anthropic==0.1.13 +langchain-aws==0.1.6 +langchain-cohere==0.1.8 +langchain-core==0.2.0 +langchain-openai==0.1.7 +langchain-pinecone==0.1.3 +langchain-text-splitters==0.2.1 +langsmith==0.1.147 +marshmallow==3.26.1 +mock==5.1.0 +multidict==6.1.0 +mypy-extensions==1.0.0 +numexpr==2.8.5 +numpy==1.26.4 +openai==1.61.0 +opentracing==2.4.0 +orjson==3.10.15 +packaging==23.2 +pinecone-client==5.0.1 +pinecone-plugin-inference==1.1.0 +pinecone-plugin-interface==0.0.7 +pluggy==1.5.0 +propcache==0.2.1 +psutil==6.1.1 +pydantic==2.10.6 +pydantic-core==2.27.2 +pytest==8.3.4 +pytest-asyncio==0.23.7 +pytest-cov==6.0.0 +pytest-mock==3.14.0 +pytest-randomly==3.10.1 +python-dateutil==2.9.0.post0 +pyyaml==6.0.2 +regex==2024.11.6 +requests==2.32.3 +requests-toolbelt==1.0.0 +respx==0.22.0 +s3transfer==0.10.4 +sentencepiece==0.2.0 +six==1.17.0 +sniffio==1.3.1 +sortedcontainers==2.4.0 +sqlalchemy==2.0.37 +tenacity==8.5.0 +tiktoken==0.8.0 +tokenizers==0.21.0 +tomli==2.2.1 +tqdm==4.67.1 +types-requests==2.32.0.20241016 +typing-extensions==4.12.2 +typing-inspect==0.9.0 +urllib3==2.0.7 +vcrpy==7.0.0 +wrapt==1.17.2 +yarl==1.18.3 diff --git a/riotfile.py b/riotfile.py index d66b317b1c7..0f8446d73d3 100644 --- a/riotfile.py +++ b/riotfile.py @@ -2534,6 +2534,7 @@ def select_pys(min_version: str = MIN_PYTHON_VERSION, max_version: str = MAX_PYT name="langchain", command="pytest -v {cmdargs} tests/contrib/langchain", pkgs={ + "vcrpy": "==7.0.0", "pytest-asyncio": "==0.23.7", "tiktoken": latest, "huggingface-hub": latest, @@ -2548,7 +2549,6 @@ def select_pys(min_version: str = MIN_PYTHON_VERSION, max_version: str = MAX_PYT venvs=[ Venv( pkgs={ - "vcrpy": "==5.1.0", "langchain": "==0.1.20", "langchain-community": "==0.0.38", "langchain-core": "==0.1.52", @@ -2569,7 +2569,6 @@ def select_pys(min_version: str = MIN_PYTHON_VERSION, max_version: str = MAX_PYT ), Venv( pkgs={ - "vcrpy": "==5.1.0", "langchain": "==0.2.0", "langchain-core": "==0.2.0", "langchain-openai": latest, @@ -2588,7 +2587,6 @@ def select_pys(min_version: str = MIN_PYTHON_VERSION, max_version: str = MAX_PYT ), Venv( pkgs={ - "vcrpy": "==5.1.0", "langchain": latest, "langchain-community": latest, "langchain-core": latest, diff --git a/tests/contrib/langchain/cassettes/cohere_completion_sync.yaml b/tests/contrib/langchain/cassettes/cohere_completion_sync.yaml deleted file mode 100644 index 045995026c8..00000000000 --- a/tests/contrib/langchain/cassettes/cohere_completion_sync.yaml +++ /dev/null @@ -1,93 +0,0 @@ -interactions: -- request: - body: '{"prompt": "What is the secret Krabby Patty recipe?", "stream": false, - "model": "command", "max_tokens": 256, "truncate": null, "temperature": 0.75, "stop_sequences": - null, "k": 0, "p": 1, "frequency_penalty": 0.0, "presence_penalty": 0.0}' - headers: - accept: - - '*/*' - accept-encoding: - - gzip, deflate - connection: - - keep-alive - content-length: - - '234' - content-type: - - application/json - host: - - api.cohere.ai - user-agent: - - python-httpx/0.27.0 - x-client-name: - - langchain - x-fern-language: - - Python - x-fern-sdk-name: - - cohere - x-fern-sdk-version: - - 5.4.0 - method: POST - uri: https://api.cohere.ai/v1/generate - response: - content: '{"id":"5750d279-acdc-4a87-aeb6-7f68c00e0a21","generations":[{"id":"88fa8678-9400-4995-82fb-a2b90ea7db6c","text":" - The secret Krabby Patty recipe has been kept under strict security measures - and has never been publicly revealed. While there is no definitive answer to - what the secret recipe consists of, it is believed to contain a combination - of unique ingredients that give the Krabby Patties their distinctive taste and - flavor. \n\nIn the SpongeBob SquarePants animated series, the recipe is depicted - as a secret formula protected by the owner of the restaurant, Mr. Krabs. The - formula is said to be written on a piece of paper and kept in a secret safe - located behind the cafeteria grill. The ingredients listed in the recipe have - never been fully disclosed, adding to the mystery and allure of the Krabby Patties. - \n\nThe secret recipe has become an integral part of the Krabby Patty''s popularity - and has played a significant role in fueling customers'' curiosity and appetites. - The mystery surrounding the recipe has also become a running joke and source - of comedic moments throughout the SpongeBob SquarePants series. \n\nWhile the - exact components of the secret Krabby Patty recipe may never be officially revealed, - fans of the show can continue to speculate and imagine the delicious combination - of ingredients that make these burgers so irresistible. ","finish_reason":"COMPLETE"}],"prompt":"What - is the secret Krabby Patty recipe?","meta":{"api_version":{"version":"1"},"billed_units":{"input_tokens":10,"output_tokens":244}}}' - headers: - Alt-Svc: - - h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 - Content-Length: - - '1535' - Via: - - 1.1 google - access-control-expose-headers: - - X-Debug-Trace-ID - cache-control: - - no-cache, no-store, no-transform, must-revalidate, private, max-age=0 - content-type: - - application/json - date: - - Tue, 16 Jul 2024 16:32:03 GMT - expires: - - Thu, 01 Jan 1970 00:00:00 UTC - num_chars: - - '1279' - num_tokens: - - '254' - pragma: - - no-cache - server: - - envoy - vary: - - Origin - x-accel-expires: - - '0' - x-api-warning: - - 'unknown field: parameter model is not a valid field' - x-debug-trace-id: - - e642ea61ecf73e8def23f3a5a0de1dfc - x-endpoint-monthly-call-limit: - - '1000' - x-envoy-upstream-service-time: - - '7106' - x-trial-endpoint-call-limit: - - '40' - x-trial-endpoint-call-remaining: - - '39' - http_version: HTTP/1.1 - status_code: 200 -version: 1 diff --git a/tests/contrib/langchain/cassettes/cohere_completion_sync_0_2.yaml b/tests/contrib/langchain/cassettes/cohere_completion_sync_0_2.yaml new file mode 100644 index 00000000000..27595f164a4 --- /dev/null +++ b/tests/contrib/langchain/cassettes/cohere_completion_sync_0_2.yaml @@ -0,0 +1,85 @@ +interactions: +- request: + body: '{"prompt": "What is the secret Krabby Patty recipe?", "model": null, "stop_sequences": + null, "stream": false}' + headers: + accept: + - '*/*' + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '109' + content-type: + - application/json + host: + - api.cohere.com + user-agent: + - python-httpx/0.27.2 + x-client-name: + - langchain:partner + x-fern-language: + - Python + x-fern-sdk-name: + - cohere + x-fern-sdk-version: + - 5.13.11 + method: POST + uri: https://api.cohere.com/v1/generate + response: + body: + string: '{"id":"f15260ab-8bdf-4d3c-9d93-9f272736573c","generations":[{"id":"17be474b-3080-48f5-98f1-59a182419eb3","text":" + The secret Krabby Patty recipe has been kept hidden throughout all the Spongebob + Squarepants episodes and movies, and it is not disclosed in any official media. + Nevertheless, fans have come up with their own speculations on what the recipe + might contain. One popular theory suggests that the recipe includes seaweed, + cheddar, crab, vegetables, and a secret sauce. \n\nIt''s important to note + that the secret Krabby Patty recipe is fictional and solely exists within + the Spongebob Squarepants universe. ","finish_reason":"COMPLETE"}],"prompt":"What + is the secret Krabby Patty recipe?","meta":{"api_version":{"version":"1"},"billed_units":{"input_tokens":10,"output_tokens":101}}}' + headers: + Alt-Svc: + - h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 + Content-Length: + - '791' + Via: + - 1.1 google + access-control-expose-headers: + - X-Debug-Trace-ID + cache-control: + - no-cache, no-store, no-transform, must-revalidate, private, max-age=0 + content-type: + - application/json + date: + - Tue, 11 Feb 2025 18:57:40 GMT + expires: + - Thu, 01 Jan 1970 00:00:00 UTC + num_chars: + - '539' + num_tokens: + - '111' + pragma: + - no-cache + server: + - envoy + vary: + - Origin + x-accel-expires: + - '0' + x-api-warning: + - 'unknown field: parameter model is not a valid field' + x-debug-trace-id: + - b03ef8103599fe9b74524248d2befdec + x-endpoint-monthly-call-limit: + - '1000' + x-envoy-upstream-service-time: + - '2952' + x-trial-endpoint-call-limit: + - '40' + x-trial-endpoint-call-remaining: + - '39' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/contrib/langchain/cassettes/cohere_completion_sync_latest.yaml b/tests/contrib/langchain/cassettes/cohere_completion_sync_latest.yaml new file mode 100644 index 00000000000..f6d335d6780 --- /dev/null +++ b/tests/contrib/langchain/cassettes/cohere_completion_sync_latest.yaml @@ -0,0 +1,66 @@ +interactions: +- request: + body: '' + headers: + accept: + - '*/*' + accept-encoding: + - gzip, deflate, zstd + connection: + - keep-alive + host: + - api.cohere.com + user-agent: + - python-httpx/0.27.2 + x-client-name: + - langchain:partner + x-fern-language: + - Python + x-fern-sdk-name: + - cohere + x-fern-sdk-version: + - 5.13.11 + method: GET + uri: https://api.cohere.com/v1/models?endpoint=chat&default_only=true + response: + body: + string: '{"models":[{"name":"command-r-plus-08-2024","endpoints":["generate","chat","summarize"],"finetuned":false,"context_length":128000,"tokenizer_url":"https://storage.googleapis.com/cohere-public/tokenizers/command-r-plus-08-2024.json","default_endpoints":["chat"]}]}' + headers: + Alt-Svc: + - h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 + Content-Length: + - '263' + Via: + - 1.1 google + access-control-expose-headers: + - X-Debug-Trace-ID + cache-control: + - no-cache, no-store, no-transform, must-revalidate, private, max-age=0 + content-type: + - application/json + date: + - Tue, 11 Feb 2025 19:05:02 GMT + expires: + - Thu, 01 Jan 1970 00:00:00 UTC + pragma: + - no-cache + server: + - envoy + vary: + - Origin + x-accel-expires: + - '0' + x-debug-trace-id: + - 11b0ae78dffcb9678f2f78f21b411310 + x-endpoint-monthly-call-limit: + - '1000' + x-envoy-upstream-service-time: + - '24' + x-trial-endpoint-call-limit: + - '40' + x-trial-endpoint-call-remaining: + - '39' + status: + code: 200 + message: OK +version: 1 diff --git a/tests/contrib/langchain/cassettes/openai_chat_completion_async_generate.yaml b/tests/contrib/langchain/cassettes/openai_chat_completion_async_generate.yaml index 3dfeb2d7892..f6973156f27 100644 --- a/tests/contrib/langchain/cassettes/openai_chat_completion_async_generate.yaml +++ b/tests/contrib/langchain/cassettes/openai_chat_completion_async_generate.yaml @@ -2,23 +2,23 @@ interactions: - request: body: '{"messages": [{"content": "Respond like a frat boy.", "role": "system"}, {"content": "Where''s the nearest equinox gym from Hudson Yards manhattan?", - "role": "user"}], "model": "gpt-3.5-turbo", "max_tokens": 256, "n": 1, "stream": + "role": "user"}], "model": "gpt-3.5-turbo", "max_completion_tokens": 256, "stream": false, "temperature": 0.0}' headers: accept: - application/json accept-encoding: - - gzip, deflate + - gzip, deflate, zstd connection: - keep-alive content-length: - - '256' + - '259' content-type: - application/json host: - api.openai.com user-agent: - - AsyncOpenAI/Python 1.30.3 + - AsyncOpenAI/Python 1.61.0 x-stainless-arch: - arm64 x-stainless-async: @@ -28,27 +28,34 @@ interactions: x-stainless-os: - MacOS x-stainless-package-version: - - 1.30.3 + - 1.61.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: - - 3.10.5 + - 3.12.8 method: POST uri: https://api.openai.com/v1/chat/completions response: - content: "{\n \"id\": \"chatcmpl-9lnJOv7lJAdQqHHCdPrmiUtcSyShh\",\n \"object\": - \"chat.completion\",\n \"created\": 1721177998,\n \"model\": \"gpt-3.5-turbo-0125\",\n + content: "{\n \"id\": \"chatcmpl-AzoNuHYFAHD4k79b8FhyFGBh0sKCK\",\n \"object\": + \"chat.completion\",\n \"created\": 1739295050,\n \"model\": \"gpt-3.5-turbo-0125\",\n \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"Bro, Equinox Hudson Yards is just a few - blocks away from the main entrance, you can't miss it! Get your pump on and - show those weights who's boss!\"\n },\n \"logprobs\": null,\n \"finish_reason\": - \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 31,\n \"completion_tokens\": - 36,\n \"total_tokens\": 67\n },\n \"system_fingerprint\": null\n}\n" + blocks away from the main entrance. You can't miss it, dude. Get your pump on + and show those weights who's boss!\",\n \"refusal\": null\n },\n + \ \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n ],\n + \ \"usage\": {\n \"prompt_tokens\": 31,\n \"completion_tokens\": 39,\n + \ \"total_tokens\": 70,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": null\n}\n" headers: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8a464ad98e5a36cb-YYZ + - 910611ab3de28fab-BOS Connection: - keep-alive Content-Encoding: @@ -56,29 +63,31 @@ interactions: Content-Type: - application/json Date: - - Wed, 17 Jul 2024 00:59:58 GMT + - Tue, 11 Feb 2025 17:30:50 GMT Server: - cloudflare Set-Cookie: - - __cf_bm=ohZx56bv0v4TYMH4Rj0el.dgZV98nYMvoIDKXKi9xpI-1721177998-1.0.1.1-z6KBSSPV4vwEg0xpiWYtDNIWkjEy_QnZMYoerJ.Wcia9cE1osqdxqqKNMMN6oSkjXgkFWrW9QEo.UWlYQ3c89w; - path=/; expires=Wed, 17-Jul-24 01:29:58 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=bORWq.defwpykKOaucFfirzdb_Vs41BfIu3WOEMn6O0-1739295050-1.0.1.1-2XXmJjgPnCe6wlitF4fUoDurxmVdcPdvqEuvE8VeknP9ZWvUdlIceyRr3eiAeI48V8I0j_QSeGvhJbMqvHUEoQ; + path=/; expires=Tue, 11-Feb-25 18:00:50 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=xIuJZGK3aNfdEPICh1G7kCv7dupyRmo8I1zu.GD_Yp8-1721177998896-0.0.1.1-604800000; + - _cfuvid=lOKpjRJ5IjZIhy2Ehw5rhBLqzMeHVecDVSDBIbxW2HI-1739295050747-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Transfer-Encoding: - chunked X-Content-Type-Options: - nosniff + access-control-expose-headers: + - X-Request-ID alt-svc: - h3=":443"; ma=86400 openai-organization: - datadog-4 openai-processing-ms: - - '327' + - '738' openai-version: - '2020-10-01' strict-transport-security: - - max-age=15552000; includeSubDomains; preload + - max-age=31536000; includeSubDomains; preload x-ratelimit-limit-requests: - '15000' x-ratelimit-limit-tokens: @@ -86,35 +95,35 @@ interactions: x-ratelimit-remaining-requests: - '14999' x-ratelimit-remaining-tokens: - - '1999720' + - '1999961' x-ratelimit-reset-requests: - 4ms x-ratelimit-reset-tokens: - - 8ms + - 1ms x-request-id: - - req_f9a1d1ce244f7ebe1f1509a4ec0e1bee + - req_27a0bda649b7fb28c1c2baecdbb04a18 http_version: HTTP/1.1 status_code: 200 - request: body: '{"messages": [{"content": "Respond with a pirate accent.", "role": "system"}, {"content": "How does one get to Bikini Bottom from New York?", "role": "user"}], - "model": "gpt-3.5-turbo", "max_tokens": 256, "n": 1, "stream": false, "temperature": + "model": "gpt-3.5-turbo", "max_completion_tokens": 256, "stream": false, "temperature": 0.0}' headers: accept: - application/json accept-encoding: - - gzip, deflate + - gzip, deflate, zstd connection: - keep-alive content-length: - - '249' + - '252' content-type: - application/json host: - api.openai.com user-agent: - - AsyncOpenAI/Python 1.30.3 + - AsyncOpenAI/Python 1.61.0 x-stainless-arch: - arm64 x-stainless-async: @@ -124,31 +133,37 @@ interactions: x-stainless-os: - MacOS x-stainless-package-version: - - 1.30.3 + - 1.61.0 + x-stainless-retry-count: + - '0' x-stainless-runtime: - CPython x-stainless-runtime-version: - - 3.10.5 + - 3.12.8 method: POST uri: https://api.openai.com/v1/chat/completions response: - content: "{\n \"id\": \"chatcmpl-9lnJOog6ahOLAbHq5DpOzoGQJqBdx\",\n \"object\": - \"chat.completion\",\n \"created\": 1721177998,\n \"model\": \"gpt-3.5-turbo-0125\",\n + content: "{\n \"id\": \"chatcmpl-AzoNu5YI43ZSwEuV2YK54ZWG5lrKK\",\n \"object\": + \"chat.completion\",\n \"created\": 1739295050,\n \"model\": \"gpt-3.5-turbo-0125\",\n \ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": - \"assistant\",\n \"content\": \"Arrr matey, ye be needin' to sail the - high seas to reach Bikini Bottom from New York! Hoist the sails, set a course - for the east, and keep a weather eye out for any scurvy sea monsters along the - way. Arrr, it be a treacherous journey, but with a bit o' luck and a trusty - compass, ye'll find yer way to that legendary place known as Bikini Bottom! - Aye, may the wind be at yer back and the rum flow freely on yer voyage, me hearty!\"\n - \ },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n }\n - \ ],\n \"usage\": {\n \"prompt_tokens\": 29,\n \"completion_tokens\": - 114,\n \"total_tokens\": 143\n },\n \"system_fingerprint\": null\n}\n" + \"assistant\",\n \"content\": \"Arrr matey, ye be wantin' to sail the + high seas from New York to Bikini Bottom, eh? Well, ye best be gettin' yerself + a sturdy ship, a trusty crew, and a map to guide ye through the treacherous + waters. Keep a weather eye out for any scurvy sea monsters or pesky jellyfish + along the way, and ye'll be reachin' Bikini Bottom in no time, me hearty! Good + luck on yer journey, and may the wind be always at yer back! Arrr!\",\n \"refusal\": + null\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n + \ }\n ],\n \"usage\": {\n \"prompt_tokens\": 29,\n \"completion_tokens\": + 116,\n \"total_tokens\": 145,\n \"prompt_tokens_details\": {\n \"cached_tokens\": + 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\": {\n + \ \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\": + 0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\": + \"default\",\n \"system_fingerprint\": null\n}\n" headers: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8a464ad98995a1ea-YYZ + - 910611abd8499009-BOS Connection: - keep-alive Content-Encoding: @@ -156,29 +171,31 @@ interactions: Content-Type: - application/json Date: - - Wed, 17 Jul 2024 00:59:59 GMT + - Tue, 11 Feb 2025 17:30:51 GMT Server: - cloudflare Set-Cookie: - - __cf_bm=2Qo7WALaQ1uQrGdR9Fxw2._JBsDaxAla3uyuHC11e7Y-1721177999-1.0.1.1-KK8zOZuHXV6Cft3fxIDvDKYcBxSK.oKLogTy8_MKV7.16pSGHY6gJe4I6fVNPK503MvBmXsWgYWOk.faRphNiw; - path=/; expires=Wed, 17-Jul-24 01:29:59 GMT; domain=.api.openai.com; HttpOnly; + - __cf_bm=NsWCx36VZ_GgXNhm71BMoXylhwck79xiGNep1mL4QVw-1739295051-1.0.1.1-LyfLNbArWOizQOLxxtkaD552S6su8ePs3OI_SX0iC2TJkfzGcMeFyfpTAM2RumQ6vg05yWEKACevguXNKn3HJQ; + path=/; expires=Tue, 11-Feb-25 18:00:51 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None - - _cfuvid=qiIItPsNovCbSqlifdit6dJns_i_HJRBJE0ho9FtpHo-1721177999715-0.0.1.1-604800000; + - _cfuvid=oRXyVxamwjWa3j3taUf.spHdrwoUt6g6Jx7tyCXw.EA-1739295051479-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None Transfer-Encoding: - chunked X-Content-Type-Options: - nosniff + access-control-expose-headers: + - X-Request-ID alt-svc: - h3=":443"; ma=86400 openai-organization: - datadog-4 openai-processing-ms: - - '1184' + - '1144' openai-version: - '2020-10-01' strict-transport-security: - - max-age=15552000; includeSubDomains; preload + - max-age=31536000; includeSubDomains; preload x-ratelimit-limit-requests: - '15000' x-ratelimit-limit-tokens: @@ -186,13 +203,13 @@ interactions: x-ratelimit-remaining-requests: - '14999' x-ratelimit-remaining-tokens: - - '1999721' + - '1999962' x-ratelimit-reset-requests: - 4ms x-ratelimit-reset-tokens: - - 8ms + - 1ms x-request-id: - - req_54fd8a4de705ad591580d286de2c92fb + - req_370c553c36ab10ae97d78a1e4eebf0f0 http_version: HTTP/1.1 status_code: 200 version: 1 diff --git a/tests/contrib/langchain/test_langchain.py b/tests/contrib/langchain/test_langchain.py index a36dd5321d4..ec3e33d0e22 100644 --- a/tests/contrib/langchain/test_langchain.py +++ b/tests/contrib/langchain/test_langchain.py @@ -26,6 +26,7 @@ "meta.langchain.request.openai.parameters.max_completion_tokens", "meta.langchain.request.openai-chat.parameters.max_completion_tokens" "meta.langchain.request.openai-chat.parameters.max_tokens", + "meta.langchain.request.api_key", ] @@ -68,11 +69,24 @@ def test_openai_llm_error(langchain, langchain_openai, openai_completion_error): llm.generate([12345, 123456]) -@pytest.mark.skipif(LANGCHAIN_VERSION < (0, 2), reason="Requires separate cassette for langchain v0.1") +@pytest.mark.skipif(not ((0, 2) <= LANGCHAIN_VERSION < (0, 3)), reason="Compatible with langchain==0.2 only") @pytest.mark.snapshot -def test_cohere_llm_sync(langchain_cohere, request_vcr): +def test_cohere_llm_sync_0_2(langchain_cohere, request_vcr): llm = langchain_cohere.llms.Cohere(cohere_api_key=os.getenv("COHERE_API_KEY", "")) - with request_vcr.use_cassette("cohere_completion_sync.yaml"): + with request_vcr.use_cassette("cohere_completion_sync_0_2.yaml"): + llm.invoke("What is the secret Krabby Patty recipe?") + + +@pytest.mark.skip(reason="https://github.com/langchain-ai/langchain-cohere/issues/44") +@pytest.mark.skipif(LANGCHAIN_VERSION < (0, 3), reason="Compatible with langchain>=0.3 only") +@pytest.mark.snapshot +def test_cohere_llm_sync_latest(langchain_cohere, request_vcr): + with request_vcr.use_cassette("cohere_completion_sync_latest.yaml"): + llm = langchain_cohere.llms.Cohere( + cohere_api_key=os.getenv("COHERE_API_KEY", ""), + max_tokens=256, + temperature=0.75, + ) llm.invoke("What is the secret Krabby Patty recipe?") @@ -121,7 +135,13 @@ def test_openai_chat_model_sync_generate(langchain_openai, openai_chat_completio ) -@pytest.mark.snapshot(ignores=IGNORE_FIELDS) +@pytest.mark.snapshot( + ignores=IGNORE_FIELDS, + variants={ + "0_2": LANGCHAIN_VERSION < (0, 3), + "latest": LANGCHAIN_VERSION >= (0, 3), + }, +) def test_openai_chat_model_vision_generate(langchain_openai, request_vcr): """ Test that input messages with nested contents are still tagged without error @@ -150,8 +170,18 @@ def test_openai_chat_model_vision_generate(langchain_openai, request_vcr): ) +@pytest.mark.skipif( + LANGCHAIN_VERSION < (0, 3), reason="Bug in langchain: https://github.com/langchain-ai/langgraph/issues/136" +) @pytest.mark.asyncio -@pytest.mark.snapshot(ignores=IGNORE_FIELDS) +@pytest.mark.snapshot( + ignores=IGNORE_FIELDS + + [ + # async batch requests can result in a non-deterministic order + "meta.langchain.response.completions.0.0.content", + "meta.langchain.response.completions.1.0.content", + ] +) async def test_openai_chat_model_async_generate(langchain_openai, request_vcr): chat = langchain_openai.ChatOpenAI(temperature=0, max_tokens=256) with request_vcr.use_cassette("openai_chat_completion_async_generate.yaml"): diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_ai21_llm_sync.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_ai21_llm_sync.json index c654c4a99f9..65c2c02d2b0 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_ai21_llm_sync.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_ai21_llm_sync.json @@ -10,7 +10,7 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679bca8f00000000", + "_dd.p.tid": "67ab8c0100000000", "langchain.request.ai21.parameters.countPenalty.applyToEmojis": "True", "langchain.request.ai21.parameters.countPenalty.applyToNumbers": "True", "langchain.request.ai21.parameters.countPenalty.applyToPunctuations": "True", @@ -43,15 +43,15 @@ "langchain.request.type": "llm", "langchain.response.completions.0.text": "\\nPlankton is trying to steal the Krabby Patty secret formula from Mr. Krabs, so Mr. Krabs wants him gone.", "language": "python", - "runtime-id": "8eb5b60d8a5747e8b4b74b5a0bd313b5" + "runtime-id": "8a5bfd3fb48044a987fe738f946dcfb6" }, "metrics": { "_dd.measured": 1, "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "process_id": 84563 + "process_id": 62151 }, - "duration": 4171000, - "start": 1738263183039739000 + "duration": 4323000, + "start": 1739295745133705000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_cohere_llm_sync.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_cohere_llm_sync.json index 543abb80372..69a2a80eb62 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_cohere_llm_sync.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_cohere_llm_sync.json @@ -10,22 +10,22 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679bca6900000000", + "_dd.p.tid": "67ab842e00000000", "langchain.request.api_key": "...key>", "langchain.request.prompts.0": "What is the secret Krabby Patty recipe?", "langchain.request.provider": "cohere", "langchain.request.type": "llm", "langchain.response.completions.0.text": " The secret Krabby Patty recipe has been kept under strict security measures and has never been publicly revealed. While there i...", "language": "python", - "runtime-id": "b66738590cc84f2cbdf48350b6a67fae" + "runtime-id": "dc68dcd2a98949a29ce685a3e5a3f4b5" }, "metrics": { "_dd.measured": 1, "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "process_id": 83375 + "process_id": 51835 }, - "duration": 2707000, - "start": 1738263145040994000 + "duration": 4697000, + "start": 1739293742931138000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_cohere_llm_sync_0_2.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_cohere_llm_sync_0_2.json new file mode 100644 index 00000000000..24ea97edf22 --- /dev/null +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_cohere_llm_sync_0_2.json @@ -0,0 +1,31 @@ +[[ + { + "name": "langchain.request", + "service": "tests.contrib.langchain", + "resource": "langchain_cohere.llms.Cohere", + "trace_id": 0, + "span_id": 1, + "parent_id": 0, + "type": "", + "error": 0, + "meta": { + "_dd.p.dm": "-0", + "_dd.p.tid": "67aba3a200000000", + "langchain.request.api_key": "...key>", + "langchain.request.prompts.0": "What is the secret Krabby Patty recipe?", + "langchain.request.provider": "cohere", + "langchain.request.type": "llm", + "langchain.response.completions.0.text": " The secret Krabby Patty recipe has been kept hidden throughout all the Spongebob Squarepants episodes and movies, and it is not...", + "language": "python", + "runtime-id": "04758c93703a4496bde390db727d983d" + }, + "metrics": { + "_dd.measured": 1, + "_dd.top_level": 1, + "_dd.tracer_kr": 1.0, + "_sampling_priority_v1": 1, + "process_id": 89808 + }, + "duration": 4524000, + "start": 1739301794296314000 + }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_batch.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_batch.json index 1d3c08d174c..b58da49c754 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_batch.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_batch.json @@ -10,28 +10,22 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679bca4600000000", + "_dd.p.tid": "67ab85a200000000", "langchain.request.inputs.0": "chickens", - "langchain.request.inputs.1": "pigs", "langchain.request.type": "chain", - "langchain.response.outputs.0": "Why did the pig go to the casino?\\n\\nTo play the slop machine!", - "langchain.response.outputs.1": "Why did the chicken join a band? Because it had the drumsticks!", + "langchain.response.outputs.0": "Hello world!", "language": "python", - "runtime-id": "a3a3f4530e0641dcb8e323c08c91c8ce" + "runtime-id": "fa1423fbe1dc49e48a25d131ee2db67f" }, "metrics": { "_dd.measured": 1, "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "langchain.tokens.completion_tokens": 31, - "langchain.tokens.prompt_tokens": 28, - "langchain.tokens.total_cost": 0.00010400000000000001, - "langchain.tokens.total_tokens": 59, - "process_id": 82010 + "process_id": 53037 }, - "duration": 12476000, - "start": 1738263110292401000 + "duration": 6387000, + "start": 1739294114595558000 }, { "name": "langchain.request", @@ -54,48 +48,15 @@ "langchain.request.openai.parameters.temperature": "0.7", "langchain.request.provider": "openai", "langchain.request.type": "chat_model", - "langchain.response.completions.0.0.content": "Why did the pig go to the casino?\\n\\nTo play the slop machine!", + "langchain.response.completions.0.0.content": "Hello world!", "langchain.response.completions.0.0.message_type": "AIMessage" }, "metrics": { "_dd.measured": 1, - "langchain.tokens.completion_tokens": 16, - "langchain.tokens.prompt_tokens": 14, - "langchain.tokens.total_tokens": 30 + "langchain.tokens.completion_tokens": 5, + "langchain.tokens.prompt_tokens": 5, + "langchain.tokens.total_tokens": 10 }, - "duration": 6742000, - "start": 1738263110297341000 - }, - { - "name": "langchain.request", - "service": "tests.contrib.langchain", - "resource": "langchain_openai.chat_models.base.ChatOpenAI", - "trace_id": 0, - "span_id": 3, - "parent_id": 1, - "type": "", - "error": 0, - "meta": { - "langchain.request.api_key": "...key>", - "langchain.request.messages.0.0.content": "Tell me a short joke about pigs", - "langchain.request.messages.0.0.message_type": "HumanMessage", - "langchain.request.model": "gpt-3.5-turbo", - "langchain.request.openai.parameters.model": "gpt-3.5-turbo", - "langchain.request.openai.parameters.model_name": "gpt-3.5-turbo", - "langchain.request.openai.parameters.n": "1", - "langchain.request.openai.parameters.stream": "False", - "langchain.request.openai.parameters.temperature": "0.7", - "langchain.request.provider": "openai", - "langchain.request.type": "chat_model", - "langchain.response.completions.0.0.content": "Why did the chicken join a band? Because it had the drumsticks!", - "langchain.response.completions.0.0.message_type": "AIMessage" - }, - "metrics": { - "_dd.measured": 1, - "langchain.tokens.completion_tokens": 15, - "langchain.tokens.prompt_tokens": 14, - "langchain.tokens.total_tokens": 29 - }, - "duration": 3314000, - "start": 1738263110300645000 + "duration": 3352000, + "start": 1739294114598349000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_batch_async.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_batch_async.json index 1678cfd6db8..2b8be8ab9d4 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_batch_async.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_batch_async.json @@ -10,26 +10,22 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "67a107b300000000", + "_dd.p.tid": "67ab7faa00000000", "langchain.request.inputs.0": "chickens", "langchain.request.type": "chain", "langchain.response.outputs.0": "Hello world!", "language": "python", - "runtime-id": "173629df22ac413d8f83bdff36832495" + "runtime-id": "283efd16ebfc4477ac4f7c0bb3f68acc" }, "metrics": { "_dd.measured": 1, "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "langchain.tokens.completion_tokens": 5, - "langchain.tokens.prompt_tokens": 5, - "langchain.tokens.total_cost": 1.7500000000000002e-05, - "langchain.tokens.total_tokens": 10, - "process_id": 29566 + "process_id": 45846 }, - "duration": 14374000, - "start": 1738606515901135000 + "duration": 7074000, + "start": 1739292586772416000 }, { "name": "langchain.request", @@ -59,9 +55,8 @@ "_dd.measured": 1, "langchain.tokens.completion_tokens": 5, "langchain.tokens.prompt_tokens": 5, - "langchain.tokens.total_cost": 1.7500000000000002e-05, "langchain.tokens.total_tokens": 10 }, - "duration": 5480000, - "start": 1738606515909152000 + "duration": 3915000, + "start": 1739292586774880000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_complicated.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_complicated.json index ed0c9e0f55d..dd21c463c2d 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_complicated.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_complicated.json @@ -10,26 +10,23 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679bca4500000000", + "_dd.p.tid": "67ab7f1b00000000", "langchain.request.inputs.0.style": "a 90s rapper", "langchain.request.inputs.0.topic": "chickens", "langchain.request.type": "chain", - "langchain.response.outputs.0": "Why did the chicken cross the road? To drop some sick rhymes on the other side!", + "langchain.response.outputs.0": "Hello world!", "language": "python", - "runtime-id": "a3a3f4530e0641dcb8e323c08c91c8ce" + "runtime-id": "022f61c4ef604631939aa2b3f277c65d" }, "metrics": { "_dd.measured": 1, "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "langchain.tokens.completion_tokens": 19, - "langchain.tokens.prompt_tokens": 53, - "langchain.tokens.total_tokens": 72, - "process_id": 82010 + "process_id": 45323 }, - "duration": 6933000, - "start": 1738263109330109000 + "duration": 7678000, + "start": 1739292443319724000 }, { "name": "langchain.request", @@ -52,15 +49,15 @@ "langchain.request.openai.parameters.temperature": "0.7", "langchain.request.provider": "openai", "langchain.request.type": "chat_model", - "langchain.response.completions.0.0.content": "Why did the chicken cross the road? To drop some sick rhymes on the other side!", + "langchain.response.completions.0.0.content": "Hello world!", "langchain.response.completions.0.0.message_type": "AIMessage" }, "metrics": { "_dd.measured": 1, - "langchain.tokens.completion_tokens": 19, - "langchain.tokens.prompt_tokens": 53, - "langchain.tokens.total_tokens": 72 + "langchain.tokens.completion_tokens": 5, + "langchain.tokens.prompt_tokens": 5, + "langchain.tokens.total_tokens": 10 }, - "duration": 3680000, - "start": 1738263109333162000 + "duration": 3656000, + "start": 1739292443323453000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_simple.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_simple.json index 66254abefd3..8102365fdee 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_simple.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_simple.json @@ -10,25 +10,22 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679bca4500000000", + "_dd.p.tid": "67ab7faa00000000", "langchain.request.inputs.0.input": "how can langsmith help with testing?", "langchain.request.type": "chain", - "langchain.response.outputs.0": "\\nSystem: Langsmith can help with testing in several ways. First, it can generate automated tests based on your technical docume...", + "langchain.response.outputs.0": "I am a helpful assistant.", "language": "python", - "runtime-id": "a3a3f4530e0641dcb8e323c08c91c8ce" + "runtime-id": "283efd16ebfc4477ac4f7c0bb3f68acc" }, "metrics": { "_dd.measured": 1, "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "langchain.tokens.completion_tokens": 101, - "langchain.tokens.prompt_tokens": 20, - "langchain.tokens.total_tokens": 121, - "process_id": 82010 + "process_id": 45846 }, - "duration": 8281000, - "start": 1738263109118903000 + "duration": 3346000, + "start": 1739292586795212000 }, { "name": "langchain.request", @@ -52,16 +49,16 @@ "langchain.request.prompts.0": "System: You are world class technical documentation writer.\\nHuman: how can langsmith help with testing?", "langchain.request.provider": "openai", "langchain.request.type": "llm", - "langchain.response.completions.0.finish_reason": "stop", + "langchain.response.completions.0.finish_reason": "length", "langchain.response.completions.0.logprobs": "None", - "langchain.response.completions.0.text": "\\nSystem: Langsmith can help with testing in several ways. First, it can generate automated tests based on your technical docume..." + "langchain.response.completions.0.text": "I am a helpful assistant." }, "metrics": { "_dd.measured": 1, - "langchain.tokens.completion_tokens": 101, - "langchain.tokens.prompt_tokens": 20, - "langchain.tokens.total_tokens": 121 + "langchain.tokens.completion_tokens": 5, + "langchain.tokens.prompt_tokens": 5, + "langchain.tokens.total_tokens": 10 }, - "duration": 6142000, - "start": 1738263109120997000 + "duration": 2111000, + "start": 1739292586796420000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_simple_async.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_simple_async.json index 35d458d43f5..4f54ee01816 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_simple_async.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_chain_simple_async.json @@ -10,25 +10,22 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679bca4500000000", + "_dd.p.tid": "67ab8c5a00000000", "langchain.request.inputs.0.input": "how can langsmith help with testing?", "langchain.request.type": "chain", - "langchain.response.outputs.0": "\\nSystem: Langsmith's advanced natural language processing technology can assist with testing by automatically generating test c...", + "langchain.response.outputs.0": "I am a helpful assistant.", "language": "python", - "runtime-id": "a3a3f4530e0641dcb8e323c08c91c8ce" + "runtime-id": "fdd2b886af3f4444aebc1cf48ee7e540" }, "metrics": { "_dd.measured": 1, "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "langchain.tokens.completion_tokens": 78, - "langchain.tokens.prompt_tokens": 20, - "langchain.tokens.total_tokens": 98, - "process_id": 82010 + "process_id": 62462 }, - "duration": 4689000, - "start": 1738263109680310000 + "duration": 3958000, + "start": 1739295834981664000 }, { "name": "langchain.request", @@ -43,25 +40,27 @@ "langchain.request.api_key": "...key>", "langchain.request.model": "gpt-3.5-turbo-instruct", "langchain.request.openai.parameters.frequency_penalty": "0", + "langchain.request.openai.parameters.logprobs": "None", "langchain.request.openai.parameters.max_tokens": "256", "langchain.request.openai.parameters.model_name": "gpt-3.5-turbo-instruct", "langchain.request.openai.parameters.n": "1", "langchain.request.openai.parameters.presence_penalty": "0", + "langchain.request.openai.parameters.seed": "None", "langchain.request.openai.parameters.temperature": "0.7", "langchain.request.openai.parameters.top_p": "1", "langchain.request.prompts.0": "System: You are world class technical documentation writer.\\nHuman: how can langsmith help with testing?", "langchain.request.provider": "openai", "langchain.request.type": "llm", - "langchain.response.completions.0.finish_reason": "stop", + "langchain.response.completions.0.finish_reason": "length", "langchain.response.completions.0.logprobs": "None", - "langchain.response.completions.0.text": "\\nSystem: Langsmith's advanced natural language processing technology can assist with testing by automatically generating test c..." + "langchain.response.completions.0.text": "I am a helpful assistant." }, "metrics": { "_dd.measured": 1, - "langchain.tokens.completion_tokens": 78, - "langchain.tokens.prompt_tokens": 20, - "langchain.tokens.total_tokens": 98 + "langchain.tokens.completion_tokens": 5, + "langchain.tokens.prompt_tokens": 5, + "langchain.tokens.total_tokens": 10 }, - "duration": 3399000, - "start": 1738263109681498000 + "duration": 2873000, + "start": 1739295834982625000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_with_tools_openai.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_with_tools_openai.json index 99c9f2d5c3e..01ab11472da 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_with_tools_openai.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_lcel_with_tools_openai.json @@ -10,7 +10,7 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679bca4500000000", + "_dd.p.tid": "67ab7e7800000000", "langchain.request.api_key": "...key>", "langchain.request.messages.0.0.content": "What is the sum of 1 and 2?", "langchain.request.messages.0.0.message_type": "HumanMessage", @@ -22,24 +22,25 @@ "langchain.request.openai.parameters.temperature": "0.7", "langchain.request.provider": "openai", "langchain.request.type": "chat_model", + "langchain.response.completions.0.0.content": "Hello world!", "langchain.response.completions.0.0.message_type": "AIMessage", "langchain.response.completions.0.0.tool_calls.0.args.a": "1", "langchain.response.completions.0.0.tool_calls.0.args.b": "2", - "langchain.response.completions.0.0.tool_calls.0.id": "call_HlX90uizLM5c3ZHoMkRB1tPt", + "langchain.response.completions.0.0.tool_calls.0.id": "bar", "langchain.response.completions.0.0.tool_calls.0.name": "add", "language": "python", - "runtime-id": "a3a3f4530e0641dcb8e323c08c91c8ce" + "runtime-id": "e7478e576a0c4f41af375b5462892fc3" }, "metrics": { "_dd.measured": 1, "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "langchain.tokens.completion_tokens": 32, - "langchain.tokens.prompt_tokens": 85, - "langchain.tokens.total_tokens": 117, - "process_id": 82010 + "langchain.tokens.completion_tokens": 5, + "langchain.tokens.prompt_tokens": 5, + "langchain.tokens.total_tokens": 10, + "process_id": 44634 }, - "duration": 8071000, - "start": 1738263109237865000 + "duration": 6422000, + "start": 1739292280572397000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_async_generate.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_async_generate.json index 55b112ca6b6..9afa8dbfcc2 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_async_generate.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_async_generate.json @@ -10,7 +10,7 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679bca4500000000", + "_dd.p.tid": "67ab955100000000", "langchain.request.api_key": "...key>", "langchain.request.messages.0.0.content": "Respond like a frat boy.", "langchain.request.messages.0.0.message_type": "SystemMessage", @@ -21,31 +21,30 @@ "langchain.request.messages.1.1.content": "How does one get to Bikini Bottom from New York?", "langchain.request.messages.1.1.message_type": "HumanMessage", "langchain.request.model": "gpt-3.5-turbo", - "langchain.request.openai.parameters.max_tokens": "256", + "langchain.request.openai.parameters.max_completion_tokens": "256", "langchain.request.openai.parameters.model": "gpt-3.5-turbo", "langchain.request.openai.parameters.model_name": "gpt-3.5-turbo", - "langchain.request.openai.parameters.n": "1", "langchain.request.openai.parameters.stream": "False", "langchain.request.openai.parameters.temperature": "0.0", "langchain.request.provider": "openai", "langchain.request.type": "chat_model", - "langchain.response.completions.0.0.content": "Bro, Equinox Hudson Yards is just a few blocks away from the main entrance, you can't miss it! Get your pump on and show those w...", + "langchain.response.completions.0.0.content": "Arrr matey, ye be wantin' to sail the high seas from New York to Bikini Bottom, eh? Well, ye best be gettin' yerself a sturdy sh...", "langchain.response.completions.0.0.message_type": "AIMessage", - "langchain.response.completions.1.0.content": "Arrr matey, ye be needin' to sail the high seas to reach Bikini Bottom from New York! Hoist the sails, set a course for the east...", + "langchain.response.completions.1.0.content": "Bro, Equinox Hudson Yards is just a few blocks away from the main entrance. You can't miss it, dude. Get your pump on and show t...", "langchain.response.completions.1.0.message_type": "AIMessage", "language": "python", - "runtime-id": "a3a3f4530e0641dcb8e323c08c91c8ce" + "runtime-id": "b584c2645df1457da006ddfb84068ad4" }, "metrics": { "_dd.measured": 1, "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "langchain.tokens.completion_tokens": 150, + "langchain.tokens.completion_tokens": 155, "langchain.tokens.prompt_tokens": 60, - "langchain.tokens.total_tokens": 210, - "process_id": 82010 + "langchain.tokens.total_tokens": 215, + "process_id": 72810 }, - "duration": 7706000, - "start": 1738263109445840000 + "duration": 41982000, + "start": 1739298129637919000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_sync_call_langchain_openai.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_sync_call_langchain_openai.json index 0d4c995aba4..6b96a69cb88 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_sync_call_langchain_openai.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_sync_call_langchain_openai.json @@ -10,7 +10,7 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679bca4600000000", + "_dd.p.tid": "67ab7ecc00000000", "langchain.request.api_key": "...key>", "langchain.request.messages.0.0.content": "When do you use 'whom' instead of 'who'?", "langchain.request.messages.0.0.message_type": "HumanMessage", @@ -23,21 +23,21 @@ "langchain.request.openai.parameters.temperature": "0.0", "langchain.request.provider": "openai", "langchain.request.type": "chat_model", - "langchain.response.completions.0.0.content": "'Who' is used as a subject pronoun, while 'whom' is used as an object pronoun. \\n\\nYou use 'who' when referring to the subject o...", + "langchain.response.completions.0.0.content": "Hello world!", "langchain.response.completions.0.0.message_type": "AIMessage", "language": "python", - "runtime-id": "a3a3f4530e0641dcb8e323c08c91c8ce" + "runtime-id": "d0ea57725a644ec2812fe4f559ef8301" }, "metrics": { "_dd.measured": 1, "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "langchain.tokens.completion_tokens": 83, - "langchain.tokens.prompt_tokens": 20, - "langchain.tokens.total_tokens": 103, - "process_id": 82010 + "langchain.tokens.completion_tokens": 5, + "langchain.tokens.prompt_tokens": 5, + "langchain.tokens.total_tokens": 10, + "process_id": 44954 }, - "duration": 4431000, - "start": 1738263110097279000 + "duration": 26606000, + "start": 1739292364850842000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_sync_call_langchain_openai_async.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_sync_call_langchain_openai_async.json index 451c56800d5..b1875784373 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_sync_call_langchain_openai_async.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_sync_call_langchain_openai_async.json @@ -10,7 +10,7 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "67a102ed00000000", + "_dd.p.tid": "67ab7e3d00000000", "langchain.request.api_key": "...key>", "langchain.request.messages.0.0.content": "When do you use 'whom' instead of 'who'?", "langchain.request.messages.0.0.message_type": "HumanMessage", @@ -26,7 +26,7 @@ "langchain.response.completions.0.0.content": "Hello world!", "langchain.response.completions.0.0.message_type": "AIMessage", "language": "python", - "runtime-id": "78a3ac00072b4dbd85dcb18195090178" + "runtime-id": "df194e85a86846eb8c5d90db49b10ef5" }, "metrics": { "_dd.measured": 1, @@ -35,10 +35,9 @@ "_sampling_priority_v1": 1, "langchain.tokens.completion_tokens": 5, "langchain.tokens.prompt_tokens": 5, - "langchain.tokens.total_cost": 1.7500000000000002e-05, "langchain.tokens.total_tokens": 10, - "process_id": 79446 + "process_id": 44304 }, - "duration": 3299000, - "start": 1738605293473896000 + "duration": 4124000, + "start": 1739292221058940000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_sync_generate.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_sync_generate.json index 6e188b6629c..9c34a4625e3 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_sync_generate.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_sync_generate.json @@ -10,7 +10,7 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679bca4500000000", + "_dd.p.tid": "67ab7e4000000000", "langchain.request.api_key": "...key>", "langchain.request.messages.0.0.content": "Respond like a frat boy.", "langchain.request.messages.0.0.message_type": "SystemMessage", @@ -21,31 +21,34 @@ "langchain.request.messages.1.1.content": "How does one get to Bikini Bottom from New York?", "langchain.request.messages.1.1.message_type": "HumanMessage", "langchain.request.model": "gpt-3.5-turbo", - "langchain.request.openai.parameters.max_tokens": "256", + "langchain.request.openai.parameters.max_completion_tokens": "256", "langchain.request.openai.parameters.model": "gpt-3.5-turbo", "langchain.request.openai.parameters.model_name": "gpt-3.5-turbo", - "langchain.request.openai.parameters.n": "1", "langchain.request.openai.parameters.stream": "False", "langchain.request.openai.parameters.temperature": "0.0", "langchain.request.provider": "openai", "langchain.request.type": "chat_model", - "langchain.response.completions.0.0.content": "Bro, Equinox Hudson Yards is just a few blocks away from the main entrance, you can't miss it! Get your pump on and show those w...", + "langchain.response.completions.0.0.content": "Hello world!", "langchain.response.completions.0.0.message_type": "AIMessage", - "langchain.response.completions.1.0.content": "Arrr matey, ye be needin' to sail the high seas to reach Bikini Bottom from New York! Hoist the sails, chart a course, and bewar...", + "langchain.response.completions.0.1.content": "Hello world!", + "langchain.response.completions.0.1.message_type": "AIMessage", + "langchain.response.completions.1.0.content": "Hello world!", "langchain.response.completions.1.0.message_type": "AIMessage", + "langchain.response.completions.1.1.content": "Hello world!", + "langchain.response.completions.1.1.message_type": "AIMessage", "language": "python", - "runtime-id": "a3a3f4530e0641dcb8e323c08c91c8ce" + "runtime-id": "e27a0dfd38fd4f6180c693eb730f52a5" }, "metrics": { "_dd.measured": 1, "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "langchain.tokens.completion_tokens": 110, - "langchain.tokens.prompt_tokens": 60, - "langchain.tokens.total_tokens": 170, - "process_id": 82010 + "langchain.tokens.completion_tokens": 10, + "langchain.tokens.prompt_tokens": 10, + "langchain.tokens.total_tokens": 20, + "process_id": 44408 }, - "duration": 7357000, - "start": 1738263109749677000 + "duration": 10857000, + "start": 1739292224253986000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_vision_generate.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_vision_generate.json index d02c31a219a..7e6130c541a 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_vision_generate.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_vision_generate.json @@ -10,7 +10,7 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679be13400000000", + "_dd.p.tid": "67aba3d500000000", "langchain.request.api_key": "...key>", "langchain.request.messages.0.0.content": "[{'type': 'text', 'text': 'What\u2019s in this image?'}, {'type': 'image_url', 'image_url': {'url': 'https://upload.wikimedia.org/wik...", "langchain.request.messages.0.0.message_type": "HumanMessage", @@ -26,7 +26,7 @@ "langchain.response.completions.0.0.content": "The image shows a scenic landscape with a wooden boardwalk path leading through a lush green field. The sky is blue with scatter...", "langchain.response.completions.0.0.message_type": "AIMessage", "language": "python", - "runtime-id": "19b72b45843c4dc58a27069788eee8d3" + "runtime-id": "11351750830343349261145c8434ba00" }, "metrics": { "_dd.measured": 1, @@ -36,8 +36,8 @@ "langchain.tokens.completion_tokens": 56, "langchain.tokens.prompt_tokens": 1151, "langchain.tokens.total_tokens": 1207, - "process_id": 34354 + "process_id": 90015 }, - "duration": 33752000, - "start": 1738268980686452000 + "duration": 7332000, + "start": 1739301845405092000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_vision_generate_0_2.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_vision_generate_0_2.json new file mode 100644 index 00000000000..7cec96ecad7 --- /dev/null +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_vision_generate_0_2.json @@ -0,0 +1,43 @@ +[[ + { + "name": "langchain.request", + "service": "tests.contrib.langchain", + "resource": "langchain_openai.chat_models.base.ChatOpenAI", + "trace_id": 0, + "span_id": 1, + "parent_id": 0, + "type": "", + "error": 0, + "meta": { + "_dd.p.dm": "-0", + "_dd.p.tid": "67aba53900000000", + "langchain.request.api_key": "...key>", + "langchain.request.messages.0.0.content": "[{'type': 'text', 'text': 'What\u2019s in this image?'}, {'type': 'image_url', 'image_url': {'url': 'https://upload.wikimedia.org/wik...", + "langchain.request.messages.0.0.message_type": "HumanMessage", + "langchain.request.model": "gpt-4o", + "langchain.request.openai.parameters.max_tokens": "256", + "langchain.request.openai.parameters.model": "gpt-4o", + "langchain.request.openai.parameters.model_name": "gpt-4o", + "langchain.request.openai.parameters.n": "1", + "langchain.request.openai.parameters.stream": "False", + "langchain.request.openai.parameters.temperature": "0.0", + "langchain.request.provider": "openai", + "langchain.request.type": "chat_model", + "langchain.response.completions.0.0.content": "The image shows a scenic landscape with a wooden boardwalk path leading through a lush green field. The sky is blue with scatter...", + "langchain.response.completions.0.0.message_type": "AIMessage", + "language": "python", + "runtime-id": "f57f1d1ed0a1427aa6518a5e8e0f6b5f" + }, + "metrics": { + "_dd.measured": 1, + "_dd.top_level": 1, + "_dd.tracer_kr": 1.0, + "_sampling_priority_v1": 1, + "langchain.tokens.completion_tokens": 56, + "langchain.tokens.prompt_tokens": 1151, + "langchain.tokens.total_tokens": 1207, + "process_id": 91261 + }, + "duration": 5909000, + "start": 1739302201749687000 + }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_vision_generate_latest.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_vision_generate_latest.json new file mode 100644 index 00000000000..cb99269a1ec --- /dev/null +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_chat_model_vision_generate_latest.json @@ -0,0 +1,42 @@ +[[ + { + "name": "langchain.request", + "service": "tests.contrib.langchain", + "resource": "langchain_openai.chat_models.base.ChatOpenAI", + "trace_id": 0, + "span_id": 1, + "parent_id": 0, + "type": "", + "error": 0, + "meta": { + "_dd.p.dm": "-0", + "_dd.p.tid": "67aba53d00000000", + "langchain.request.api_key": "...key>", + "langchain.request.messages.0.0.content": "[{'type': 'text', 'text': 'What\u2019s in this image?'}, {'type': 'image_url', 'image_url': {'url': 'https://upload.wikimedia.org/wik...", + "langchain.request.messages.0.0.message_type": "HumanMessage", + "langchain.request.model": "gpt-4o", + "langchain.request.openai.parameters.max_completion_tokens": "256", + "langchain.request.openai.parameters.model": "gpt-4o", + "langchain.request.openai.parameters.model_name": "gpt-4o", + "langchain.request.openai.parameters.stream": "False", + "langchain.request.openai.parameters.temperature": "0.0", + "langchain.request.provider": "openai", + "langchain.request.type": "chat_model", + "langchain.response.completions.0.0.content": "The image shows a scenic landscape with a wooden boardwalk path leading through a lush green field. The sky is blue with scatter...", + "langchain.response.completions.0.0.message_type": "AIMessage", + "language": "python", + "runtime-id": "75ba8641aebf4d7cab7c2f6ea6a07135" + }, + "metrics": { + "_dd.measured": 1, + "_dd.top_level": 1, + "_dd.tracer_kr": 1.0, + "_sampling_priority_v1": 1, + "langchain.tokens.completion_tokens": 56, + "langchain.tokens.prompt_tokens": 1151, + "langchain.tokens.total_tokens": 1207, + "process_id": 91283 + }, + "duration": 8350000, + "start": 1739302205360887000 + }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_async.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_async.json index 5ef01923f7b..e1cba03dc49 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_async.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_async.json @@ -10,7 +10,7 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679bca4500000000", + "_dd.p.tid": "67ab7d7c00000000", "langchain.request.api_key": "...key>", "langchain.request.model": "gpt-3.5-turbo-instruct", "langchain.request.openai.parameters.frequency_penalty": "0", @@ -23,22 +23,22 @@ "langchain.request.prompts.0": "Which team won the 2019 NBA finals?", "langchain.request.provider": "openai", "langchain.request.type": "llm", - "langchain.response.completions.0.finish_reason": "stop", + "langchain.response.completions.0.finish_reason": "length", "langchain.response.completions.0.logprobs": "None", - "langchain.response.completions.0.text": "\\n\\nThe Toronto Raptors won the 2019 NBA Finals.", + "langchain.response.completions.0.text": "I am a helpful assistant.", "language": "python", - "runtime-id": "a3a3f4530e0641dcb8e323c08c91c8ce" + "runtime-id": "d9e83d73ceb446099ab4e686d5a73290" }, "metrics": { "_dd.measured": 1, "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "langchain.tokens.completion_tokens": 12, - "langchain.tokens.prompt_tokens": 10, - "langchain.tokens.total_tokens": 22, - "process_id": 82010 + "langchain.tokens.completion_tokens": 5, + "langchain.tokens.prompt_tokens": 5, + "langchain.tokens.total_tokens": 10, + "process_id": 42486 }, - "duration": 3471000, - "start": 1738263109367504000 + "duration": 3658000, + "start": 1739292028277942000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_error.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_error.json index 19d5b71e02e..eb076c1f010 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_error.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_error.json @@ -10,9 +10,9 @@ "error": 1, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679bca4500000000", - "error.message": "Error code: 400 - {'error': {'message': 'Invalid token in prompt: 123456. Minimum value is 0, maximum value is 100257 (inclusive).', 'type': 'invalid_request_error', 'param': None, 'code': None}}", - "error.stack": "Traceback (most recent call last):\n File \"/Users/sam.brenner/dd/dd-trace-py/ddtrace/contrib/internal/langchain/patch.py\", line 221, in traced_llm_generate\n completions = func(*args, **kwargs)\n File \"/Users/sam.brenner/dd/dd-trace-py/.riot/venv_py31013_19f22257743a59a1/lib/python3.10/site-packages/langchain_core/language_models/llms.py\", line 803, in generate\n output = self._generate_helper(\n File \"/Users/sam.brenner/dd/dd-trace-py/.riot/venv_py31013_19f22257743a59a1/lib/python3.10/site-packages/langchain_core/language_models/llms.py\", line 670, in _generate_helper\n raise e\n File \"/Users/sam.brenner/dd/dd-trace-py/.riot/venv_py31013_19f22257743a59a1/lib/python3.10/site-packages/langchain_core/language_models/llms.py\", line 657, in _generate_helper\n self._generate(\n File \"/Users/sam.brenner/dd/dd-trace-py/.riot/venv_py31013_19f22257743a59a1/lib/python3.10/site-packages/langchain_openai/llms/base.py\", line 350, in _generate\n response = self.client.create(prompt=_prompts, **params)\n File \"/Users/sam.brenner/dd/dd-trace-py/.riot/venv_py31013_19f22257743a59a1/lib/python3.10/site-packages/openai/_utils/_utils.py\", line 277, in wrapper\n return func(*args, **kwargs)\n File \"/Users/sam.brenner/dd/dd-trace-py/.riot/venv_py31013_19f22257743a59a1/lib/python3.10/site-packages/openai/resources/completions.py\", line 528, in create\n return self._post(\n File \"/Users/sam.brenner/dd/dd-trace-py/.riot/venv_py31013_19f22257743a59a1/lib/python3.10/site-packages/openai/_base_client.py\", line 1240, in post\n return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))\n File \"/Users/sam.brenner/dd/dd-trace-py/.riot/venv_py31013_19f22257743a59a1/lib/python3.10/site-packages/openai/_base_client.py\", line 921, in request\n return self._request(\n File \"/Users/sam.brenner/dd/dd-trace-py/.riot/venv_py31013_19f22257743a59a1/lib/python3.10/site-packages/openai/_base_client.py\", line 1020, in _request\n raise self._make_status_error_from_response(err.response) from None\nopenai.BadRequestError: Error code: 400 - {'error': {'message': 'Invalid token in prompt: 123456. Minimum value is 0, maximum value is 100257 (inclusive).', 'type': 'invalid_request_error', 'param': None, 'code': None}}\n", + "_dd.p.tid": "67ab7c9200000000", + "error.message": "Error code: 400 - {'error': {'message': 'Invalid token in prompt: 123. Minimum value is 0, maximum value is 100257 (inclusive).', 'type': 'invalid_request_error', 'param': None, 'code': None}}", + "error.stack": "Traceback (most recent call last):\n File \"/Users/kyle.verhoog/dev/dd-trace-py/ddtrace/contrib/internal/langchain/patch.py\", line 194, in traced_llm_generate\n completions = func(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/kyle.verhoog/dev/dd-trace-py/.riot/venv_py3128_c102664954e2741/lib/python3.12/site-packages/langchain_core/language_models/llms.py\", line 803, in generate\n output = self._generate_helper(\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/kyle.verhoog/dev/dd-trace-py/.riot/venv_py3128_c102664954e2741/lib/python3.12/site-packages/langchain_core/language_models/llms.py\", line 670, in _generate_helper\n raise e\n File \"/Users/kyle.verhoog/dev/dd-trace-py/.riot/venv_py3128_c102664954e2741/lib/python3.12/site-packages/langchain_core/language_models/llms.py\", line 657, in _generate_helper\n self._generate(\n File \"/Users/kyle.verhoog/dev/dd-trace-py/.riot/venv_py3128_c102664954e2741/lib/python3.12/site-packages/langchain_openai/llms/base.py\", line 350, in _generate\n response = self.client.create(prompt=_prompts, **params)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/kyle.verhoog/dev/dd-trace-py/.riot/venv_py3128_c102664954e2741/lib/python3.12/site-packages/openai/_utils/_utils.py\", line 279, in wrapper\n return func(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/kyle.verhoog/dev/dd-trace-py/.riot/venv_py3128_c102664954e2741/lib/python3.12/site-packages/openai/resources/completions.py\", line 539, in create\n return self._post(\n ^^^^^^^^^^^\n File \"/Users/kyle.verhoog/dev/dd-trace-py/.riot/venv_py3128_c102664954e2741/lib/python3.12/site-packages/openai/_base_client.py\", line 1283, in post\n return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/kyle.verhoog/dev/dd-trace-py/.riot/venv_py3128_c102664954e2741/lib/python3.12/site-packages/openai/_base_client.py\", line 960, in request\n return self._request(\n ^^^^^^^^^^^^^^\n File \"/Users/kyle.verhoog/dev/dd-trace-py/.riot/venv_py3128_c102664954e2741/lib/python3.12/site-packages/openai/_base_client.py\", line 1064, in _request\n raise self._make_status_error_from_response(err.response) from None\nopenai.BadRequestError: Error code: 400 - {'error': {'message': 'Invalid token in prompt: 123. Minimum value is 0, maximum value is 100257 (inclusive).', 'type': 'invalid_request_error', 'param': None, 'code': None}}\n", "error.type": "openai.BadRequestError", "langchain.request.api_key": "...key>", "langchain.request.model": "gpt-3.5-turbo-instruct", @@ -28,15 +28,15 @@ "langchain.request.provider": "openai", "langchain.request.type": "llm", "language": "python", - "runtime-id": "a3a3f4530e0641dcb8e323c08c91c8ce" + "runtime-id": "785abff131a64c6f8e16f99f5fc1ee33" }, "metrics": { "_dd.measured": 1, "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "process_id": 82010 + "process_id": 41221 }, - "duration": 7324000, - "start": 1738263109621524000 + "duration": 28472000, + "start": 1739291794401895000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_sync.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_sync.json index 6c25e449a96..ec2b2404a24 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_sync.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_sync.json @@ -10,7 +10,7 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679bca4600000000", + "_dd.p.tid": "67ab7d0a00000000", "langchain.request.api_key": "...key>", "langchain.request.model": "gpt-3.5-turbo-instruct", "langchain.request.openai.parameters.frequency_penalty": "0", @@ -25,20 +25,20 @@ "langchain.request.type": "llm", "langchain.response.completions.0.finish_reason": "length", "langchain.response.completions.0.logprobs": "None", - "langchain.response.completions.0.text": "\\n\\nDescartes, a 17th-century French philosopher, is known for his famous statement \"Cogito, ergo sum\" which is often translated...", + "langchain.response.completions.0.text": "I am a helpful assistant.", "language": "python", - "runtime-id": "a3a3f4530e0641dcb8e323c08c91c8ce" + "runtime-id": "9e11fc5ae0a944ec815293261b4fca7a" }, "metrics": { "_dd.measured": 1, "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "langchain.tokens.completion_tokens": 256, - "langchain.tokens.prompt_tokens": 17, - "langchain.tokens.total_tokens": 273, - "process_id": 82010 + "langchain.tokens.completion_tokens": 5, + "langchain.tokens.prompt_tokens": 5, + "langchain.tokens.total_tokens": 10, + "process_id": 41847 }, - "duration": 3387000, - "start": 1738263110205796000 + "duration": 2395000, + "start": 1739291914730175000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_sync_multiple_prompts.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_sync_multiple_prompts.json index 9d5f107c31b..a0264903e62 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_sync_multiple_prompts.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_openai_llm_sync_multiple_prompts.json @@ -10,7 +10,7 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679bca4600000000", + "_dd.p.tid": "67ab7d1f00000000", "langchain.request.api_key": "...key>", "langchain.request.model": "gpt-3.5-turbo-instruct", "langchain.request.openai.parameters.frequency_penalty": "0", @@ -26,23 +26,23 @@ "langchain.request.type": "llm", "langchain.response.completions.0.finish_reason": "length", "langchain.response.completions.0.logprobs": "None", - "langchain.response.completions.0.text": "\\n\\n1. Start early: It is easier for babies to learn multiple languages when exposed to them from a young age. Babies are born w...", - "langchain.response.completions.1.finish_reason": "stop", + "langchain.response.completions.0.text": "I am a helpful assistant.", + "langchain.response.completions.1.finish_reason": "length", "langchain.response.completions.1.logprobs": "None", - "langchain.response.completions.1.text": "\\n\\nSpongebob has failed his road test at least 26 times.", + "langchain.response.completions.1.text": "I am a helpful assistant.", "language": "python", - "runtime-id": "a3a3f4530e0641dcb8e323c08c91c8ce" + "runtime-id": "b229aa7ed75444fe803669dad390580c" }, "metrics": { "_dd.measured": 1, "_dd.top_level": 1, "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, - "langchain.tokens.completion_tokens": 271, - "langchain.tokens.prompt_tokens": 23, - "langchain.tokens.total_tokens": 294, - "process_id": 82010 + "langchain.tokens.completion_tokens": 5, + "langchain.tokens.prompt_tokens": 5, + "langchain.tokens.total_tokens": 10, + "process_id": 41963 }, - "duration": 3334000, - "start": 1738263110060841000 + "duration": 2657000, + "start": 1739291935349221000 }]] diff --git a/tests/snapshots/tests.contrib.langchain.test_langchain.test_pinecone_vectorstore_similarity_search.json b/tests/snapshots/tests.contrib.langchain.test_langchain.test_pinecone_vectorstore_similarity_search.json index 04022afed1f..8fec893d626 100644 --- a/tests/snapshots/tests.contrib.langchain.test_langchain.test_pinecone_vectorstore_similarity_search.json +++ b/tests/snapshots/tests.contrib.langchain.test_langchain.test_pinecone_vectorstore_similarity_search.json @@ -10,7 +10,7 @@ "error": 0, "meta": { "_dd.p.dm": "-0", - "_dd.p.tid": "679bca4900000000", + "_dd.p.tid": "67ab842e00000000", "langchain.request.api_key": "", "langchain.request.k": "1", "langchain.request.provider": "pineconevectorstore", @@ -22,7 +22,7 @@ "langchain.response.document.0.metadata.wiki-id": "13", "langchain.response.document.0.page_content": "A brilliant mathematician and cryptographer Alan was to become the founder of modern-day computer science and artificial intelli...", "language": "python", - "runtime-id": "a3a3f4530e0641dcb8e323c08c91c8ce" + "runtime-id": "dc68dcd2a98949a29ce685a3e5a3f4b5" }, "metrics": { "_dd.measured": 1, @@ -30,10 +30,10 @@ "_dd.tracer_kr": 1.0, "_sampling_priority_v1": 1, "langchain.response.document_count": 1, - "process_id": 82010 + "process_id": 51835 }, - "duration": 2112000, - "start": 1738263113379347000 + "duration": 2439000, + "start": 1739293742483257000 }, { "name": "langchain.request", @@ -56,6 +56,6 @@ "langchain.request.input_count": 1, "langchain.response.outputs.embedding_length": 1536 }, - "duration": 43000, - "start": 1738263113379475000 + "duration": 69000, + "start": 1739293742483435000 }]]