kikocis/llama-stack public
Changesets · Branches · Tags · Compare
| Changeset | cd503abf30902a8f33228270f66a232bf41f91c185da85f1fcee60ae7773a42c |
|---|---|
| Author | Xi Yan <xiyan@meta.com> · 2024-09-23 16:44 -07:00 |
| Committer | Xi Yan <xiyan@meta.com> · 2024-09-23 16:44 -07:00 |
| Parents | 329cf2dbbb63 |
1 file changed
modified llama_stack/providers/impls/meta_reference/agents/agent_instance.py +6 −0
| @@ -7,6 +7,7 @@ | ||
| 7 | 7 | import asyncio |
| 8 | 8 | import copy |
| 9 | 9 | import os |
| 10 | +import re | |
| 10 | 11 | import secrets |
| 11 | 12 | import shutil |
| 12 | 13 | import string |
| @@ -378,6 +379,11 @@ | ||
| 378 | 379 | |
| 379 | 380 | elif attachments and AgentTool.code_interpreter.value in enabled_tools: |
| 380 | 381 | urls = [a.content for a in attachments if isinstance(a.content, URL)] |
| 382 | + # TODO: we need to migrate URL away from str type | |
| 383 | + pattern = re.compile("^(https?://|file://|data:)") | |
| 384 | + urls += [ | |
| 385 | + URL(uri=a.content) for a in attachments if pattern.match(a.content) | |
| 386 | + ] | |
| 381 | 387 | msg = await attachment_message(self.tempdir, urls) |
| 382 | 388 | input_messages.append(msg) |
| 383 | 389 |