Giter Site home page Giter Site logo

gpt_assistant_lib's Introduction

GPT-Assistant Library

The GPT-Assistant Library is a Python-based toolkit for building intelligent personal assistants powered by OpenAI's GPT models. This library simplifies the integration of conversational AI into your applications, making it easier than ever to create chatbots, virtual assistants, and more.

Key Features

  • Seamless integration with GPT-3 and GPT-4 models.
  • Easily manage conversations and user interactions.
  • Support multiuser chat history support
  • Customizable and extensible to suit your specific needs.
  • Developer-friendly API for smooth integration into your projects.

Installation

pip install gpt-assistant-lib

Configuration

To set up the assistant, you need an API key and to create a system prompt.

Obtain API key

Go to Openai website

System prompt

It will define your assistant behaviour. More info you can find in documentation

History

The library maintains a conversation history that the assistant relies on to understand and maintain context during interactions. This conversation history is included in every request sent to OpenAI. A larger history size allows the assistant to remember more context, enhancing its ability to engage in meaningful conversations. However, it's important to note that larger conversation histories can result in increased API call costs.

Usage

import gpt_assistant_lib

openai_api_key = "your_openai_api_key"
initial_prompt = "You are a helpful assistant."
max_history_size = 5
history_lifetime = 600  # 10 minutes
assistant = gpt_assistant_lib.build_assistant(openai_api_key, initial_prompt, max_history_size, history_lifetime)
while True:
    user_input = input("You: ")
    assistant_response = assistant.exchange("any", user_input)
    print(f"Assistant: {assistant_response}")

Development

Run with enabled virtual environment

Autoformat source code

task format

Run all linters

task lint

Run unit tests

task test

Run all linters and unit tests

task all

License

This project is licensed under the MIT License

gpt_assistant_lib's People

Contributors

elisey avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.