Skip to content

Commit

Permalink
fixed async streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
lkuligin committed Apr 12, 2024
1 parent daec64d commit 9b0e543
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion libs/vertexai/langchain_google_vertexai/chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ def _convert_to_parts(message: BaseMessage) -> List[Part]:
convert_system_message_to_human_content = None
system_instruction = None
for i, message in enumerate(history):
print(i, message)
if isinstance(message, SystemMessage):
if system_instruction is not None:
raise ValueError(
Expand Down Expand Up @@ -255,6 +256,7 @@ def _convert_to_parts(message: BaseMessage) -> List[Part]:
convert_system_message_to_human_content = None

vertex_message = Content(role=role, parts=parts)
print(vertex_messages)
vertex_messages.append(vertex_message)
return system_instruction, vertex_messages

Expand Down Expand Up @@ -733,7 +735,6 @@ async def _astream(
project=self.project,
convert_system_message_to_human=self.convert_system_message_to_human,
)
message = history_gemini.pop()
self.client = _get_client_with_sys_instruction(
client=self.client,
system_instruction=system_instruction,
Expand Down
2 changes: 1 addition & 1 deletion libs/vertexai/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "langchain-google-vertexai"

version = "0.1.3"
version = "1.0.1"
description = "An integration package connecting Google VertexAI and LangChain"
authors = []
readme = "README.md"
Expand Down
2 changes: 0 additions & 2 deletions libs/vertexai/tests/integration_tests/test_chat_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def test_vertexai_stream(model_name: str) -> None:
assert isinstance(chunk, AIMessageChunk)


@pytest.mark.xfail
@pytest.mark.release
async def test_vertexai_astream() -> None:
model = ChatVertexAI(temperature=0, model_name="gemini-pro")
Expand Down Expand Up @@ -144,7 +143,6 @@ def test_multimodal() -> None:


@pytest.mark.release
@pytest.mark.xfail(reason="problem on vertex side")
def test_multimodal_history() -> None:
llm = ChatVertexAI(model_name="gemini-pro-vision")
gcs_url = (
Expand Down

0 comments on commit 9b0e543

Please sign in to comment.