FLUTTER ECOSYSTEM

hrvojecukman/chat_gpt_flutter

hrvojecukman/chat_gpt_flutter open-source repository details.

Projektcover von chat_gpt_flutter
Stars
19
Forks
8
Letzter Push (UTC)
03.01.2024
Projektstatus
Aktiv
Hrvoje Čukman GitHub avatar
GITHUB User

Hrvoje Čukman ↗

Flutter Developer

SprachenDartC++CMakeHTMLCSwiftKotlinObjective-C

Von diesem Repository veröffentlichte Pakete

Verwendete Abhängigkeiten

Abhängigkeiten 10 Einträge

Original-README

Englischer Projektschnappschuss. Aktuelle Inhalte auf GitHub.

Projekt-README ein-/ausklappen

ChatGPT API implemented in Flutter

Buy Me A Coffee

Usage example

Getting started

You have to create OpenAI account and request API key from here: https://beta.openai.com/account/api-keys

Stream usage


final chatGpt = ChatGpt(apiKey: apiKey);

final question =
    'Which Disney character famously leaves a glass slipper behind at a royal ball?';

final request = CompletionRequest(
  prompt: question,
  stream: true,
  maxTokens: 4000,
  model: ChatGptModel.textDavinci003.key,
);

final stream = await chatGpt.createCompletionStream(request);

Usage without stream


final chatGpt = ChatGpt(apiKey: apiKey);

final testPrompt =
    'Which Disney character famously leaves a glass slipper behind at a royal ball?';

final testRequest = CompletionRequest(
  prompt: testPrompt,
  model: ChatGptModel.textDavinci003.key,
);

final result = await chatGpt.createCompletion(testRequest);