Skip to main content

mira-sdk / mira-cli

Prerequisites

  • Python 3.10.*
  • pip
  • pdm

Setup

pdm sync

Usage

CLI Commands

The mira-cli provides several commands for managing flows, prompts, and executing operations. Here's a brief overview of the available commands:

  1. Initialize a flow:

    pdm run python -m src.mira.cli.mira_cli init --flow <flow_name> --template <template_name>
    
    • List available templates:
      pdm run python -m src.mira.cli.mira_cli init --list
      
  2. Execute a flow: - #TODO - lets call this as local testing or local run

    pdm run python -m src.mira.cli.mira_cli execute --config <path_to_config_file> --input key1=value1 key2=value2
    
  3. Manage prompts: - we have to start with prompts

    • List all prompts:
      pdm run python -m src.mira.cli.mira_cli prompts --lists
      
    • Show details of a specific prompt:
      pdm run python -m src.mira.cli.mira_cli prompts --show --prompt-name <author/prompt_name>
      
  4. Deploy a flow:

    pdm run python -m src.mira.cli.mira_cli deploy --flow <path_to_yaml_config> --name <flow_name>
    
  5. Execute a deployed flow:

    pdm run python -m src.mira.cli.mira_cli execute-flow --flow-name <flow_name> --input-data '{"key": "value"}'
    

For more detailed information on each command and its options, use the --help flag:

SDK Usage

The Mira SDK provides a simple way to execute flows and build custom flows programmatically. Here are examples of how to use the SDK:

Executing a Flow

To execute a flow using the MiraClient:

from mira_sdk_stg.mira.client.mira_client import MiraClient

client = MiraClient("flows/person.yaml")
result = client.execute({"coin": "Solana"})
print(result)

This script loads a flow from a YAML file and executes it with the given input.

Building a Custom Flow

#TODO - lets skip this piece for now

To create a custom flow using the FlowBuilder:

from mira_sdk_stg.mira.builder.flow_builder import FlowBuilder

builder = FlowBuilder()

# Set flow name and description
builder.set_name("SimpleTextGenerator")
builder.set_description("Persona Impersonator")

# Add resources
builder.add_prompt([{"second_prompt": "Generate a short story about {person} at {club}", "type": "local"},
                    {"main_prompt": "@aroha-labs/klok/1.0.0", "type": "mira"}])
builder.add_resource("knowledge", "writing_tips", {"file": "writing_tips.txt"})
builder.add_resource("models", "story_generator", {"type": "gpt-3.5-turbo"})

# Add component
builder.add_component(
    "story_generator",
    "Generator",
    {
        "prompt": "{resources.prompts.main_prompt}",
        "models": "{resources.models.story_generator}",
    },
)

# Add flow step
builder.add_flow_step(
    "story_generator",
    inputs=[{"person": "request", "club": "request"}],
    outputs=[{"target": "response"}]
)

# Save the flow
builder.save("flows/person.yaml")

Metadata

Release files for mira-sdk-stg 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mira-sdk-stg 0.1.3
File Size Uploaded
mira_sdk_stg-0.1.3.tar.gz 14.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mira-sdk-stg 0.1.3
File Interpreter ABI Platform
mira_sdk_stg-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 33.4 kB

Release files / mira_sdk_stg-0.1.3.tar.gz

Download URL mira_sdk_stg-0.1.3.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f9514c1b82a72f72ae74daa609b0d035cd2d2f87bc97b8e7256b9a216829fea1
BLAKE2b-256 checksum
How to use checksums
92162772db9489bfa35a8881933070b5c99b24eba3b3702fc24a8f02f49e3d19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.15

Release files / mira_sdk_stg-0.1.3-py3-none-any.whl

Download URL mira_sdk_stg-0.1.3-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9db980ed6c9e2fc4301fe3f6fadd306cf2d33aa95cbb988baf0bd80d8bf8e08
BLAKE2b-256 checksum
How to use checksums
7aa3ad03b47489ad727332a79f7285879161fa4ea0f609d3a300bdc19bb0c829
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.15

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release 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