langchain-core 1.0.0a7__py3-none-any.whl → 1.0.0a8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of langchain-core might be problematic. Click here for more details.
- langchain_core/chat_history.py +36 -0
- langchain_core/version.py +1 -1
- {langchain_core-1.0.0a7.dist-info → langchain_core-1.0.0a8.dist-info}/METADATA +1 -1
- {langchain_core-1.0.0a7.dist-info → langchain_core-1.0.0a8.dist-info}/RECORD +5 -5
- {langchain_core-1.0.0a7.dist-info → langchain_core-1.0.0a8.dist-info}/WHEEL +0 -0
langchain_core/chat_history.py
CHANGED
|
@@ -22,7 +22,9 @@ from typing import TYPE_CHECKING
|
|
|
22
22
|
from pydantic import BaseModel, Field
|
|
23
23
|
|
|
24
24
|
from langchain_core.messages import (
|
|
25
|
+
AIMessage,
|
|
25
26
|
BaseMessage,
|
|
27
|
+
HumanMessage,
|
|
26
28
|
get_buffer_string,
|
|
27
29
|
)
|
|
28
30
|
from langchain_core.runnables.config import run_in_executor
|
|
@@ -124,6 +126,40 @@ class BaseChatMessageHistory(ABC):
|
|
|
124
126
|
"""
|
|
125
127
|
return await run_in_executor(None, lambda: self.messages)
|
|
126
128
|
|
|
129
|
+
def add_user_message(self, message: HumanMessage | str) -> None:
|
|
130
|
+
"""Convenience method for adding a human message string to the store.
|
|
131
|
+
|
|
132
|
+
!!! note
|
|
133
|
+
This is a convenience method. Code should favor the bulk ``add_messages``
|
|
134
|
+
interface instead to save on round-trips to the persistence layer.
|
|
135
|
+
|
|
136
|
+
This method may be deprecated in a future release.
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
message: The human message to add to the store.
|
|
140
|
+
"""
|
|
141
|
+
if isinstance(message, HumanMessage):
|
|
142
|
+
self.add_message(message)
|
|
143
|
+
else:
|
|
144
|
+
self.add_message(HumanMessage(content=message))
|
|
145
|
+
|
|
146
|
+
def add_ai_message(self, message: AIMessage | str) -> None:
|
|
147
|
+
"""Convenience method for adding an AI message string to the store.
|
|
148
|
+
|
|
149
|
+
!!! note
|
|
150
|
+
This is a convenience method. Code should favor the bulk ``add_messages``
|
|
151
|
+
interface instead to save on round-trips to the persistence layer.
|
|
152
|
+
|
|
153
|
+
This method may be deprecated in a future release.
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
message: The AI message to add.
|
|
157
|
+
"""
|
|
158
|
+
if isinstance(message, AIMessage):
|
|
159
|
+
self.add_message(message)
|
|
160
|
+
else:
|
|
161
|
+
self.add_message(AIMessage(content=message))
|
|
162
|
+
|
|
127
163
|
def add_message(self, message: BaseMessage) -> None:
|
|
128
164
|
"""Add a Message object to the store.
|
|
129
165
|
|
langchain_core/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langchain-core
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.0a8
|
|
4
4
|
Summary: Building applications with LLMs through composability
|
|
5
5
|
Project-URL: Source Code, https://github.com/langchain-ai/langchain/tree/master/libs/core
|
|
6
6
|
Project-URL: Release Notes, https://github.com/langchain-ai/langchain/releases?q=tag%3A%22langchain-core%3D%3D0%22&expanded=true
|
|
@@ -2,7 +2,7 @@ langchain_core/__init__.py,sha256=TgvhxbrjCRVJwr2HddiyHvtH8W94K-uLM6-6ifNIBXo,71
|
|
|
2
2
|
langchain_core/_import_utils.py,sha256=edGaq9CVYpQpuwzsKXWBsSi0m63PLUCUaL4FbDZzFtg,1421
|
|
3
3
|
langchain_core/agents.py,sha256=lvUM3blOnu9EoSqOE26x0aMnkoXJ_PPY2OCHLrMMi-k,8452
|
|
4
4
|
langchain_core/caches.py,sha256=sKcWD2g9vcKiRKJUNBDpeC9WOow56WiV8TRXQVS3PAg,9639
|
|
5
|
-
langchain_core/chat_history.py,sha256=
|
|
5
|
+
langchain_core/chat_history.py,sha256=5NLuaw6jWLmkTvpIzChsNJUNE6AJdQmjpJYeqzaQXOM,8851
|
|
6
6
|
langchain_core/chat_loaders.py,sha256=b57Gl3KGPxq9gYJjetsHfJm1I6kSqi7bDE91fJJOR84,601
|
|
7
7
|
langchain_core/chat_sessions.py,sha256=YEO3ck5_wRGd3a2EnGD7M_wTvNC_4T1IVjQWekagwaM,564
|
|
8
8
|
langchain_core/env.py,sha256=RHExSWJ2bW-6Wxb6UyBGxU5flLoNYOAeslZ9iTjomQE,598
|
|
@@ -16,7 +16,7 @@ langchain_core/retrievers.py,sha256=JDEY2bzq3oDA5qDtdzhfbC9viuF9owBik7_dvYlbwFU,
|
|
|
16
16
|
langchain_core/stores.py,sha256=v3qbg27ZxbANJjkF4nCiU6fxhusP1m2WejfXG_-2T7U,10569
|
|
17
17
|
langchain_core/structured_query.py,sha256=mat7BKovKjckzMn3-I1El49yeGjg3cqk4ptpJHAPA-4,5123
|
|
18
18
|
langchain_core/sys_info.py,sha256=HG1fu2ayPvRQmrlowyO-NdUj_I8Le1S-bPAbYB9VJTY,4045
|
|
19
|
-
langchain_core/version.py,sha256=
|
|
19
|
+
langchain_core/version.py,sha256=xwy5ZnC3fP_j1oandPwnXi_wRBpnh1U_pOagTuziBqY,77
|
|
20
20
|
langchain_core/_api/__init__.py,sha256=YBjUU5X_lP-xtYgJINOj4LIe68qa-WpuDQfT5OvGxTA,1974
|
|
21
21
|
langchain_core/_api/beta_decorator.py,sha256=Qm5-zZNm8XFxaC9PBFjEoGCy-Plkj5RFPZIHlcd7hHY,8798
|
|
22
22
|
langchain_core/_api/deprecation.py,sha256=XD_oJ8irlUxbL5Kq9JLJnalD7-DXF4ZiuzsI8I95lmA,20515
|
|
@@ -171,6 +171,6 @@ langchain_core/vectorstores/__init__.py,sha256=5P0eoeoH5LHab64JjmEeWa6SxX4eMy-et
|
|
|
171
171
|
langchain_core/vectorstores/base.py,sha256=ETzD4VwQz83J2Gibc1R35L5egXrej3AUnd7SsmuFO1I,41545
|
|
172
172
|
langchain_core/vectorstores/in_memory.py,sha256=tCKh7vmljt2-czmr-85vdSLisz9FjkZcscd10vrIq7k,15931
|
|
173
173
|
langchain_core/vectorstores/utils.py,sha256=w7JOtmyVLQU9RCxDSdQCyipCDBtEIvXZxH5RyrAcda4,4959
|
|
174
|
-
langchain_core-1.0.
|
|
175
|
-
langchain_core-1.0.
|
|
176
|
-
langchain_core-1.0.
|
|
174
|
+
langchain_core-1.0.0a8.dist-info/METADATA,sha256=XGzM1qnsc_K2LHXa_yVAWZJgYpt3DdvxZyE5kj_kgLY,2617
|
|
175
|
+
langchain_core-1.0.0a8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
176
|
+
langchain_core-1.0.0a8.dist-info/RECORD,,
|
|
File without changes
|