AnswerRocket skill framework
Project description
This is a framework for creating AnswerRocket skills. It provides decorators and utilities for turning your code into something that can be invoked by our platform.
Install
pip install skill-framework[ui] to install the library with the local preview server
pip install skill-framework for a plain install
There are three command line utilities installed along with this library:
package-skill <your_entry_file>.py - packages your skill for upload to your AnswerRocket environment. This will generate a
manifest file from the @skill-annotated function in the file and then combine everything into a zip archive. This
utility will honor a .gitignore file if one is present in the project root.
preview-server - runs a local preview server to view rendered layouts locally.
init-skill <skill_name> to bootstrap a new skill. This will create the following:
.
├── .gitignore
├── resources/
├── .previews/
└── <skill_name>.py
resources/ can be used for static resources that may be referenced by your layouts. The preview server can serve content
from this directory
.previews/ is where generated preview layouts will be stored for viewing with the preview server
The .gitignore file will be pre-populated with entries common to python projects, along with the .preview directory.
If you already have one, this script will not replace it.
A skill needs to have a @skill decorated entry point, like this:
from skill_framework import skill, SkillInput, SkillParameter, SkillOutput, SkillVisualization
@skill(
name="my_skill",
description="This is an example skill",
parameters=[
SkillParameter(
name="dim",
constrained_to="dimensions"
)
]
)
def my_skill(parameters: SkillInput):
# you can access arguments to your parameters extracted from
# natural language queries via the arguments field
# other run-specific context will also be provided on this object
# everything here is just a mocked up example, you can form the parts of the response
# in any way that makes sense for your skill.
data = get_some_data(parameters)
visualization = create_visualization(data)
narrative = create_narrative(data)
prompt = create_chat_response_prompt(data, narrative)
return SkillOutput(
final_prompt=prompt,
narrative=narrative,
visualizations=[visualization],
)
def get_some_data(params):
# use the client to get some data from a dataset
pass
def create_visualization(data) -> SkillVisualization:
# embed the data into a json layout payload
pass
def create_narrative(data) -> str:
# make some description of the data to appear as the narrative part of the response
pass
def create_chat_response_prompt(data, narrative) -> str:
# use the data and narrative to create a prompt for the model that will generate the response
# in the chat window
pass
You can generate a preview for viewing with the preview-server by passing your skill's output to preview_skill:
from skill_framework import skill, SkillParameter
from skill_framework.testing import SkillTestContext
@skill(
name="my skill",
parameters=[
SkillParameter(
name="metric",
)
]
)
def my_skill(skill_input):
pass
if __name__ == '__main__':
with SkillTestContext(my_skill) as ctx:
# this utility will write the output to where the local preview server expects it
ctx.preview_run({'metric': 'sales'})
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file skill_framework-0.3.18.tar.gz.
File metadata
- Download URL: skill_framework-0.3.18.tar.gz
- Upload date:
- Size: 9.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71189da87ba0699e1da51f2f9e96d3e3e5e4ebc220ac1e0157c55e354444c2e1
|
|
| MD5 |
82ce6690816163ec7d4cd081c5d02da3
|
|
| BLAKE2b-256 |
ed8d52d51de14861e2332baac0787923479100e3f8e0b9f95afd806d26457981
|
Provenance
The following attestation bundles were made for skill_framework-0.3.18.tar.gz:
Publisher:
build-and-publish.yml on answerrocket/skill-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
skill_framework-0.3.18.tar.gz -
Subject digest:
71189da87ba0699e1da51f2f9e96d3e3e5e4ebc220ac1e0157c55e354444c2e1 - Sigstore transparency entry: 829283709
- Sigstore integration time:
-
Permalink:
answerrocket/skill-framework@445364c34b1a6a282efed3ac9fae3df5ae4c759f -
Branch / Tag:
refs/tags/v0.3.18 - Owner: https://github.com/answerrocket
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-and-publish.yml@445364c34b1a6a282efed3ac9fae3df5ae4c759f -
Trigger Event:
push
-
Statement type:
File details
Details for the file skill_framework-0.3.18-py3-none-any.whl.
File metadata
- Download URL: skill_framework-0.3.18-py3-none-any.whl
- Upload date:
- Size: 10.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ca8a28b10d181298b2f2eb38f8e15e5141fca116855a0e9baa0141fb75c6ec6
|
|
| MD5 |
0906a98052333e0c240e007e23649eb9
|
|
| BLAKE2b-256 |
33de0b7ad746d969047ba507b04a41eb0bde12106093cf737849c79ea9f99653
|
Provenance
The following attestation bundles were made for skill_framework-0.3.18-py3-none-any.whl:
Publisher:
build-and-publish.yml on answerrocket/skill-framework
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
skill_framework-0.3.18-py3-none-any.whl -
Subject digest:
4ca8a28b10d181298b2f2eb38f8e15e5141fca116855a0e9baa0141fb75c6ec6 - Sigstore transparency entry: 829283711
- Sigstore integration time:
-
Permalink:
answerrocket/skill-framework@445364c34b1a6a282efed3ac9fae3df5ae4c759f -
Branch / Tag:
refs/tags/v0.3.18 - Owner: https://github.com/answerrocket
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-and-publish.yml@445364c34b1a6a282efed3ac9fae3df5ae4c759f -
Trigger Event:
push
-
Statement type: