Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{%- import 'macros.jinja' as utils %}
{%- for document in documents %}
<{{ doc_tag }} {{ utils.show_field('name', document.metadata, "name", 'Unknown') }} {{ utils.show_field('url', document.metadata, 'url', 'no-url', index=0) }}>
<{{ doc_tag }} {{ utils.show_field('name', document.metadata, "name", 'Unknown') }} {{ utils.show_field('source', document.metadata, 'source', 'Unknown', index=0) }}>
{{ document.text }}
</{{ doc_tag }}>
{%- endfor %}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{%- import 'macros.jinja' as utils %}
{%- for document in documents %}
<{{ doc_tag }} {{ utils.show_field('name', document.metadata, 'name', 'Unknown') }} {{ utils.show_field('source', document.metadata, 'source', 'Unknown') }} {{ utils.show_field('path', document.metadata, 'path', 'no path') }} {{ utils.show_field('uuid', document.metadata, 'uuid', 'Unknown') }} {{ utils.show_field('description', document.metadata, 'description', 'Unknown') }} {{ utils.show_field('url', document.metadata, 'url', 'no-url', index=0) }}>
<{{ doc_tag }} {{ utils.show_field('name', document.metadata, 'name', 'Unknown') }} {{ utils.show_field('source', document.metadata, 'source', 'Unknown') }} {{ utils.show_field('path', document.metadata, 'path', 'no path') }} {{ utils.show_field('uuid', document.metadata, 'uuid', 'Unknown') }} {{ utils.show_field('description', document.metadata, 'description', 'Unknown') }}>
{{ document.text }}
</{{ doc_tag }}>
{%- endfor %}
8 changes: 4 additions & 4 deletions src/agentcore/toolset/definitions/web_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import requests
from pydantic import HttpUrl, JsonValue

from agentcore.models import ToolParam
from agentcore.models import ActionResult, Document, Metadata, ToolParam
from agentcore.toolset.library import tools
from agentcore.utils import convert_output_to_action_result

Expand All @@ -23,13 +23,13 @@
),
},
)
@convert_output_to_action_result
def web_request(url: HttpUrl, method: str, payload: JsonValue | None = None) -> str:

def web_request(url: HttpUrl, method: str, payload: JsonValue | None = None) -> ActionResult:
match method:
case "GET":
response = requests.get(str(url))
case "POST":
response = requests.post(str(url), json=payload)
case _:
raise ValueError(f"Unsupported method: {method}")
return response.text
return [Document(text=response.text, metadata=Metadata(source=str(url)))]