Convert Figma logo to code with AI

xtekky logochatgpt-clone

ChatGPT interface with better UI

3,521
1,038
3,521
58

Top Related Projects

Examples and guides for using the OpenAI API

17,411

AI agent stdlib that works with any LLM and TypeScript AI SDK.

37,573

DeepSpeed is a deep learning optimization library that makes distributed training and inference easy, efficient, and effective.

38,431

An open platform for training, serving, and evaluating large language models. Release repo for Vicuna and Chatbot Arena.

173,689

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

28,064

Reverse engineered ChatGPT API

Quick Overview

The xtekky/chatgpt-clone repository is an open-source project that aims to replicate the functionality of OpenAI's ChatGPT. It provides a web-based interface for interacting with a language model, offering a similar user experience to the original ChatGPT.

Pros

  • Offers a free, self-hosted alternative to ChatGPT
  • Customizable and extendable, allowing developers to modify the interface and functionality
  • Provides a learning resource for understanding how chatbot interfaces work
  • Supports multiple language models, including GPT-3.5-turbo and GPT-4

Cons

  • May not have the same level of performance or accuracy as the official ChatGPT
  • Requires technical knowledge to set up and maintain
  • Depends on external APIs, which may have usage limits or costs
  • May lack some advanced features present in the official ChatGPT

Code Examples

# Example 1: Initializing the chatbot
from chatbot import Chatbot

chatbot = Chatbot(model="gpt-3.5-turbo", api_key="your-api-key")
# Example 2: Sending a message to the chatbot
response = chatbot.send_message("Hello, how are you?")
print(response)
# Example 3: Streaming the chatbot's response
for chunk in chatbot.send_message("Tell me a story", stream=True):
    print(chunk, end="", flush=True)

Getting Started

  1. Clone the repository:

    git clone https://github.com/xtekky/chatgpt-clone.git
    cd chatgpt-clone
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Set up your API key:

    export OPENAI_API_KEY=your-api-key
    
  4. Run the application:

    python app.py
    
  5. Open your browser and navigate to http://localhost:5000 to start using the ChatGPT clone.

Competitor Comparisons

Examples and guides for using the OpenAI API

Pros of openai-cookbook

  • Comprehensive guide with examples for various OpenAI API use cases
  • Officially maintained by OpenAI, ensuring up-to-date and accurate information
  • Covers a wide range of topics, from basic API usage to advanced techniques

Cons of openai-cookbook

  • Focuses solely on OpenAI's products, limiting its scope compared to chatgpt-clone
  • Lacks a full-fledged application implementation, unlike chatgpt-clone's functional ChatGPT replica

Code Comparison

openai-cookbook example (Python):

import openai

response = openai.Completion.create(
  model="text-davinci-002",
  prompt="Translate the following English text to French: '{}'",
  max_tokens=60
)

chatgpt-clone example (JavaScript):

const response = await fetch('https://api.openai.com/v1/chat/completions', {
  method: 'POST',
  headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({ model: 'gpt-3.5-turbo', messages: [{ role: 'user', content: prompt }] })
});

The openai-cookbook provides straightforward examples for API usage, while chatgpt-clone implements a more complete application structure, including frontend and backend components.

17,411

AI agent stdlib that works with any LLM and TypeScript AI SDK.

Pros of agentic

  • Focuses on building autonomous AI agents, offering a more specialized and advanced approach
  • Provides a framework for creating complex, goal-oriented AI systems
  • Includes features for memory management and task planning

Cons of agentic

  • May have a steeper learning curve due to its more advanced nature
  • Less suitable for simple chatbot implementations
  • Potentially requires more computational resources

Code Comparison

chatgpt-clone:

@app.route('/api/chat', methods=['POST'])
def chat():
    data = request.json
    message = data['message']
    response = get_chatgpt_response(message)
    return jsonify({'response': response})

agentic:

async def run_agent(agent: Agent, task: str):
    result = await agent.run(task)
    memory = agent.memory.get_relevant(task)
    return {'result': result, 'memory': memory}

The chatgpt-clone code shows a simple API endpoint for chat interactions, while the agentic code demonstrates a more complex agent-based approach with memory management.

37,573

DeepSpeed is a deep learning optimization library that makes distributed training and inference easy, efficient, and effective.

Pros of DeepSpeed

  • Focuses on optimizing large-scale deep learning models, offering significant performance improvements
  • Provides a comprehensive suite of optimization techniques, including ZeRO, 3D parallelism, and pipeline parallelism
  • Actively maintained by Microsoft Research with frequent updates and extensive documentation

Cons of DeepSpeed

  • Steeper learning curve due to its complex optimization techniques and integration requirements
  • Primarily designed for large-scale models and may be overkill for smaller projects or simple chatbots
  • Requires more setup and configuration compared to simpler alternatives

Code Comparison

DeepSpeed (model initialization):

model_engine, optimizer, _, _ = deepspeed.initialize(
    args=args,
    model=model,
    model_parameters=model.parameters(),
    config=ds_config
)

ChatGPT-Clone (API call):

response = openai.ChatCompletion.create(
    model="gpt-3.5-turbo",
    messages=[{"role": "user", "content": prompt}],
    temperature=0.7,
    max_tokens=150
)

While DeepSpeed focuses on optimizing and training large language models, ChatGPT-Clone provides a simpler interface for interacting with pre-trained models through API calls. DeepSpeed is more suitable for researchers and developers working on advanced AI projects, while ChatGPT-Clone is better for those looking to quickly implement chatbot functionality using existing models.

38,431

An open platform for training, serving, and evaluating large language models. Release repo for Vicuna and Chatbot Arena.

