prompty 2.0.0-beta.1

Prompty is an asset class and format for LLM prompts
Documentation
// Code generated by Prompty emitter; DO NOT EDIT.

#![allow(
    unused_imports,
    dead_code,
    non_camel_case_types,
    unused_variables,
    clippy::all
)]

use prompty::model::Tool;
use prompty::model::context::{LoadContext, SaveContext};

#[test]
fn test_tool_load_json() {
    let json = r####"
{
  "name": "my-tool",
  "kind": "function",
  "description": "A description of the tool",
  "bindings": {
    "input": "value"
  }
}
"####;
    let ctx = LoadContext::default();
    let result = Tool::from_json(json, &ctx);
    assert!(
        result.is_ok(),
        "Failed to load from JSON: {:?}",
        result.err()
    );
}

#[test]
fn test_tool_load_yaml() {
    let yaml = r####"
name: my-tool
kind: function
description: A description of the tool
bindings:
  input: value

"####;
    let ctx = LoadContext::default();
    let result = Tool::from_yaml(yaml, &ctx);
    assert!(
        result.is_ok(),
        "Failed to load from YAML: {:?}",
        result.err()
    );
}

#[test]
fn test_tool_roundtrip() {
    let json = r####"
{
  "name": "my-tool",
  "kind": "function",
  "description": "A description of the tool",
  "bindings": {
    "input": "value"
  }
}
"####;
    let load_ctx = LoadContext::default();
    let result = Tool::from_json(json, &load_ctx);
    assert!(result.is_ok(), "Failed to load: {:?}", result.err());
}