# Gemini Code Assist persistently prefers using deprecated "google-generativeai"

**URL:** <https://discuss.google.dev/t/gemini-code-assist-persistently-prefers-using-deprecated-google-generativeai/271316>\
**Category:** Agents\
**Tags:** development, gemini\
**Created:** [October 6, 2025, 9:26pm UTC](https://discuss.google.dev/t/gemini-code-assist-persistently-prefers-using-deprecated-google-generativeai/271316 "2025-10-06T21:26:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jortony](https://d3byx8b92xw3lq.cloudfront.net/user_avatar/discuss.google.dev/jortony/32/130141_2.png) [@jortony](https://discuss.google.dev/u/jortony)\
**Post date:** [October 6, 2025, 9:26pm UTC](https://discuss.google.dev/t/gemini-code-assist-persistently-prefers-using-deprecated-google-generativeai/271316/1 "2025-10-06T21:26:57Z")

</div>

I am developing within Google Cloud Shell IDE with Gemini Code Assist Standard to create agents using Google ADK which require Gemini API calls to help structure user (unstructured) inputs. I have been fighting to use the ‘google-genai’ libraries, but Code Assist persistently changes my code to use the deprecated ‘google-generativeai’ library. At first it responded that the libraries are actually the same, and that my confusion was common. When I pushed back, it replied that ‘google-genai’ doesn’t exist in PyPI. When I sourced my references:  
[google-genai](https://pypi.org/project/google-genai/)

[google-generativeai](https://pypi.org/project/google-generativeai/)

The agent responded with effusive apologies, reverting to use my preferred library… but then continued after it reverted to using the ‘google-generativeai’ libraries while making unrelated changes to my codebase. This continued for about an hour (using my personal premium dev program account user “jortony”), and ultimately I gave up.

Does anyone have insights into why this is happening and/or how I might use additional system instructions (GEMINI.md) to prevent this from continuing?

---

<div class="post-metadata">

**Author:** ![jortony](https://d3byx8b92xw3lq.cloudfront.net/user_avatar/discuss.google.dev/jortony/32/130141_2.png) [@jortony](https://discuss.google.dev/u/jortony)\
**Post date:** [October 6, 2025, 10:05pm UTC](https://discuss.google.dev/t/gemini-code-assist-persistently-prefers-using-deprecated-google-generativeai/271316/2 "2025-10-06T22:05:21Z")

</div>

I should have used all available resources before requesting human processing. I just fired off a prompt (below) at Gemini 2.5 Pro using Deep Research and got some valuable insight (report below).  
**Core problem:** Gemini Code Assist might be using old training data which is strongly pushing outdated libraries (and potentially more).

**Solution** (s): The report recommends using a multi-layed approach to keep Gemini Code Assist from pushing outdated code:  
( **1** ) The single most important passive signal is the project’s dependency file. Ensure that the `requirements.txt` or `pyproject.toml` file explicitly lists `google-adk` and, if direct interaction is needed, `google-genai`  
( **2** ) Before requesting code generation in a new Python file, begin by writing the correct import statements at the top. An existing `from google import genai` or `from google.adk.agents import Agent` will heavily influence all subsequent suggestions within that file, priming the model to use the correct libraries and classes.  
( **3** ) Use natural language comments to direct the model’s behavior explicitly. These comments can be embedded in scripts and README.md files.  
( **4** ) “In a future environment where system-level instructions for code assistants are available, an ideal configuration would provide a clear, persistent directive to govern all code generation”. I quoted this because Firebase Studio created projects typically contain a GEMINI.md file which might be a valuable addition to Code Assist’ed projects.

Let me know if there’s anything I missed.

Report: [ADK Development Library Confusion](https://docs.google.com/document/d/1l4K2re77F4rgB2IBeMOwolSqrwZkCjVNoAXtvQt2DEQ/edit?usp=sharing)  
Prompt:

```auto
You are a Senior Google Cloud Developer specializing in ADK development using Python. I am developing a new ADK agent with Gemini Code Assist using Python and within Cloud Shell IDE. Gemini Code Assist keeps importing the ‘google-generativeai’ library, and will not use the ‘google-genai’ library. I don’t understand why. Could you please research these libraries and how they are used within ADK development using the below “SOURCE LIST”. Create a concise report on what these libraries do, how they are imported, and how I can use prompts or system instructions within Cloud Shell IDE to keep Gemini Code Assist using the correct libraries.

<SOURCE LIST>
https://pypi.org/project/google-genai/
https://pypi.org/project/google-generativeai/
https://github.com/google/adk-samples
https://google.github.io/adk-docs/
</SOURCE LIST>

```
