Aus öffentlichen Paketdaten erstellte Orientierung.
Ein Dart-Client für die nicht-offizielle ChatGPT-API, der Textergänzungen und Streaming-Antworten über den Endpunkt v1/completions ermöglicht. Speziell für Flutter-Anwendungen entwickelt, unterstützt er mehrere Plattformen wie Android, iOS, Web, macOS, Windows und Linux. Das Paket vereinfacht die Integration mit den Textgenerierungsfunktionen von ChatGPT und ermöglicht Entwicklern die Echtzeitabfrage von künstlich generierten Inhalten. Ideal für Chat-Oberflächen, Content-Assistenten und interaktive Anwendungen, die natürliche Sprachverarbeitung erfordern.
Anwendungsfälle
Echtzeit-Chats-Anwendungen
KI-gesteuerte Inhaltserstellung
Interaktive Lernwerkzeuge
Automatisierte Antwortsysteme
Code-Vorschlag-Funktionen
Hauptmerkmale
Unterstützt Textergänzung
Echtzeit-Antworten streamen
Plattformübergreifende Kompatibilität
Einfache API-Schnittstelle
Nicht offizieller, aber funktioneller Zugriff auf ChatGPT
Geeignet für
Flutter-Entwickler, die KI-Chats funktionen erstellen
Apps, die Echtzeit-Textgenerierung benötigen
Prototypen, die eine schnelle KI-Integration erfordern
Hinweise
Nicht-offizielle API—kann mit Aktualisierungen brechen
Geschwindigkeitsbegrenzungen und Stabilität hängen von externen Diensten ab
Keine offizielle Unterstützung durch OpenAI
API-Schlüsselverwaltung erforderlich
Beschränkt auf Abschlussendpunkte, nicht auf vollständige Chatverläufe
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
Dart client for the unofficial ChatGPT API. Support Text Completeion and stream response from v1/completions.
Features
Text completions without stream response
Text completions with stream response
Getting started
Install package
flutter pub add chatgpt_completions
Usage
Initialize instance
/// Generate api key from openai console: https://platform.openai.com/account/api-keysChatGPTCompletions.instance.initialize(apiKey: "api_key_here");
Text completions without stream response (stream: false)
// Using GPT-3.5-TurboawaitChatGPTCompletions.instance.textCompletions(
TextCompletionsParams(
// using messagesTurbo insteal of prompt
messagesTurbo: [
MessageTurbo(
role: TurboRole.user,
content: "What's Flutter?",
),
],
model: GPTModel.gpt3p5turbo, // --> switch to gpt-3.5-turbo model
),
onStreamValue: (characters) {
responseWithStream += characters;
print(responseWithStream);
},
onStreamCreated: (subscription) {
responseSubscription = subscription;
},
// Debounce 100ms for receive next value
debounce: constDuration(milliseconds: 100),
);
License - lambiengcode
MIT License
Copyright (c) 2023 lambiengcode
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.