|
11 | 11 | # See the License for the specific language governing permissions and |
12 | 12 | # limitations under the License. |
13 | 13 | # =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. =========== |
| 14 | +from io import BytesIO |
| 15 | + |
| 16 | +import requests |
| 17 | +from PIL import Image |
| 18 | + |
14 | 19 | from camel.agents import ChatAgent |
15 | 20 | from camel.configs import MistralConfig |
16 | 21 | from camel.messages import BaseMessage |
|
47 | 52 | of autonomous and communicative agents. How can I assist you today? |
48 | 53 | =============================================================================== |
49 | 54 | ''' |
| 55 | + |
| 56 | +model = ModelFactory.create( |
| 57 | + model_platform=ModelPlatformType.MISTRAL, |
| 58 | + model_type=ModelType.MISTRAL_PIXTRAL_12B, |
| 59 | + model_config_dict=MistralConfig(temperature=0.0).as_dict(), |
| 60 | +) |
| 61 | + |
| 62 | +# Set agent |
| 63 | +camel_agent = ChatAgent(system_message=sys_msg, model=model) |
| 64 | + |
| 65 | +# URL of the image |
| 66 | +url = "https://raw.githubusercontent.com/camel-ai/camel/master/misc/primary_logo.png" |
| 67 | +response = requests.get(url) |
| 68 | +img = Image.open(BytesIO(response.content)) |
| 69 | + |
| 70 | +user_msg = BaseMessage.make_user_message( |
| 71 | + role_name="User", content="""what's in the image?""", image_list=[img] |
| 72 | +) |
| 73 | + |
| 74 | +# Get response information |
| 75 | +response = camel_agent.step(user_msg) |
| 76 | +print(response.msgs[0].content) |
| 77 | +''' |
| 78 | +=============================================================================== |
| 79 | +The image features a logo with a purple camel illustration on the left side |
| 80 | +and the word "CAMEL" written in purple capital letters to the right of the |
| 81 | +camel. |
| 82 | +=============================================================================== |
| 83 | +''' |
0 commit comments