Skip to main content

ChatGptHub: Gpt Chatbot Library with LangChain Support

Project description

ChatGptHub: Gpt Chatbot Library with LangChain Support

pypi version

This repo is a implementation of the paper ChatGPT Models with LangChain support.

Installation

pip install chatgpthub

Usage

from chatgpthub import (
    load_openai_key,
    load_promptlayer_key,
    prompt_template,
    translate_chatgpt,
    promptlayer_chatgpt,
)

# translate chatgpt model
from chatgpthub.demo import ChatGptHubDemo

demo = ChatGptHubDemo(
    openai_key="openai_key",
    promptlayer_key="promptlayer_key", #optional
)

# translate chatgpt model
demo.translate(
    model_name: str = "gpt-3.5-turbo",
    input_language: str = "English",
    output_language: str = "Turkish",
    text: str = "Hello, how are you?",
    temperature: float = 0.0,
)

# promptlayer chatgpt model
demo.promptlayer(
    model_name: str = "gpt-3.5-turbo",
    text: str = "Hello, how are you?",
    temperature: float = 0.0,
)

# custom template chatgpt model
template = """
Englist words explanation:
    - {text}
Turkish words explanation:
    - {translation}
"""

template = "You are a helpful assistant that python to c++ and you are asked to translate the following text: {text}"
text = "print('Hello, world!')"
output = demo.custom_template(
    model_name="gpt-3.5-turbo",
    template=template,
    input_variables="text",
    text=text,
    temperature=0.0,
)

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

chatgpthub-0.0.9.tar.gz (6.6 kB view hashes)

Uploaded Source

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