Skip to content

Commit

Permalink
[Partner] Google GenAi new release (#14882)
Browse files Browse the repository at this point in the history
to support the system message merging

Also fix integration tests that weren't passing
  • Loading branch information
hinthornw authored Dec 19, 2023
1 parent 2d0f1ca commit f88af1f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion libs/partners/google-genai/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "langchain-google-genai"
version = "0.0.4"
version = "0.0.5"
description = "An integration package connecting Google's genai package and LangChain"
authors = []
readme = "README.md"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from langchain_google_genai.llms import GoogleGenerativeAI

model_names = [None, "models/text-bison-001", "gemini-pro"]
model_names = ["models/text-bison-001", "gemini-pro"]


@pytest.mark.parametrize(
Expand Down Expand Up @@ -37,18 +37,15 @@ def test_google_generativeai_call(model_name: str) -> None:
)
def test_google_generativeai_generate(model_name: str) -> None:
n = 1 if model_name == "gemini-pro" else 2
if model_name:
llm = GoogleGenerativeAI(temperature=0.3, n=n, model=model_name)
else:
llm = GoogleGenerativeAI(temperature=0.3, n=n)
llm = GoogleGenerativeAI(temperature=0.3, n=n, model=model_name)
output = llm.generate(["Say foo:"])
assert isinstance(output, LLMResult)
assert len(output.generations) == 1
assert len(output.generations[0]) == n


def test_google_generativeai_get_num_tokens() -> None:
llm = GoogleGenerativeAI()
llm = GoogleGenerativeAI(model="models/text-bison-001")
output = llm.get_num_tokens("How are you?")
assert output == 4

Expand Down

0 comments on commit f88af1f

Please sign in to comment.