Search packages, repositories and app categories

GitHub repositoryleo-elstin/chat_gpt

chat_gpt

ChatGPT SDK for Flutter apps written in Dart Language

chat_gpt project cover
Stars
6
Forks
6
Last push (UTC)
Oct 22, 2023
Project status
Active

Original README

English project snapshot. Visit GitHub for the latest content.

ChatGPT SDK for Flutter

The chatGPT SDK written in dart to access the features of the OpenAI APIs

Features

  1. Text Completion
  2. Chat Completion
  3. Code Generation
  4. Image Generation

Getting started

chat_gpt: 2.0.0
flutter pub get

Usage

Create an instance of the ChatGPT

final chatGpt = ChatGPT.builder( token: '<token>');

You can generate the token from https://beta.openai.com/account/api-keys

Additional information

#Text Completion : The completions endpoint can be used for a wide variety of tasks. More details : https://beta.openai.com/docs/guides/completion

How to write the prompts https://beta.openai.com/docs/guides/completion/prompt-design

Method to do code completion / code completion

    const prompt = "Explain Quantum Computing in simple terms";

    Completion? completion = await chatGpt.textCompletion(
      request: const CompletionRequest(
        prompt: prompt,
        maxTokens: 256,
      ),
    );

    print(completion?.choices);

#Image generation : The image generations endpoint allows you to create an original image given a text prompt. More Details : https://beta.openai.com/docs/guides/images/introduction

Supported Image Generation Types

  1. Creating images from scratch based on a text prompt
  2. Creating edits of an existing image based on a new text prompt
  3. Creating variations of an existing image

Sample Code to generate the image

    Images? images = await chatGpt.generateImage(
      request: const ImageRequest(
        prompt: 'A cute baby sea otter',
      ),
    );

    print(images?.data);

Catch me up on LinkedIn @Leo Elstin

💙 to Code 👨 🏽‍💻 Full Stack Mobile Developer [ Flutter, Native, Spring Boot ]

Leo Elstin GitHub avatar
GitHub author

Leo Elstin ↗

Senior Mobile Engineer @Maersk-Global

@maersk-globalBangalore, IndiaOfficial website ↗
LanguagesDart

Categories

Packages published by this repository

Dependencies used

Dependency list 2 items

How do I choose a repository?

Start with your use case, compare repository activity, and check the original project before adopting it.

  1. Search by repository name, owner or description, then narrow the results by topic.
  2. Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
  3. Read the README, license and issues on GitHub before using a project.

Sources and maintenance

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