Skip to content
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

[Feature]: Gemini usage in agentscope through VartexAI #358

Open
liuqi6776 opened this issue Jul 23, 2024 · 2 comments
Open

[Feature]: Gemini usage in agentscope through VartexAI #358

liuqi6776 opened this issue Jul 23, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@liuqi6776
Copy link

Vartexai is google platform based on project

For the usage, we use the code as below
from vertexai.generative_models import GenerativeModel, Part
import vertexai.preview.generative_models as generative_models
(after run this import code need to login in google SDK)
vertexai.init(project="", location="")
model = GenerativeModel("gemini-1.5-pro-001",)

Can you add this Gemini usage for agentscope
as the no_api_key version, for api_key is vertexai
{
{
"config_name": "my_gemini_chat_config",
"model_type": "gemini_chat",

"model_name": "{model_name}",               # Gemini Chat API中的模型名,例如:gemini-pro

"api_key": "vertexai",         

}
}

@liuqi6776 liuqi6776 added the enhancement New feature or request label Jul 23, 2024
@DavdGao
Copy link
Collaborator

DavdGao commented Jul 23, 2024

Thanks for your attention.

Honestly, I'm a little confused about the differences between the google.generativeai and vartexai libraries since they provide similar model API serviecs. For now, we will first figure it out, and then make decisions.

@liuqi6776 Any suggestions about their differences?

@liuqi6776
Copy link
Author

@DavdGao Sure, this is some differences about their definition and implement code.
1:google.generativeai

High-Level API: This is a user-friendly Python library that offers a simplified interface for working with pre-trained generative AI models. It's designed to make it easy for developers to integrate generative AI features into their applications quickly.

Example:

from google.generativeai import generate_text

response = generate_text(
model='text-davinci-003',
prompt='Write a short story about a cat who goes on an adventure.'
)

print(response.text)

2. vertexai.generative_models.GenerativeModel

Model Object: This is a class within the Vertex AI SDK that represents a trained generative model. It provides methods for interacting with models in a more fine-grained and flexible manner.

Customizability: vertexai.generative_models.GenerativeModel is designed for more advanced users who want more control over the model training and deployment process. You can load your own pre-trained models or train new ones.

ML Pipeline Integration: This class is integrated with the broader Vertex AI platform. This means you can take advantage of features like:

Model training: Train your own generative models with Vertex AI's managed environments.
Deployment: Deploy models to serve predictions in production.
Monitoring and optimization: Track and improve model performance over time.
Example:

from vertexai.generative_models import GenerativeModel
from vertexai.generative_models.text import TextGenerationModel

model = TextGenerationModel.create(
display_name='my-text-model',
model_type='text-davinci-003'
)

response = model.predict(
text_inputs=['Write a short story about a cat who goes on an adventure.']
)

print(response)

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

No branches or pull requests

2 participants