Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions packages/gen/docs/gen_ai_hub/examples/ai-vs-ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
ChatPromptTemplate,
MessagesPlaceholder,
)
from langchain_community.chat_message_histories.in_memory import ChatMessageHistory
from langchain_core.chat_history import BaseChatMessageHistory
from langchain_core.chat_history import BaseChatMessageHistory, InMemoryChatMessageHistory
from langchain_core.messages import HumanMessage
from langchain_core.runnables.history import RunnableWithMessageHistory

Expand Down Expand Up @@ -37,13 +36,13 @@

def get_session_history(session_id: str) -> BaseChatMessageHistory:
if session_id not in store:
store[session_id] = ChatMessageHistory()
store[session_id] = InMemoryChatMessageHistory()
return store[session_id]


def create_session_history() -> str:
session_id = str(uuid.uuid4())
store[session_id] = ChatMessageHistory()
store[session_id] = InMemoryChatMessageHistory()
return session_id


Expand Down
3 changes: 1 addition & 2 deletions packages/gen/gen_ai_hub/proxy/langchain/amazon.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from typing import Dict, Optional, List, Any

from botocore.config import Config
from langchain_aws import ChatBedrock as ChatBedrock_, ChatBedrockConverse as ChatBedrockConverse_
from langchain_community.embeddings import BedrockEmbeddings as BedrockEmbeddings_
from langchain_aws import ChatBedrock as ChatBedrock_, ChatBedrockConverse as ChatBedrockConverse_, BedrockEmbeddings as BedrockEmbeddings_
from pydantic import BaseModel, ConfigDict, model_validator

from gen_ai_hub.proxy.core.base import BaseProxyClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
ChatPromptTemplate,
MessagesPlaceholder,
)
from langchain_classic.schema import BaseChatMessageHistory, HumanMessage
from langchain_community.chat_message_histories.in_memory import ChatMessageHistory
from langchain_classic.schema import HumanMessage
from langchain_core.chat_history import BaseChatMessageHistory, InMemoryChatMessageHistory
from langchain_core.messages import AIMessage
from langchain_core.runnables.history import RunnableWithMessageHistory

Expand All @@ -30,7 +30,7 @@ def _get_model_history(self, session_id: str) -> BaseChatMessageHistory:

def _create_model_history(self) -> str:
session_id = str(uuid.uuid4())
self.model_histories[session_id] = ChatMessageHistory()
self.model_histories[session_id] = InMemoryChatMessageHistory()
return session_id

def test_genai_invoke(self, model=GEMINI_2_5_FLASH_LITE_TEST_MODEL):
Expand Down
1 change: 0 additions & 1 deletion packages/gen/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ dependencies = [
"pandas>=2.2.0",
"langchain~=1.4.0",
"langchain-classic~=1.0.0",
"langchain-community~=0.4.1",
"langchain-openai~=1.6.0",
]

Expand Down
2 changes: 1 addition & 1 deletion packages/gen/tests/proxy/langchain_/test_amazon.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_chat_model(self, mock_chain_invoke):
response = chain.invoke("I love programming")
self.assertIsInstance(response["text"], str)

@patch("langchain_community.embeddings.bedrock.BedrockEmbeddings.embed_query")
@patch("langchain_aws.embeddings.bedrock.BedrockEmbeddings.embed_query")
def test_embedding_model(self, mock_chain_invoke):
mock_chain_invoke.return_value = AMAZON_TITAN_EMBED_QUERY_RESPONSE
embedding_model = BedrockEmbeddings(
Expand Down
49 changes: 0 additions & 49 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading