langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
89.47k stars 14.12k forks source link

Gemini-Pro : Safety attributes params are missing with VertexAI #16186

Closed snayan06 closed 2 months ago

snayan06 commented 6 months ago

Checked other resources

Example Code

from langchain_community.llms.vertexai import VertexAI

VertexAI(model_name=GEMINI_PRO_MODEL_NAME, credentials=credentials, project=project_id,
                               streaming=streaming, temperature=0.0, n=1,
                               max_output_tokens=1000)

Description

I am using the langchain latest version , and I am not able to pass the safety attributes to override the safety categories for gemini pro

System Info

langchain==0.1.1
langchain-community==0.0.13
langchain-core==0.1.12
langchain-google-genai==0.0.6

Python 3.9.5

Related Components

dosubot[bot] commented 6 months ago

🤖

Hello @snayan06! I'm Dosu, a friendly bot here to lend a hand with your LangChain issues, answer questions, and assist you in becoming a contributor. While we're waiting for a human maintainer, I'm here to help! Let's get that issue sorted out.

I understand that you're trying to pass safety attributes to override the safety categories for Gemini Pro using the latest version of LangChain. However, based on the current LangChain repository, there doesn't seem to be a direct way to pass safety attributes to the VertexAI class in the langchain_community.llms.vertexai module.

The VertexAI class is primarily used for interacting with Google Vertex AI large language models. It provides functionalities such as token counting, generation, streaming, and async generation. However, it doesn't seem to have a built-in mechanism for handling safety attributes.

If you're referring to a different kind of safety attributes or a different part of the LangChain framework, could you please provide more details or examples? This will help me understand your question better and provide a more accurate answer.

As for the APIChain class mentioned in the context, it's used for creating API chains with a language model and API docs. It has a limit_to_domains attribute that can be used to limit the domains that can be accessed by the API chain. However, this seems to be more related to security and domain restrictions rather than safety attributes for a language model.

I hope this helps! If you have any more questions or need further clarification, feel free to ask.

Sources:

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

pascalwhoop commented 6 months ago

drive-by comment: Feels like passing through kwargs object should be a simple?