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

[Feat]: tokenized prompt #984

Closed
1 task done
0wwafa opened this issue Aug 26, 2024 · 1 comment
Closed
1 task done

[Feat]: tokenized prompt #984

0wwafa opened this issue Aug 26, 2024 · 1 comment

Comments

@0wwafa
Copy link

0wwafa commented Aug 26, 2024

Is your feature request related to a problem? Please describe.

When using the REST api, the json object has "text": "this is a prompt" fields.
Instead of text what other types are possible?
it would be great to be able to send already tokenized data (it would speed up the inference and save network data too).

Describe the solution you'd like

a more efficient way to send prompts and history or chubnked prompts.

Describe alternatives you've considered

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@holtskinner holtskinner mentioned this issue Sep 10, 2024
1 task
@holtskinner
Copy link
Collaborator

You can pass in multiple types of data, such as Images/Video/Audio.
Example: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/image-understanding

And you can send a tokenized prompt as a list of strings like this:

import vertexai
from vertexai.generative_models import GenerativeModel

# TODO(developer): Update project_id
# PROJECT_ID = "your-project-id"
vertexai.init(project=PROJECT_ID, location="us-central1")

model = GenerativeModel("gemini-1.5-flash-001")

response = model.generate_content(
    ["What", "'s", " a", " good", " name", " for", " a", " flower", " shop", " that", " specializes", " in", " selling", " bou", "quets", " of", " dried", " flowers", "?"]
)

print(response.text)

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

No branches or pull requests

5 participants
@holtskinner @0wwafa and others