Skip to main content

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'})

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skill_framework-0.4.1.tar.gz (9.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skill_framework-0.4.1-py3-none-any.whl (10.2 MB view details)

Uploaded Python 3

File details

Details for the file skill_framework-0.4.1.tar.gz.

File metadata

  • Download URL: skill_framework-0.4.1.tar.gz
  • Upload date:
  • Size: 9.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for skill_framework-0.4.1.tar.gz
Algorithm Hash digest
SHA256 72c61cb7055593d3f790bf689ba6558f47de8981c4f7b949ef02e8c74071da58
MD5 125b5cfb988803b10bc7c630309c163d
BLAKE2b-256 e2162d03985745c4ee4c67565810e7f764572890f26e0b48ddd0fb04fa5336d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for skill_framework-0.4.1.tar.gz:

Publisher: build-and-publish.yml on answerrocket/skill-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file skill_framework-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: skill_framework-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for skill_framework-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8b21c046a09a50c36b948ba6c2a6b532d2964ee65689c35fedb836b613921630
MD5 e2880e2b195dadf53af083a19ac1bf0c
BLAKE2b-256 e92d9f939755083e8846f00947e5c5b93558c88480821d7cb284977c60571a55

See more details on using hashes here.

Provenance

The following attestation bundles were made for skill_framework-0.4.1-py3-none-any.whl:

Publisher: build-and-publish.yml on answerrocket/skill-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 files

0.3.18

2 files

0.3.17

2 files

0.3.16.2

2 files

0.3.16

2 files

0.3.15

2 files

0.3.14

2 files

0.3.13

2 files

0.3.12

2 files

0.3.11

2 files

0.3.10

2 files

0.3.9

2 files

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page