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

Extend Type Hint for the content Parameter of send_message Functions Generative Models #3958

Closed
luxzoli opened this issue Jun 16, 2024 · 2 comments
Assignees
Labels
api: vertex-ai Issues related to the googleapis/python-aiplatform API.

Comments

@luxzoli
Copy link

luxzoli commented Jun 16, 2024

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

The content parameter of the send_message and similar functions does not imply with the type hint that it accepts Content objects as well (defined in the same file).

Describe the solution you'd like

Extend the type hint and documentation for the content variable of the affected functions.

Describe alternatives you've considered

None

Additional context

I can prepare a PR for this change if desired

@product-auto-label product-auto-label bot added the api: vertex-ai Issues related to the googleapis/python-aiplatform API. label Jun 16, 2024
@jaycee-li jaycee-li self-assigned this Jun 25, 2024
@Ark-kun Ark-kun assigned Ark-kun and unassigned jaycee-li Jun 26, 2024
@Ark-kun
Copy link
Contributor

Ark-kun commented Jun 26, 2024

Hello. We do not officially support taking Content objects in ChatSession.send_message, so the type hint is correct and intentional.

The rationale is: Content = parts+role. role is managed by ChatSession. This leaves parts. So send_message essentially takes a list of parts. A PartsType.

If you want to send manually-crafted Content objects to the model, consider using GenerativeModel.generate_content.

Does this make sense?

@Ark-kun Ark-kun closed this as not planned Won't fix, can't repro, duplicate, stale Jun 26, 2024
@luxzoli
Copy link
Author

luxzoli commented Jun 26, 2024

@Ark-kun Yes, thanks for the feedback. A clear and easy way could then be to use the parts attribute of the manually crafted Content object, which is a list of parts. By the way, the code to be adjusted is here in Microsoft Autogen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vertex-ai Issues related to the googleapis/python-aiplatform API.
Projects
None yet
Development

No branches or pull requests

3 participants