Skip to content

Commit

Permalink
fix bug in example
Browse files Browse the repository at this point in the history
  • Loading branch information
DavdGao committed May 14, 2024
1 parent 0248347 commit b2dc5d7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
16 changes: 16 additions & 0 deletions examples/conversation_with_gpt-4o/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
This example will show
- How to use gpt-4o and other OpenAI vision models in AgentScope

In this example,
- you can have a conversation with OpenAI vision models.
- you can show gpt-4o with your drawings or web ui designs and look for its suggestions.
- you can share your pictures with gpt-4o and ask for its comments,

Just input your image url (both local and web URLs are supported) and talk with gpt-4o.


## Background

Expand Down Expand Up @@ -36,3 +43,12 @@ First fill your OpenAI API key in `conversation_with_gpt-4o.py`, then execute th
python conversation_with_gpt-4o.py
```

## A Running Example

- Conversation history with gpt-4o.

<img src="https://img.alicdn.com/imgextra/i4/O1CN01oQHcmy1mHXALklkMe_!!6000000004929-2-tps-5112-1276.png" alt="conversation history"/>

- My picture

<img src="https://img.alicdn.com/imgextra/i3/O1CN01UpQaLN27hjidUipMv_!!6000000007829-0-tps-720-1280.jpg" alt="my picture" width="200" />
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
"""An example for conversation with OpenAI vision models, especially for
GPT-4o."""
import agentscope
from agentscope.agents import UserAgent, DialogAgent

# Fill in your OpenAI API key
Expand All @@ -16,6 +17,8 @@
},
}

agentscope.init(model_configs=model_config)

# Require user to input URL, and press enter to skip the URL input
user = UserAgent("user", require_url=True)

Expand All @@ -29,5 +32,5 @@
while True:
x = agent(x)
x = user(x)
if x == "exit": # type "exit" to break the loop
if x.content == "exit": # type "exit" to break the loop
break

0 comments on commit b2dc5d7

Please sign in to comment.