Pros of FastChat

  • More comprehensive and feature-rich, offering a complete ecosystem for training and serving large language models
  • Better documentation and community support, making it easier for developers to get started and troubleshoot issues
  • Supports multiple model architectures and provides tools for model evaluation and comparison

Cons of FastChat

  • Higher complexity and steeper learning curve, which may be overwhelming for beginners or small-scale projects
  • Requires more computational resources due to its broader scope and support for larger models
  • Less focused on providing a simple, plug-and-play ChatGPT-like experience compared to ChatGPT Clone

Code Comparison

FastChat (model serving):

from fastchat.serve.controller import Controller
from fastchat.serve.model_worker import ModelWorker
from fastchat.serve.openai_api_server import OpenAIAPIServer

controller = Controller(host="localhost", port=21001)
worker = ModelWorker(controller_addr="http://localhost:21001", worker_addr="http://localhost:21002")
api_server = OpenAIAPIServer(controller_addr="http://localhost:21001")

ChatGPT Clone (basic usage):

from revChatGPT.V1 import Chatbot

chatbot = Chatbot(config={
    "email": "<your email>",
    "password": "<your password>"
})

response = chatbot.ask("Hello, how are you?")
print(response["message"])
173,689

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Pros of AutoGPT

  • More advanced AI capabilities, including autonomous task completion and goal-oriented behavior
  • Broader range of applications beyond chat, such as web browsing and file manipulation
  • Active development with frequent updates and a larger community

Cons of AutoGPT

  • More complex setup and configuration required
  • Higher computational resources needed for operation
  • Potential for unexpected or uncontrolled behavior due to its autonomous nature

Code Comparison

AutoGPT (main.py):

def run_auto_gpt(continuous: bool, continuous_limit: int, ai_settings: str, prompt: str, skip_reprompt: bool, speak: bool, debug: bool, gpt3only: bool, gpt4only: bool, memory_type: str, browser_name: str, allow_downloads: bool, skip_news: bool):
    # ... (implementation details)

ChatGPT Clone (app.py):

@app.route("/chat", methods=["POST"])
def chat():
    data = request.json
    message = data.get("message", "")
    response = get_chatgpt_response(message)
    return jsonify({"response": response})

The code snippets highlight the difference in complexity and focus between the two projects. AutoGPT's main function shows a more complex setup with multiple parameters, while ChatGPT Clone's route handler demonstrates a simpler chat-oriented approach.

28,064

Reverse engineered ChatGPT API

Pros of ChatGPT

  • More comprehensive API support, including official ChatGPT API
  • Better documentation and usage examples
  • Larger community and more frequent updates

Cons of ChatGPT

  • More complex setup and configuration
  • Requires API key or account credentials
  • Potentially higher resource usage

Code Comparison

ChatGPT:

from revChatGPT.V3 import Chatbot

chatbot = Chatbot(api_key="your_api_key")
response = chatbot.ask("Hello, how are you?")
print(response)

chatgpt-clone:

from chatgpt_wrapper import ChatGPT

bot = ChatGPT()
response = bot.ask("Hello, how are you?")
print(response)

Both repositories aim to provide access to ChatGPT functionality, but they differ in their approach and features. ChatGPT offers more comprehensive API support and better documentation, making it suitable for developers who need advanced features and integration options. However, it requires API keys or account credentials and may have a steeper learning curve.

On the other hand, chatgpt-clone provides a simpler interface and easier setup, making it more accessible for beginners or those who need a quick implementation. However, it may lack some of the advanced features and official API support found in ChatGPT.

The code comparison shows that both repositories offer a straightforward way to interact with ChatGPT, but ChatGPT requires an API key, while chatgpt-clone uses a wrapper approach that may not require explicit authentication in some cases.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Development of this repository is currently in a halt, due to lack of time. Updates are comming end of June.

working again ; ) I am very busy at the moment so I would be very thankful for contributions and PR's

To do

ChatGPT Clone

feel free to improve the code / suggest improvements

image

Getting Started

To get started with this project, you'll need to clone the repository and set up a virtual environment. This will allow you to install the required dependencies without affecting your system-wide Python installation.

Prequisites

Before you can set up a virtual environment, you'll need to have Python installed on your system. You can download Python from the official website: https://www.python.org/downloads/

Cloning the Repository

Run the following command to clone the repository:

git clone https://github.com/xtekky/chatgpt-clone.git

Setting up a Virtual Environment

To set up a virtual environment, follow these steps:

  1. Navigate to the root directory of your project.
cd chatgpt-clone
  1. Run the following command to create a new virtual environment:
python -m venv venv
  1. Activate the virtual environment by running the following command:
source venv/bin/activate

If you are using fish shell, the command will be slightly different:

source venv/bin/activate.fish

If you're on Windows, the command will be slightly different:

venv\Scripts\activate
  1. Install the required dependencies by running the following command:
pip install -r requirements.txt

Configure the Application

To configure the application, there are a few properties that can be set either via the environment or via config.json. The environment variable takes priority.

FieldEnv Variableconfig.jsonexamples
The OpenAI Api KeyOPENAI_API_KEYopenai_keysk-...
The OpenAI Base URLOPENAI_API_BASEopenai_api_basehttps://api.openai.com
http://my-reverse-proxy/

Use the Base URL if you need to run your queries through a reverse proxy (like this one which will run your queries through Azure's OpenAI endpoints )

Running the Application

To run the application, make sure the virtual environment is active and run the following command:

python run.py

Docker

The easiest way to run ChatGPT Clone is by using docker

docker-compose up