FLUTTER ECOSYSTEM

hrvojecukman/chat_gpt_flutter

hrvojecukman/chat_gpt_flutter open-source repository details.

chat_gpt_flutter のプロジェクト画像
Stars
19
Forks
8
最終プッシュ(UTC)
2024/01/03
プロジェクト状態
公開中
Hrvoje Čukman GitHub avatar
GITHUB User

Hrvoje Čukman ↗

Flutter Developer

言語DartC++CMakeHTMLCSwiftKotlinObjective-C

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 10 件

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

README を開く / 閉じる

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);