mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-29 03:14:19 +00:00
fix URL issue with agents
This commit is contained in:
parent
9eb5ec3e4b
commit
70fb70a71c
1 changed files with 6 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import copy
|
import copy
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import secrets
|
import secrets
|
||||||
import shutil
|
import shutil
|
||||||
import string
|
import string
|
||||||
|
@ -378,6 +379,11 @@ class ChatAgent(ShieldRunnerMixin):
|
||||||
|
|
||||||
elif attachments and AgentTool.code_interpreter.value in enabled_tools:
|
elif attachments and AgentTool.code_interpreter.value in enabled_tools:
|
||||||
urls = [a.content for a in attachments if isinstance(a.content, URL)]
|
urls = [a.content for a in attachments if isinstance(a.content, URL)]
|
||||||
|
# TODO: we need to migrate URL away from str type
|
||||||
|
pattern = re.compile("^(https?://|file://|data:)")
|
||||||
|
urls += [
|
||||||
|
URL(uri=a.content) for a in attachments if pattern.match(a.content)
|
||||||
|
]
|
||||||
msg = await attachment_message(self.tempdir, urls)
|
msg = await attachment_message(self.tempdir, urls)
|
||||||
input_messages.append(msg)
|
input_messages.append(msg)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue