From 92957e6cdf81efda6109a22d97a9eadcdc784f45 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Mon, 18 Dec 2023 10:58:53 -0800 Subject: [PATCH 1/4] docs[patch]: more keywords (#14858) --- docs/docs/expression_language/get_started.ipynb | 1 + docs/docs/integrations/stores/in_memory.ipynb | 1 + .../docs/integrations/text_embedding/azureopenai.ipynb | 10 ++++++++++ docs/docs/integrations/toolkits/python.ipynb | 10 ++++++++++ docs/docs/modules/agents/how_to/custom_llm_agent.mdx | 4 ++++ .../modules/agents/how_to/custom_llm_chat_agent.mdx | 4 ++++ .../modules/data_connection/document_loaders/pdf.mdx | 4 ++++ 7 files changed, 34 insertions(+) diff --git a/docs/docs/expression_language/get_started.ipynb b/docs/docs/expression_language/get_started.ipynb index bd6b33a09f4fa..d3533eacd3472 100644 --- a/docs/docs/expression_language/get_started.ipynb +++ b/docs/docs/expression_language/get_started.ipynb @@ -8,6 +8,7 @@ "---\n", "sidebar_position: 0\n", "title: Get started\n", + "keywords: [chain.invoke]\n", "---" ] }, diff --git a/docs/docs/integrations/stores/in_memory.ipynb b/docs/docs/integrations/stores/in_memory.ipynb index 03e2f2c5b638e..aa5e35ef07c8a 100644 --- a/docs/docs/integrations/stores/in_memory.ipynb +++ b/docs/docs/integrations/stores/in_memory.ipynb @@ -7,6 +7,7 @@ "---\n", "sidebar_label: In Memory\n", "sidebar_position: 2\n", + "keywords: [InMemoryStore]\n", "---" ] }, diff --git a/docs/docs/integrations/text_embedding/azureopenai.ipynb b/docs/docs/integrations/text_embedding/azureopenai.ipynb index 6c500f0d7791e..214be3eca2629 100644 --- a/docs/docs/integrations/text_embedding/azureopenai.ipynb +++ b/docs/docs/integrations/text_embedding/azureopenai.ipynb @@ -1,5 +1,15 @@ { "cells": [ + { + "cell_type": "raw", + "id": "0aed0743", + "metadata": {}, + "source": [ + "---\n", + "keywords: [AzureOpenAIEmbeddings]\n", + "---" + ] + }, { "cell_type": "markdown", "id": "c3852491", diff --git a/docs/docs/integrations/toolkits/python.ipynb b/docs/docs/integrations/toolkits/python.ipynb index 2569a2781705e..4cb7e015a96be 100644 --- a/docs/docs/integrations/toolkits/python.ipynb +++ b/docs/docs/integrations/toolkits/python.ipynb @@ -1,5 +1,15 @@ { "cells": [ + { + "cell_type": "raw", + "id": "be75cb7e", + "metadata": {}, + "source": [ + "---\n", + "keywords: [PythonREPLTool]\n", + "---" + ] + }, { "cell_type": "markdown", "id": "82a4c2cc-20ea-4b20-a565-63e905dee8ff", diff --git a/docs/docs/modules/agents/how_to/custom_llm_agent.mdx b/docs/docs/modules/agents/how_to/custom_llm_agent.mdx index 6e92c54717e3c..f9ab5ceeabe89 100644 --- a/docs/docs/modules/agents/how_to/custom_llm_agent.mdx +++ b/docs/docs/modules/agents/how_to/custom_llm_agent.mdx @@ -1,3 +1,7 @@ +--- +keywords: [LLMSingleActionAgent] +--- + # Custom LLM Agent This notebook goes through how to create your own custom LLM agent. diff --git a/docs/docs/modules/agents/how_to/custom_llm_chat_agent.mdx b/docs/docs/modules/agents/how_to/custom_llm_chat_agent.mdx index f9d8045dc6e06..10272bf2d9e84 100644 --- a/docs/docs/modules/agents/how_to/custom_llm_chat_agent.mdx +++ b/docs/docs/modules/agents/how_to/custom_llm_chat_agent.mdx @@ -1,3 +1,7 @@ +--- +keywords: [LLMSingleActionAgent] +--- + # Custom LLM Chat Agent This notebook explains how to create your own custom agent based on a chat model. diff --git a/docs/docs/modules/data_connection/document_loaders/pdf.mdx b/docs/docs/modules/data_connection/document_loaders/pdf.mdx index 023837e05d63a..ef06d12795206 100644 --- a/docs/docs/modules/data_connection/document_loaders/pdf.mdx +++ b/docs/docs/modules/data_connection/document_loaders/pdf.mdx @@ -1,3 +1,7 @@ +--- +keywords: [PyPDFDirectoryLoader, PyMuPDFLoader] +--- + # PDF >[Portable Document Format (PDF)](https://en.wikipedia.org/wiki/PDF), standardized as ISO 32000, is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems. From 61ad0e8be944d63071203314ee95a570ecdbb7c2 Mon Sep 17 00:00:00 2001 From: Bagatur <22008038+baskaryan@users.noreply.github.com> Date: Mon, 18 Dec 2023 16:08:08 -0500 Subject: [PATCH 2/4] community[patch]: Release 0.0.4 (#14864) --- libs/community/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/community/pyproject.toml b/libs/community/pyproject.toml index 7b03c90ee3223..b5cfa0948905f 100644 --- a/libs/community/pyproject.toml +++ b/libs/community/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langchain-community" -version = "0.0.3" +version = "0.0.4" description = "Community contributed LangChain integrations." authors = [] license = "MIT" From 714bef0cb6c7c88bead286f06b6f456b7ac9c860 Mon Sep 17 00:00:00 2001 From: Bagatur <22008038+baskaryan@users.noreply.github.com> Date: Mon, 18 Dec 2023 16:41:48 -0500 Subject: [PATCH 3/4] langchain[patch]: Release 0.0.351 (#14867) --- libs/langchain/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langchain/pyproject.toml b/libs/langchain/pyproject.toml index ed6116afc9fa6..034c2a90efb67 100644 --- a/libs/langchain/pyproject.toml +++ b/libs/langchain/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langchain" -version = "0.0.350" +version = "0.0.351" description = "Building applications with LLMs through composability" authors = [] license = "MIT" From 193f107cb5b01ec19ec5c56bae2c426c54791808 Mon Sep 17 00:00:00 2001 From: Harrison Chase Date: Mon, 18 Dec 2023 13:45:08 -0800 Subject: [PATCH 4/4] add methods to deserialize prompts that were old (#14857) --- libs/core/langchain_core/load/load.py | 11 +- libs/core/langchain_core/load/mapping.py | 159 ++++++++++++++++++ .../unit_tests/runnables/test_history.py | 3 +- 3 files changed, 169 insertions(+), 4 deletions(-) diff --git a/libs/core/langchain_core/load/load.py b/libs/core/langchain_core/load/load.py index e97deede28bf0..89980bc07436e 100644 --- a/libs/core/langchain_core/load/load.py +++ b/libs/core/langchain_core/load/load.py @@ -3,11 +3,16 @@ import os from typing import Any, Dict, List, Optional -from langchain_core.load.mapping import SERIALIZABLE_MAPPING +from langchain_core.load.mapping import ( + OLD_PROMPT_TEMPLATE_FORMATS, + SERIALIZABLE_MAPPING, +) from langchain_core.load.serializable import Serializable DEFAULT_NAMESPACES = ["langchain", "langchain_core", "langchain_community"] +ALL_SERIALIZABLE_MAPPINGS = {**SERIALIZABLE_MAPPING, **OLD_PROMPT_TEMPLATE_FORMATS} + class Reviver: """Reviver for JSON objects.""" @@ -67,13 +72,13 @@ def __call__(self, value: Dict[str, Any]) -> Any: if namespace[0] in DEFAULT_NAMESPACES: # Get the importable path key = tuple(namespace + [name]) - if key not in SERIALIZABLE_MAPPING: + if key not in ALL_SERIALIZABLE_MAPPINGS: raise ValueError( "Trying to deserialize something that cannot " "be deserialized in current version of langchain-core: " f"{key}" ) - import_path = SERIALIZABLE_MAPPING[key] + import_path = ALL_SERIALIZABLE_MAPPINGS[key] # Split into module and name import_dir, import_obj = import_path[:-1], import_path[-1] # Import module diff --git a/libs/core/langchain_core/load/mapping.py b/libs/core/langchain_core/load/mapping.py index 923525f0fdb9d..dcec6affb406b 100644 --- a/libs/core/langchain_core/load/mapping.py +++ b/libs/core/langchain_core/load/mapping.py @@ -476,3 +476,162 @@ "RunnableRetry", ), } + +# Needed for backwards compatibility for a few versions where we serialized +# with langchain_core +OLD_PROMPT_TEMPLATE_FORMATS = { + ( + "langchain_core", + "prompts", + "base", + "BasePromptTemplate", + ): ( + "langchain_core", + "prompts", + "base", + "BasePromptTemplate", + ), + ( + "langchain_core", + "prompts", + "prompt", + "PromptTemplate", + ): ( + "langchain_core", + "prompts", + "prompt", + "PromptTemplate", + ), + ( + "langchain_core", + "prompts", + "chat", + "MessagesPlaceholder", + ): ( + "langchain_core", + "prompts", + "chat", + "MessagesPlaceholder", + ), + ( + "langchain_core", + "prompts", + "chat", + "ChatPromptTemplate", + ): ( + "langchain_core", + "prompts", + "chat", + "ChatPromptTemplate", + ), + ( + "langchain_core", + "prompts", + "chat", + "HumanMessagePromptTemplate", + ): ( + "langchain_core", + "prompts", + "chat", + "HumanMessagePromptTemplate", + ), + ( + "langchain_core", + "prompts", + "chat", + "SystemMessagePromptTemplate", + ): ( + "langchain_core", + "prompts", + "chat", + "SystemMessagePromptTemplate", + ), + ( + "langchain_core", + "prompts", + "chat", + "BaseMessagePromptTemplate", + ): ( + "langchain_core", + "prompts", + "chat", + "BaseMessagePromptTemplate", + ), + ( + "langchain_core", + "prompts", + "chat", + "BaseChatPromptTemplate", + ): ( + "langchain_core", + "prompts", + "chat", + "BaseChatPromptTemplate", + ), + ( + "langchain_core", + "prompts", + "chat", + "ChatMessagePromptTemplate", + ): ( + "langchain_core", + "prompts", + "chat", + "ChatMessagePromptTemplate", + ), + ( + "langchain_core", + "prompts", + "few_shot_with_templates", + "FewShotPromptWithTemplates", + ): ( + "langchain_core", + "prompts", + "few_shot_with_templates", + "FewShotPromptWithTemplates", + ), + ( + "langchain_core", + "prompts", + "pipeline", + "PipelinePromptTemplate", + ): ( + "langchain_core", + "prompts", + "pipeline", + "PipelinePromptTemplate", + ), + ( + "langchain_core", + "prompts", + "string", + "StringPromptTemplate", + ): ( + "langchain_core", + "prompts", + "string", + "StringPromptTemplate", + ), + ( + "langchain_core", + "prompts", + "chat", + "BaseStringMessagePromptTemplate", + ): ( + "langchain_core", + "prompts", + "chat", + "BaseStringMessagePromptTemplate", + ), + ( + "langchain_core", + "prompts", + "chat", + "AIMessagePromptTemplate", + ): ( + "langchain_core", + "prompts", + "chat", + "AIMessagePromptTemplate", + ), +} diff --git a/libs/core/tests/unit_tests/runnables/test_history.py b/libs/core/tests/unit_tests/runnables/test_history.py index 193a779021f50..72cfcbf77cdd6 100644 --- a/libs/core/tests/unit_tests/runnables/test_history.py +++ b/libs/core/tests/unit_tests/runnables/test_history.py @@ -19,7 +19,8 @@ def test_interfaces() -> None: def _get_get_session_history( - *, store: Optional[Dict[str, Any]] = None + *, + store: Optional[Dict[str, Any]] = None, ) -> Callable[..., ChatMessageHistory]: chat_history_store = store if store is not None else {}