Skip to main content

Eliza, the chatbot from the 1960s, running on OpenAI's Chat Completions API

Project description

Eliza-GPT

Eliza, the classic chatbot from the 1960s, running on OpenAI's Chat Completions API.

Why?

The main reason is that this seemed like a fun project to help me acquire a greater understanding of the Chat Completions API from OpenAI, which has become a sort of standard for turn-based conversation between a human and a machine.

But also, it is great to have a fast and free service with negligible resource consumption that can be used as a stand-in for a real LLM when the quality of the responses do not matter, such as while doing development or testing.

How To Use

Eliza-GPT is written in Python and can be installed with pip:

$ pip install eliza-gpt

Once installed, run it to start it as a local service on your computer:

$ eliza-gpt
Eliza-GPT is running!
Set base_url="http://127.0.0.1:5005/v1" in your OpenAI client to connect.

Run with --help to learn about configuration options, which include:

  • Setting the listening IP address and port
  • Adding an API key for authentication
  • Changing the (simulated) response times, or removing all artificial delays.

If you are using the official Python client from OpenAI, add the base_url option to it as follows:

openai_client = OpenAI(base_url='http://localhost:5005/v1')

If you use Langchain, then use the following to connect to Eliza-GPT:

chat = ChatOpenAI(base_url='http://localhost:5005/v1')

Eliza-GPT supports both the direct and streaming interfaces.

Examples

The examples directory includes demonstration applications implemented with the OpenAI client and Langchain.

Implementation Details

Eliza-GPT implements a portion of the OpenAI Chat Completions API, ignoring anything that isn't useful.

The following aspects of the API are currently supported:

  • The chat history given in the messages argument. Only messages with role user are used to "prime" Eliza so that it provides a reasonable response.
  • The stream argument, which determines if the response should be given in a single JSON object or as a stream of Server-Sent Events.
  • The seed option, which makes it possible to have deterministic responses.

These are not used or implemented:

  • Any messages in the chat history that have a role different than user.
  • Model names. Eliza-GPT returns the requested model name in the response.
  • The n argument, which controls how many responses are returned. Eliza-GPT always returns a single response.
  • The max_tokens argument.
  • Temperature and other LLM-specific tuning parameters.
  • The stop argument.
  • Anything related to tools or functions that the model may call.
  • Anything related to log probabilities.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Eliza-GPT-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

Eliza_GPT-0.1.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file Eliza-GPT-0.1.0.tar.gz.

File metadata

  • Download URL: Eliza-GPT-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for Eliza-GPT-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cd943094f698b872c50ef059d1ca8e9b654ff3f7e67b21284a340edf3b9d2d22
MD5 4210d696ccf32a8b7fdfddffb857a9c2
BLAKE2b-256 bb1e3222ceb92e1991dcfae01b62164f2ce41aa5df10b8853265ed071b953409

See more details on using hashes here.

File details

Details for the file Eliza_GPT-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: Eliza_GPT-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for Eliza_GPT-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e05816325b4cea3cf98d77e0c15882f31f92b12f35446462ccf8d2dfee9f021c
MD5 0c9c2d6977088245d2b2f5aabbf42bfc
BLAKE2b-256 acb55396fe3cdf9d80d80ecedcaf0cf4c5bc2b633dd59f620e89974504395a48

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page