one_shot 1.0.3 copy "one_shot: ^1.0.3" to clipboard
one_shot: ^1.0.3 copied to clipboard

Build simple LLM applications fast. Works with any LLM provider that uses the Open AI chat completions protocol.

one_shot #

Build simple LLM applications fast. Works with any LLM provider that uses the Open AI chat completions protocol.

import 'dart:convert';
import 'dart:io';

import 'package:one_shot/one_shot.dart';

Future<void> main() async {
  final apiKey = Platform.environment["OPEN_AI_KEY"]!;
  final britishFlag = await File("flag.png").readAsBytes();
  final prompt = """
What is the capitol of the United States of America?
What flag is this?

respond in json:
{
  capitol: string
  flag: string
}
""";

  final result = await oneShot(
    apiKey: apiKey,
    prompt: prompt,
    images: [britishFlag],
  );

  print(result); // { "capitol": "Washington DC", "flag": "Union Jack"}
}

Promises #

Contributing #

  • Add endpoints and models that are compliant
  • Add token metadata logging
  • Add temperature controls

Credits #

The album that wrote this package: https://open.spotify.com/album/1tr3wtSgVZbk6xFLQpVDdA

12
likes
160
points
38
downloads

Publisher

verified publisherlukepighetti.com

Weekly Downloads

Build simple LLM applications fast. Works with any LLM provider that uses the Open AI chat completions protocol.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

http

More

Packages that depend on one_shot