Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis committed Feb 7, 2024
1 parent f53c557 commit 96aeb2b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
18 changes: 2 additions & 16 deletions libs/partners/google-vertexai/langchain_google_vertexai/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Any, Callable, Dict, Optional, Union

import google.api_core
import proto # type: ignore[import-untyped]
from google.api_core.gapic_v1.client_info import ClientInfo
from google.cloud import storage
from langchain_core.callbacks import (
Expand Down Expand Up @@ -114,22 +115,7 @@ def get_generation_info(
}
for rating in candidate.safety_ratings
],
"citation_metadata": (
{
"citations": [
{
"start_index": citation.start_index,
"end_index": citation.end_index,
"publication_date": citation.publication_date,
"title": citation.title,
"uri": citation.uri,
}
for citation in candidate.citation_metadata.citations
]
}
if candidate.citation_metadata
else None
),
"citation_metadata": proto.Message.to_dict(candidate.citation_metadata),
}
# https://cloud.google.com/vertex-ai/docs/generative-ai/model-reference/text-chat#response_body
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_tools() -> None:
llm_with_tools = llm.bind(functions=tools)

agent: Any = (
{ # type: ignore[var-annotated]
{
"input": lambda x: x["input"],
"agent_scratchpad": lambda x: format_to_openai_function_messages(
x["intermediate_steps"]
Expand Down Expand Up @@ -115,7 +115,7 @@ def test_multiple_tools() -> None:
from langchain.agents import AgentExecutor
from langchain.agents.format_scratchpad import format_to_openai_function_messages
from langchain.chains import LLMMathChain
from langchain.utilities import ( # type: ignore[import-not-found]
from langchain.utilities import (
GoogleSearchAPIWrapper,
)

Expand Down Expand Up @@ -149,8 +149,8 @@ def test_multiple_tools() -> None:
)
llm_with_tools = llm.bind(functions=tools)

agent = (
{ # type: ignore[var-annotated]
agent: Any = (
{
"input": lambda x: x["input"],
"agent_scratchpad": lambda x: format_to_openai_function_messages(
x["intermediate_steps"]
Expand Down

0 comments on commit 96aeb2b

Please sign in to comment.