From 7d1c7d2cc665719972bb66ca51a0b41544e3f7da Mon Sep 17 00:00:00 2001 From: Martin Krasser Date: Fri, 17 Nov 2023 08:18:14 +0100 Subject: [PATCH] Move to experimental --- docs/docs/integrations/chat/llama2_chat.ipynb | 155 ++++++++++-------- .../chat_models/__init__.py | 26 +++ .../chat_models/llm_wrapper.py | 0 libs/experimental/poetry.lock | 34 +++- libs/experimental/pyproject.toml | 1 + .../tests/unit_tests/chat_models/__init__.py | 0 .../test_llm_wrapper_llama2chat.py | 6 +- .../chat_models/test_llm_wrapper_orca.py | 4 +- .../chat_models/test_llm_wrapper_vicuna.py | 4 +- .../langchain/chat_models/__init__.py | 4 - 10 files changed, 148 insertions(+), 86 deletions(-) create mode 100644 libs/experimental/langchain_experimental/chat_models/__init__.py rename libs/{langchain/langchain => experimental/langchain_experimental}/chat_models/llm_wrapper.py (100%) create mode 100644 libs/experimental/tests/unit_tests/chat_models/__init__.py rename libs/{langchain => experimental}/tests/unit_tests/chat_models/test_llm_wrapper_llama2chat.py (96%) rename libs/{langchain => experimental}/tests/unit_tests/chat_models/test_llm_wrapper_orca.py (94%) rename libs/{langchain => experimental}/tests/unit_tests/chat_models/test_llm_wrapper_vicuna.py (93%) diff --git a/docs/docs/integrations/chat/llama2_chat.ipynb b/docs/docs/integrations/chat/llama2_chat.ipynb index 9886da0c4aec3..48493973f685e 100644 --- a/docs/docs/integrations/chat/llama2_chat.ipynb +++ b/docs/docs/integrations/chat/llama2_chat.ipynb @@ -14,14 +14,14 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "36c03540", "metadata": {}, "outputs": [], "source": [ "from langchain.chains import LLMChain\n", - "from langchain.chat_models import Llama2Chat\n", - "from langchain.memory import ConversationBufferMemory" + "from langchain.memory import ConversationBufferMemory\n", + "from langchain_experimental.chat_models import Llama2Chat" ] }, { @@ -34,7 +34,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "9bbfaf3a", "metadata": {}, "outputs": [], @@ -154,7 +154,7 @@ "name": "stdout", "output_type": "stream", "text": [ - " Certainly! Here are a few popular locations to consider visiting in Vienna:\n", + " Sure, I'd be happy to help! Here are a few popular locations to consider visiting in Vienna:\n", "\n", "1. Schönbrunn Palace\n", "2. St. Stephen's Cathedral\n", @@ -170,7 +170,11 @@ } ], "source": [ - "print(chain.run(text=\"What can I see in Vienna? Propose a few locations. Names only, no details.\"))" + "print(\n", + " chain.run(\n", + " text=\"What can I see in Vienna? Propose a few locations. Names only, no details.\"\n", + " )\n", + ")" ] }, { @@ -183,19 +187,9 @@ "name": "stdout", "output_type": "stream", "text": [ - " Sure! St. Stephen's Cathedral (Stephansdom) is a stunning Gothic cathedral located in the heart of Vienna. It's one of the city's most recognizable landmarks and a must-visit attraction for anyone interested in history, architecture, and religion.\n", - "\n", - "Here are some interesting facts about St. Stephen's Cathedral:\n", - "\n", - "1. Construction began in 1137 and took over 80 years to complete.\n", - "2. The cathedral features a unique blend of Gothic and Romanesque styles.\n", - "3. The south tower is 136 meters tall and offers breathtaking views of the city.\n", - "4. The cathedral's interior is adorned with intricate stone carvings, colorful stained glass windows, and impressive frescoes.\n", - "5. St. Stephen's Cathedral is the seat of the Archdiocese of Vienna and hosts many important religious events throughout the year.\n", - "6. The cathedral's crypt houses the tombs of many famous Viennese figures, including Mozart's family and several Austrian monarchs.\n", - "7. The cathedral's bell, known as the Pummerin, weighs over 20 tons and is one of the largest in Europe.\n", + " Certainly! St. Stephen's Cathedral (Stephansdom) is one of the most recognizable landmarks in Vienna and a must-see attraction for visitors. This stunning Gothic cathedral is located in the heart of the city and is known for its intricate stone carvings, colorful stained glass windows, and impressive dome.\n", "\n", - "Visitors can take a guided tour of the cathedral, climb up the south tower for panoramic views, or simply sit in the pews and admire the beauty of the building. Whether you're interested in history, architecture, or religion, St. Stephen's Cathedral is an unmissable attraction in Vienna.\n" + "The cathedral was built in the 12th century and has been the site of many important events throughout history, including the coronation of Holy Roman emperors and the funeral of Mozart. Today, it is still an active place of worship and offers guided tours, concerts, and special events. Visitors can climb up the south tower for panoramic views of the city or attend a service to experience the beautiful music and chanting.\n" ] } ], @@ -231,7 +225,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "llama_model_loader: loaded meta data with 19 key-value pairs and 291 tensors from /home/martin/Models/llama-2-7b-chat.Q4_0.gguf (version GGUF V2 (latest))\n", + "llama_model_loader: loaded meta data with 19 key-value pairs and 291 tensors from /home/martin/Models/llama-2-7b-chat.Q4_0.gguf (version GGUF V2)\n", "llama_model_loader: - tensor 0: token_embd.weight q4_0 [ 4096, 32000, 1, 1 ]\n", "llama_model_loader: - tensor 1: blk.0.attn_norm.weight f32 [ 4096, 1, 1, 1 ]\n", "llama_model_loader: - tensor 2: blk.0.ffn_down.weight q4_0 [ 11008, 4096, 1, 1 ]\n", @@ -545,48 +539,62 @@ "llama_model_loader: - type f32: 65 tensors\n", "llama_model_loader: - type q4_0: 225 tensors\n", "llama_model_loader: - type q6_K: 1 tensors\n", - "llm_load_print_meta: format = GGUF V2 (latest)\n", - "llm_load_print_meta: arch = llama\n", - "llm_load_print_meta: vocab type = SPM\n", - "llm_load_print_meta: n_vocab = 32000\n", - "llm_load_print_meta: n_merges = 0\n", - "llm_load_print_meta: n_ctx_train = 4096\n", - "llm_load_print_meta: n_ctx = 512\n", - "llm_load_print_meta: n_embd = 4096\n", - "llm_load_print_meta: n_head = 32\n", - "llm_load_print_meta: n_head_kv = 32\n", - "llm_load_print_meta: n_layer = 32\n", - "llm_load_print_meta: n_rot = 128\n", - "llm_load_print_meta: n_gqa = 1\n", - "llm_load_print_meta: f_norm_eps = 1.0e-05\n", - "llm_load_print_meta: f_norm_rms_eps = 1.0e-06\n", - "llm_load_print_meta: n_ff = 11008\n", - "llm_load_print_meta: freq_base = 10000.0\n", - "llm_load_print_meta: freq_scale = 1\n", - "llm_load_print_meta: model type = 7B\n", - "llm_load_print_meta: model ftype = mostly Q4_0\n", - "llm_load_print_meta: model size = 6.74 B\n", + "llm_load_vocab: special tokens definition check successful ( 259/32000 ).\n", + "llm_load_print_meta: format = GGUF V2\n", + "llm_load_print_meta: arch = llama\n", + "llm_load_print_meta: vocab type = SPM\n", + "llm_load_print_meta: n_vocab = 32000\n", + "llm_load_print_meta: n_merges = 0\n", + "llm_load_print_meta: n_ctx_train = 4096\n", + "llm_load_print_meta: n_embd = 4096\n", + "llm_load_print_meta: n_head = 32\n", + "llm_load_print_meta: n_head_kv = 32\n", + "llm_load_print_meta: n_layer = 32\n", + "llm_load_print_meta: n_rot = 128\n", + "llm_load_print_meta: n_gqa = 1\n", + "llm_load_print_meta: f_norm_eps = 0.0e+00\n", + "llm_load_print_meta: f_norm_rms_eps = 1.0e-06\n", + "llm_load_print_meta: f_clamp_kqv = 0.0e+00\n", + "llm_load_print_meta: f_max_alibi_bias = 0.0e+00\n", + "llm_load_print_meta: n_ff = 11008\n", + "llm_load_print_meta: rope scaling = linear\n", + "llm_load_print_meta: freq_base_train = 10000.0\n", + "llm_load_print_meta: freq_scale_train = 1\n", + "llm_load_print_meta: n_yarn_orig_ctx = 4096\n", + "llm_load_print_meta: rope_finetuned = unknown\n", + "llm_load_print_meta: model type = 7B\n", + "llm_load_print_meta: model ftype = mostly Q4_0\n", + "llm_load_print_meta: model params = 6.74 B\n", + "llm_load_print_meta: model size = 3.56 GiB (4.54 BPW) \n", "llm_load_print_meta: general.name = LLaMA v2\n", "llm_load_print_meta: BOS token = 1 ''\n", "llm_load_print_meta: EOS token = 2 ''\n", "llm_load_print_meta: UNK token = 0 ''\n", "llm_load_print_meta: LF token = 13 '<0x0A>'\n", - "llm_load_tensors: ggml ctx size = 0.09 MB\n", - "llm_load_tensors: mem required = 3647.96 MB (+ 256.00 MB per state)\n", + "llm_load_tensors: ggml ctx size = 0.11 MB\n", + "llm_load_tensors: mem required = 3647.97 MB\n", "..................................................................................................\n", + "llama_new_context_with_model: n_ctx = 512\n", + "llama_new_context_with_model: freq_base = 10000.0\n", + "llama_new_context_with_model: freq_scale = 1\n", "llama_new_context_with_model: kv self size = 256.00 MB\n", - "llama_new_context_with_model: compute buffer total size = 71.97 MB\n", - "AVX = 1 | AVX2 = 1 | AVX512 = 0 | AVX512_VBMI = 0 | AVX512_VNNI = 0 | FMA = 1 | NEON = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 0 | SSE3 = 1 | SSSE3 = 1 | VSX = 0 | \n" + "llama_build_graph: non-view tensors processed: 740/740\n", + "llama_new_context_with_model: compute buffer total size = 2.66 MB\n", + "AVX = 1 | AVX2 = 1 | AVX512 = 1 | AVX512_VBMI = 0 | AVX512_VNNI = 1 | FMA = 1 | NEON = 0 | ARM_FMA = 0 | F16C = 1 | FP16_VA = 0 | WASM_SIMD = 0 | BLAS = 0 | SSE3 = 1 | SSSE3 = 1 | VSX = 0 | \n" ] } ], "source": [ "from os.path import expanduser\n", + "\n", "from langchain.llms import LlamaCpp\n", "\n", "model_path = expanduser(\"~/Models/llama-2-7b-chat.Q4_0.gguf\")\n", "\n", - "llm = LlamaCpp(model_path=model_path, streaming=False,)\n", + "llm = LlamaCpp(\n", + " model_path=model_path,\n", + " streaming=False,\n", + ")\n", "model = Llama2Chat(llm=llm)" ] }, @@ -619,17 +627,19 @@ "name": "stdout", "output_type": "stream", "text": [ - " Of course! Vienna is a beautiful city with a rich history and culture. Here are some must-see locations to consider:\n", + " Of course! Vienna is a beautiful city with a rich history and culture. Here are some of the top tourist attractions you might want to consider visiting:\n", "1. Schönbrunn Palace\n", "2. St. Stephen's Cathedral\n", "3. Hofburg Palace\n", "4. Belvedere Palace\n", - "5. MuseumsQuartier\n", - "6. Prater Park\n", - "7. Vienna State Opera\n", - "8. Burgtheater\n", - "9. Albertina Museum\n", - "10. Vienna Woods (Nussbaumer Forst)\n" + "5. Prater Park\n", + "6. MuseumsQuartier\n", + "7. Ringstrasse\n", + "8. Vienna State Opera\n", + "9. Kunsthistorisches Museum\n", + "10. Imperial Palace\n", + "\n", + "These are just a few of the many amazing places to see in Vienna. Each one has its own unique history and charm, so I hope you enjoy exploring this beautiful city!\n" ] }, { @@ -637,16 +647,20 @@ "output_type": "stream", "text": [ "\n", - "llama_print_timings: load time = 289.55 ms\n", - "llama_print_timings: sample time = 40.63 ms / 104 runs ( 0.39 ms per token, 2559.50 tokens per second)\n", - "llama_print_timings: prompt eval time = 1587.24 ms / 48 tokens ( 33.07 ms per token, 30.24 tokens per second)\n", - "llama_print_timings: eval time = 6392.08 ms / 103 runs ( 62.06 ms per token, 16.11 tokens per second)\n", - "llama_print_timings: total time = 8245.60 ms\n" + "llama_print_timings: load time = 250.46 ms\n", + "llama_print_timings: sample time = 56.40 ms / 144 runs ( 0.39 ms per token, 2553.37 tokens per second)\n", + "llama_print_timings: prompt eval time = 1444.25 ms / 47 tokens ( 30.73 ms per token, 32.54 tokens per second)\n", + "llama_print_timings: eval time = 8832.02 ms / 143 runs ( 61.76 ms per token, 16.19 tokens per second)\n", + "llama_print_timings: total time = 10645.94 ms\n" ] } ], "source": [ - "print(chain.run(text=\"What can I see in Vienna? Propose a few locations. Names only, no details.\"))" + "print(\n", + " chain.run(\n", + " text=\"What can I see in Vienna? Propose a few locations. Names only, no details.\"\n", + " )\n", + ")" ] }, { @@ -666,14 +680,11 @@ "name": "stdout", "output_type": "stream", "text": [ - " Of course! St. Stephen's Cathedral, also known as Stephansdom, is a must-see attraction in Vienna. It is a beautiful Gothic church located in the heart of the city, on Stephansplatz. The cathedral was founded in the 12th century and has been a symbol of Vienna ever since.\n", - "Some of the notable features of St. Stephen's Cathedral include:\n", - "* Its impressive height, with a tower that reaches 137 meters (450 feet)\n", - "* The colorful tile roof, which is made up of more than 250,000 tiles and features intricate designs\n", - "* The stunning stained glass windows, which depict scenes from the Bible and Austrian history\n", - "* The marble altars and statues, including a famous statue of Mary Magdalene by sculptor Johann Georg von Hagen\n", - "* The fascinating history, including its role as a place of worship, a symbol of Vienna's power and influence, and a site of important historical events such as coronations and funerals.\n", - "Visitors can take a guided tour of the cathedral, climb to the top of the South Tower for\n" + " Of course! St. Stephen's Cathedral (also known as Stephansdom) is a stunning Gothic-style cathedral located in the heart of Vienna, Austria. It is one of the most recognizable landmarks in the city and is considered a symbol of Vienna.\n", + "Here are some interesting facts about St. Stephen's Cathedral:\n", + "1. History: The construction of St. Stephen's Cathedral began in the 12th century on the site of a former Romanesque church, and it took over 600 years to complete. The cathedral has been renovated and expanded several times throughout its history, with the most significant renovation taking place in the 19th century.\n", + "2. Architecture: St. Stephen's Cathedral is built in the Gothic style, characterized by its tall spires, pointed arches, and intricate stone carvings. The cathedral features a mix of Romanesque, Gothic, and Baroque elements, making it a unique blend of styles.\n", + "3. Design: The cathedral's design is based on the plan of a cross with a long nave and two shorter arms extending from it. The main altar is\n" ] }, { @@ -681,11 +692,11 @@ "output_type": "stream", "text": [ "\n", - "llama_print_timings: load time = 289.55 ms\n", - "llama_print_timings: sample time = 97.02 ms / 256 runs ( 0.38 ms per token, 2638.55 tokens per second)\n", - "llama_print_timings: prompt eval time = 3956.20 ms / 120 tokens ( 32.97 ms per token, 30.33 tokens per second)\n", - "llama_print_timings: eval time = 16141.25 ms / 256 runs ( 63.05 ms per token, 15.86 tokens per second)\n", - "llama_print_timings: total time = 20754.33 ms\n" + "llama_print_timings: load time = 250.46 ms\n", + "llama_print_timings: sample time = 100.60 ms / 256 runs ( 0.39 ms per token, 2544.73 tokens per second)\n", + "llama_print_timings: prompt eval time = 5128.71 ms / 160 tokens ( 32.05 ms per token, 31.20 tokens per second)\n", + "llama_print_timings: eval time = 16193.02 ms / 255 runs ( 63.50 ms per token, 15.75 tokens per second)\n", + "llama_print_timings: total time = 21988.57 ms\n" ] } ], @@ -710,7 +721,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.9.18" } }, "nbformat": 4, diff --git a/libs/experimental/langchain_experimental/chat_models/__init__.py b/libs/experimental/langchain_experimental/chat_models/__init__.py new file mode 100644 index 0000000000000..af7574b447019 --- /dev/null +++ b/libs/experimental/langchain_experimental/chat_models/__init__.py @@ -0,0 +1,26 @@ +"""**Chat Models** are a variation on language models. + +While Chat Models use language models under the hood, the interface they expose +is a bit different. Rather than expose a "text in, text out" API, they expose +an interface where "chat messages" are the inputs and outputs. + +**Class hierarchy:** + +.. code-block:: + + BaseLanguageModel --> BaseChatModel --> # Examples: ChatOpenAI, ChatGooglePalm + +**Main helpers:** + +.. code-block:: + + AIMessage, BaseMessage, HumanMessage +""" # noqa: E501 + +from langchain_experimental.chat_models.llm_wrapper import Llama2Chat, Orca, Vicuna + +__all__ = [ + "Llama2Chat", + "Orca", + "Vicuna", +] diff --git a/libs/langchain/langchain/chat_models/llm_wrapper.py b/libs/experimental/langchain_experimental/chat_models/llm_wrapper.py similarity index 100% rename from libs/langchain/langchain/chat_models/llm_wrapper.py rename to libs/experimental/langchain_experimental/chat_models/llm_wrapper.py diff --git a/libs/experimental/poetry.lock b/libs/experimental/poetry.lock index 1b96274e10ae6..64136e88e2cce 100644 --- a/libs/experimental/poetry.lock +++ b/libs/experimental/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. [[package]] name = "aiohttp" @@ -2806,6 +2806,24 @@ tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] +[[package]] +name = "pytest-asyncio" +version = "0.20.3" +description = "Pytest support for asyncio" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-asyncio-0.20.3.tar.gz", hash = "sha256:83cbf01169ce3e8eb71c6c278ccb0574d1a7a3bb8eaaf5e50e0ad342afb33b36"}, + {file = "pytest_asyncio-0.20.3-py3-none-any.whl", hash = "sha256:f129998b209d04fcc65c96fc85c11e5316738358909a8399e93be553d7656442"}, +] + +[package.dependencies] +pytest = ">=6.1.0" + +[package.extras] +docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1.0)"] +testing = ["coverage (>=6.2)", "flaky (>=3.5.0)", "hypothesis (>=5.7.1)", "mypy (>=0.931)", "pytest-trio (>=0.7.0)"] + [[package]] name = "python-dateutil" version = "2.8.2" @@ -2892,6 +2910,7 @@ files = [ {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, + {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"}, {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, @@ -2899,8 +2918,15 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, + {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, + {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, + {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, + {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, @@ -2917,6 +2943,7 @@ files = [ {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, + {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"}, {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, @@ -2924,6 +2951,7 @@ files = [ {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, + {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, @@ -3921,7 +3949,7 @@ files = [ ] [package.dependencies] -greenlet = {version = "!=0.4.17", markers = "platform_machine == \"aarch64\" or platform_machine == \"ppc64le\" or platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"win32\" or platform_machine == \"WIN32\""} +greenlet = {version = "!=0.4.17", markers = "platform_machine == \"win32\" or platform_machine == \"WIN32\" or platform_machine == \"AMD64\" or platform_machine == \"amd64\" or platform_machine == \"x86_64\" or platform_machine == \"ppc64le\" or platform_machine == \"aarch64\""} typing-extensions = ">=4.2.0" [package.extras] @@ -4871,4 +4899,4 @@ extended-testing = ["faker", "presidio-analyzer", "presidio-anonymizer", "senten [metadata] lock-version = "2.0" python-versions = ">=3.8.1,<4.0" -content-hash = "b834d2b8bcfb0c10549937841a9c6838ca8fde99d23e6c6deb8a6e3f4f4e43af" +content-hash = "ba9be2e62d1507b2f370b4388604d8e3e5afb3d495691f12d15d0128f162539d" diff --git a/libs/experimental/pyproject.toml b/libs/experimental/pyproject.toml index 5fc9e52e0d330..f182505ab3bdf 100644 --- a/libs/experimental/pyproject.toml +++ b/libs/experimental/pyproject.toml @@ -34,6 +34,7 @@ setuptools = "^67.6.1" # dependencies used for running tests (e.g., pytest, freezegun, response). # Any dependencies that do not meet that criteria will be removed. pytest = "^7.3.0" +pytest-asyncio = "^0.20.3" [tool.poetry.group.test_integration] diff --git a/libs/experimental/tests/unit_tests/chat_models/__init__.py b/libs/experimental/tests/unit_tests/chat_models/__init__.py new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/libs/langchain/tests/unit_tests/chat_models/test_llm_wrapper_llama2chat.py b/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_llama2chat.py similarity index 96% rename from libs/langchain/tests/unit_tests/chat_models/test_llm_wrapper_llama2chat.py rename to libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_llama2chat.py index 53bde730d7cd4..21a0ae71ccf6c 100644 --- a/libs/langchain/tests/unit_tests/chat_models/test_llm_wrapper_llama2chat.py +++ b/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_llama2chat.py @@ -1,16 +1,16 @@ from typing import Any, List, Optional import pytest - from langchain.callbacks.manager import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) -from langchain.chat_models import Llama2Chat -from langchain.chat_models.llm_wrapper import DEFAULT_SYSTEM_PROMPT from langchain.llms.base import LLM from langchain.schema import AIMessage, HumanMessage, SystemMessage +from langchain_experimental.chat_models import Llama2Chat +from langchain_experimental.chat_models.llm_wrapper import DEFAULT_SYSTEM_PROMPT + class FakeLLM(LLM): def _call( diff --git a/libs/langchain/tests/unit_tests/chat_models/test_llm_wrapper_orca.py b/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_orca.py similarity index 94% rename from libs/langchain/tests/unit_tests/chat_models/test_llm_wrapper_orca.py rename to libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_orca.py index e70167780125a..96f4c2af91873 100644 --- a/libs/langchain/tests/unit_tests/chat_models/test_llm_wrapper_orca.py +++ b/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_orca.py @@ -1,7 +1,7 @@ import pytest - -from langchain.chat_models import Orca from langchain.schema import AIMessage, HumanMessage, SystemMessage + +from langchain_experimental.chat_models import Orca from tests.unit_tests.chat_models.test_llm_wrapper_llama2chat import FakeLLM diff --git a/libs/langchain/tests/unit_tests/chat_models/test_llm_wrapper_vicuna.py b/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_vicuna.py similarity index 93% rename from libs/langchain/tests/unit_tests/chat_models/test_llm_wrapper_vicuna.py rename to libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_vicuna.py index e01572f1d053e..21506c3788e33 100644 --- a/libs/langchain/tests/unit_tests/chat_models/test_llm_wrapper_vicuna.py +++ b/libs/experimental/tests/unit_tests/chat_models/test_llm_wrapper_vicuna.py @@ -1,7 +1,7 @@ import pytest - -from langchain.chat_models import Vicuna from langchain.schema import AIMessage, HumanMessage, SystemMessage + +from langchain_experimental.chat_models import Vicuna from tests.unit_tests.chat_models.test_llm_wrapper_llama2chat import FakeLLM diff --git a/libs/langchain/langchain/chat_models/__init__.py b/libs/langchain/langchain/chat_models/__init__.py index 3f4b3887752bf..2471fe1c3f286 100644 --- a/libs/langchain/langchain/chat_models/__init__.py +++ b/libs/langchain/langchain/chat_models/__init__.py @@ -36,7 +36,6 @@ from langchain.chat_models.jinachat import JinaChat from langchain.chat_models.konko import ChatKonko from langchain.chat_models.litellm import ChatLiteLLM -from langchain.chat_models.llm_wrapper import Llama2Chat, Orca, Vicuna from langchain.chat_models.minimax import MiniMaxChat from langchain.chat_models.mlflow_ai_gateway import ChatMLflowAIGateway from langchain.chat_models.ollama import ChatOllama @@ -60,9 +59,6 @@ "ChatOllama", "ChatVertexAI", "JinaChat", - "Llama2Chat", - "Orca", - "Vicuna", "HumanInputChatModel", "MiniMaxChat", "ChatAnyscale",