FLUTTER ECOSYSTEM

hrvojecukman/chat_gpt_flutter

hrvojecukman/chat_gpt_flutter open-source repository details.

chat_gpt_flutter 專案封面
Stars
19
Forks
8
最近推送(UTC)
2024年1月3日
專案狀態
未封存
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);