Skip to content

Conversation

EugeneJinXin
Copy link
Contributor

wrap_gemini has been requested quite many times (23 upvotes from sdk issues); we wanted to make it in September

Tests: integration test (still need to add google_api_key in github settings) and inspection in langsmith https://smith.langchain.com/public/d3958002-41cd-4df2-9711-91689ec3ea88/r

Note: mark as beta because even though the messages goes up to langsmith, i expect there'll be edges cases on rendering we need to take care of; don't really expect much breaking changes but wanna be proactive in setting expectation


.. code-block:: python

from google import genai
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know they have a bunch of different clients and they were unifying them - but is it worth calling this wrap_google_genai instead?

Think it's also better because I'm pretty sure you can access non-Gemini models (e.g. Gemma, other Model Garden stuff)


# Non-streaming:
response = client.models.generate_content(
model="gemini-2.0-flash-001",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use latest model string

return {k: v for k, v in d.items() if v is not None}


def _process_gemini_inputs(inputs: dict) -> dict:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any special consideration needed for tool calls?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would definitely add a tool calling test too

stop = config.get("stop_sequences")

return {
"ls_provider": "google",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth checking to make sure this is the same as LangChain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants