Skip to content

Gemini #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 4, 2025
Merged

Gemini #100

merged 8 commits into from
Jul 4, 2025

Conversation

jtpio
Copy link
Member

@jtpio jtpio commented Jun 17, 2025

Was curious if it would be quick and easy to add Gemini to the list of default providers.

Fixes #99

jupyterlite-ai-gemini.mp4

@jtpio jtpio added the enhancement New feature or request label Jun 17, 2025
"@langchain/anthropic": "^0.3.22",
"@langchain/community": "^0.3.46",
"@langchain/core": "^0.3.58",
"@langchain/google-genai": "^0.2.12",
Copy link
Member Author

Choose a reason for hiding this comment

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

The latest version of @langchain/google-genai seems to depend on newer releases of @langchain/core, so bumping the other langchain dependencies here.

tsconfig.json Outdated
@@ -19,6 +19,7 @@
"resolveJsonModule": true,
"outDir": "lib",
"rootDir": "src",
"skipLibCheck": true,
Copy link
Member Author

Choose a reason for hiding this comment

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

Need to investigate the following TypeScript build issue:

node_modules/zod/v3/index.d.ts:1:15 - error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file '../dist/types/v3/index.js' instead?

1 export * from "../dist/types/v3/index.d.ts";
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/zod/v4/core/index.d.ts:1:15 - error TS2846: A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file '../../dist/types/v4/core/index.js' instead?

1 export * from "../../dist/types/v4/core/index.d.ts";
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copy link
Collaborator

@brichet brichet Jun 18, 2025

Choose a reason for hiding this comment

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

This seems to be fixed colinhacks/zod#4545
Working fine with resolutions pining it to "^3.25.56".

  "resolutions": {
    "zod": "^3.25.56"
  },

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh cool, thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually my fix was useless, and this dependency issue is already fixed by langchain-ai/langchainjs#8380, not yet released AFAIK.

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like the latest release may have these changes now: https://github.com/langchain-ai/langchainjs/releases/tag/langchain%3D%3D0.3.29

@jtpio
Copy link
Member Author

jtpio commented Jun 18, 2025

Looks like there is now an issue when running the settings:build script, which may be related to the other @langchain package updates.

@brichet
Copy link
Collaborator

brichet commented Jun 20, 2025

Looks like there is now an issue when running the settings:build script, which may be related to the other @langchain package updates.

We should probably drop the settings generator, or at least remove the test.

I opened #104

@brichet
Copy link
Collaborator

brichet commented Jun 27, 2025

The failing tests seem to be related to the upgrade of zod dependency, after this (huge) PR colinhacks/zod#4074, that has been included in 3.25.X.
It adds the use of ThisType which is not understood by ts-json-schema-generator.

I don't know how to fix it, but we have the same issue in #110

@jtpio
Copy link
Member Author

jtpio commented Jun 27, 2025

CI now passes after #113.

Did a bit of testing locally. The chat works fine. Completions often give a 429 with a lot of requests being made to the Gemini API. So not sure yet if it's because of the API key being used, an issue with the langchain wrapper, or a missing option when instantiating the completer.

@jtpio
Copy link
Member Author

jtpio commented Jul 3, 2025

Completions often give a 429 with a lot of requests being made to the Gemini API.

This probably depends on the tier associated with the API key: https://ai.google.dev/gemini-api/docs/rate-limits#free-tier

So for now it seems the basic functionality should work fine. Maybe we can go ahead and continue improving in follow-up PRs.

@jtpio jtpio marked this pull request as ready for review July 3, 2025 12:00
Copy link
Collaborator

@brichet brichet left a comment

Choose a reason for hiding this comment

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

Thanks @jtpio.
Code completion is rather slow on my side, but seems more relevant than with other providers.

@brichet brichet merged commit 089a0d9 into jupyterlite:main Jul 4, 2025
8 checks passed
@jtpio jtpio deleted the gemini branch July 4, 2025 08:10
Comment on lines +119 to +121
"resolutions": {
"zod": "^3.25.56"
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

@jtpio I didn't pay much attention to it, but do you think it should be kept?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just pushed a new commit in #117 and it now seems to be building fine. But likely requires the update of the other langchain packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gemini models
2 participants