Skip to main content

is_tools_api 0.2.1 copy "is_tools_api: ^0.2.1" to clipboard
is_tools_api: ^0.2.1 copied to clipboard

An intersyntactic tool's definition, as a host offers it to a model: its name, description, input and output, and the types of what a call takes and returns.

example/is_tools_api_example.dart

import 'dart:convert';

import 'package:checked_json/checked_json.dart';
import 'package:is_tools_api/is_tools_api.dart';

final echo = ToolSpec<String, String>(
  name: 'echo',
  description: 'Say the text back.',
  input: .field(Field('text', .string(), description: 'What to say back.')),
  output: .text,
);

void main() {
  // What a host sends the model, and what it costs in a request.
  print(jsonEncode(echo.toJson()));
  print('${echo.wireBytes} bytes');

  // What the model sent, read as the String the tool takes.
  print(echo.input.read(JsonObject.decode('{"text": "hello"}')));
}
0
likes
160
points
963
downloads

Documentation

API reference

Publisher

verified publisherenspyr.co

Weekly Downloads

An intersyntactic tool's definition, as a host offers it to a model: its name, description, input and output, and the types of what a call takes and returns.

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

checked_json

More

Packages that depend on is_tools_api