-
-
Notifications
You must be signed in to change notification settings - Fork 696
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
examples: Update openai chat example #542
Conversation
_, err = llm.GenerateContent(ctx, []llms.MessageContent{ | ||
{ | ||
Role: schema.ChatMessageTypeSystem, | ||
Parts: []llms.ContentPart{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mentioned convenience functions on top of GenerateContent in the email
We can also add helpers on other levels, like one for textual message contents:
llms.TextParts(role ChatMessageType, parts ...string) llms.MessageContent
And then your example would be something like:
_, err := llm.GenereteContent(
ctx,
llms.TextParts(schema.ChatMessageTypeSystem, "Hello, I am ..."),
llms.TextParts(schema.ChatMessageTypeHuman, "What would a ..."))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the api suggestions, let me mull these over a bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a small PR to add a helper in #549
LMK if you're going to update this PR now that the helpers landed, or if you want my help updating all the examples! I'll send a PR to update the vertex example and add a googleai example ... Sent #572 |
Please feel free to open PRs to update the other examples, otherwise I can probably get to it later today. |
Since the examples don't build without a Happy to do the full examples update after a new version is tagged! |
@eliben I went ahead and pushed a v0.1.4-alpha.0 tag that can be targetted here, I figure we can get the examples in order and then barring any issues get v0.1.4 released then point the examples at the release tag. |
Subsumed by #573 |
This updates the openai chat example to use llms.Model.GenerateContent.