From d2f8a281ea71cca68afab221680c385a6fd97a2b Mon Sep 17 00:00:00 2001 From: rkwan05 Date: Mon, 25 Nov 2024 20:21:39 -0500 Subject: [PATCH] merge: master --- libs/core/langchain_core/prompts/chat.py | 4 ++-- libs/core/tests/unit_tests/prompts/test_chat.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/core/langchain_core/prompts/chat.py b/libs/core/langchain_core/prompts/chat.py index 7b367248861d1..de87750db2578 100644 --- a/libs/core/langchain_core/prompts/chat.py +++ b/libs/core/langchain_core/prompts/chat.py @@ -52,7 +52,7 @@ # extract pdf into bytes -def extract_pdf_text(pdf_data: bytes) -> str: +def extract_pdf_text(pdf_data: str) -> str: # Decode the base64 back into bytes pdf_bytes = base64.b64decode(pdf_data) pdf_text = "" @@ -488,7 +488,7 @@ class _ImageTemplateParam(TypedDict, total=False): class _PdfTemplateParam(TypedDict, total=False): - pdf: Union[str, dict] + data: str class _StringImageMessagePromptTemplate(BaseMessagePromptTemplate): diff --git a/libs/core/tests/unit_tests/prompts/test_chat.py b/libs/core/tests/unit_tests/prompts/test_chat.py index 7861d99bc7bbb..bb47e95677563 100644 --- a/libs/core/tests/unit_tests/prompts/test_chat.py +++ b/libs/core/tests/unit_tests/prompts/test_chat.py @@ -37,7 +37,7 @@ from tests.unit_tests.pydantic_utils import _normalize_schema -def test_create_pdf_chat_prompt() -> None: +def test_create_chat_prompt_template() -> None: """Test chat prompt with pdf data as bytes.""" file_path = ( Path(__file__).parent.parent.parent.parent.parent @@ -59,7 +59,7 @@ def test_create_pdf_chat_prompt() -> None: ] ) - expected_prompt = PromptTemplate(template="Hello world!\n1\n") + expected_prompt = PromptTemplate(template="Hello world!\n1\n", input_variables=[]) assert len(prompt.messages) == 1 output_prompt = prompt.messages[0]