Skip to content

Commit

Permalink
update readme examples (#37)
Browse files Browse the repository at this point in the history
Co-authored-by: Robby <h0rv@users.noreply.github.com>
  • Loading branch information
h0rv and h0rv authored Aug 13, 2024
1 parent 1bed2cc commit 6c2e9b9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func segment(ctx context.Context, data string) *Searches {
Model: openai.GPT4o,
Messages: []openai.ChatCompletionMessage{
{
Role: instructor.RoleUser,
Role: openai.ChatMessageRoleUser,
Content: fmt.Sprintf("Consider the data below: '\n%s' and segment it into multiple search queries", data),
},
},
Expand Down Expand Up @@ -298,7 +298,7 @@ func assert(condition bool, message string) {
<details>
<summary>Images with OpenAI</summary>

![List of movies](https://raw.githubusercontent.com/instructor-ai/instructor-go/main/examples/images/openai/books.png)
![List of books](https://raw.githubusercontent.com/instructor-ai/instructor-go/main/examples/images/openai/books.png)

<details>
<summary>Running</summary>
Expand Down Expand Up @@ -349,14 +349,14 @@ func main() {
instructor.WithMaxRetries(3),
)

url := "https://raw.githubusercontent.com/instructor-ai/instructor-go/main/examples/images/openai/books.png"
url := "https://raw.githubusercontent.com/instructor-ai/instructor-go/main/examples/vision/openai/books.png"

var bookCatalog BookCatalog
_, err := client.CreateChatCompletion(ctx, openai.ChatCompletionRequest{
Model: openai.GPT4o,
Messages: []openai.ChatCompletionMessage{
{
Role: instructor.RoleUser,
Role: openai.ChatMessageRoleUser,
MultiContent: []openai.ChatMessagePart{
{
Type: openai.ChatMessagePartTypeText,
Expand Down Expand Up @@ -437,7 +437,7 @@ func main() {
<details>
<summary>Images with Anthropic</summary>

![List of books](https://raw.githubusercontent.com/instructor-ai/instructor-go/main/examples/images/anthropic/movies.png)
![List of movies](https://raw.githubusercontent.com/instructor-ai/instructor-go/main/examples/images/anthropic/movies.png)

<details>
<summary>Running</summary>
Expand Down Expand Up @@ -493,7 +493,7 @@ func main() {
instructor.WithMaxRetries(3),
)

url := "https://raw.githubusercontent.com/instructor-ai/instructor-go/main/examples/images/anthropic/movies.jpg"
url := "https://raw.githubusercontent.com/instructor-ai/instructor-go/main/examples/vision/anthropic/movies.jpg"
data, err := urlToBase64(url)
if err != nil {
panic(err)
Expand All @@ -504,7 +504,7 @@ func main() {
Model: "claude-3-haiku-20240307",
Messages: []anthropic.Message{
{
Role: instructor.RoleUser,
Role: anthropic.RoleUser,
Content: []anthropic.MessageContent{
anthropic.NewImageMessageContent(anthropic.MessageContentImageSource{
Type: "base64",
Expand Down Expand Up @@ -696,15 +696,15 @@ Preferred Shopping Times: Weekend Evenings
Model: openai.GPT4o20240513,
Messages: []openai.ChatCompletionMessage{
{
Role: instructor.RoleSystem,
Role: openai.ChatMessageRoleSystem,
Content: fmt.Sprintf(`
Generate the product recommendations from the product list based on the customer profile.
Return in order of highest recommended first.
Product list:
%s`, productList),
},
{
Role: instructor.RoleUser,
Role: openai.ChatMessageRoleUser,
Content: fmt.Sprintf("User profile:\n%s", profileData),
},
},
Expand Down

0 comments on commit 6c2e9b9

Please sign in to comment.