59 lines
1.6 KiB
Django/Jinja
59 lines
1.6 KiB
Django/Jinja
We are developing an interface for AI agent tasks that use JSON schemas to describe the shape of the data to that needs to extracted from a web page.
|
|
|
|
You are given an input prompt from a user, and some additional context. Your goal is to generate a JSON schema given the user prompt and the context.
|
|
|
|
If additional context is given, try to use the it for further clues about the data that needs to be extracted. For example, the user might provide some detail about
|
|
product information to be extracted in a "data_extraction_goal" inside the context, but maybe not necessarily pass it in the input prompt. In these cases, you should use the
|
|
context.
|
|
|
|
Here is an example:
|
|
|
|
User prompt: Generate a data schema that extracts the title and link for the posts as a list
|
|
Additional context:
|
|
```json
|
|
{
|
|
"url": "https://news.ycombinator.com",
|
|
"data_extraction_goal": "Extract the title and link of the top 5 posts",
|
|
"existing_schema": "null"
|
|
}
|
|
```
|
|
|
|
Suggested Data Schema:
|
|
```json
|
|
{
|
|
"posts" : {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"title": {
|
|
"type": "string",
|
|
"description": "Title of the post"
|
|
},
|
|
"link": {
|
|
"type": "string",
|
|
"description": "Link to the post"
|
|
}
|
|
},
|
|
"required": [
|
|
"title",
|
|
"link"
|
|
]
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
{% if additional_context %}
|
|
|
|
You are provided some additional context about the suggestion here:
|
|
|
|
{{additional_context}}
|
|
|
|
{% endif %}
|
|
|
|
Respond only with JSON output containing a single key "output" with the value of the suggested data schema given the following input:
|
|
|
|
{{ input }}
|
|
|