Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions lib/gpt_3_dart.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
library gpt3_dart;

import 'package:meta/meta.dart';
import 'package:http/http.dart' as http;
import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:http/http.dart' as http;


class Param {
String name;
Expand All @@ -20,28 +20,28 @@ class Param {
}

class OpenAI {
String apiKey;
OpenAI({@required this.apiKey});
final String apiKey;
OpenAI({required this.apiKey});

String getUrl(function, [engine]) {
Uri getUrl(function, [engine]) {
List engineList = ['ada', 'babbage', 'curie', 'davinci'];

String url = 'https://api.openai.com/v1/engines/davinci/$function';

if (engineList.contains(engine)) {
url = 'https://api.openai.com/v1/engines/$engine/$function';
}
return url;
return Uri.parse(url);
}

Future<String> complete(String prompt, int maxTokens,
{num temperature,
num topP,
int n,
bool stream,
int logProbs,
bool echo,
String engine}) async {
{num? temperature,
num? topP,
int? n,
bool? stream,
int? logProbs,
bool? echo,
String? engine}) async {
String apiKey = this.apiKey;

List data = [];
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: gpt_3_dart
description: Unofficial Dart package for OpenAI's GPT-3 API.
version: 0.0.1
version: 0.0.2
author: boron
homepage: https://github.com/boronhub/gpt_3_dart.git

environment:
sdk: ">=2.7.0 <3.0.0"
flutter: ">=1.17.0"
sdk: ">=2.18.0 <3.0.0"
flutter: ">=3.3.0"

dependencies:
flutter:
sdk: flutter
http: ^0.12.2
http: ^0.13.5
meta:

dev_dependencies:
Expand Down