Skip to content

griptape-ai/griptape-chat

Repository files navigation

Griptape Chat Demo

Description

This repository contains Python code using the griptape framework that allows you to interact with a Griptape Structure through the Gradio ChatInterface.

The demo uses Gradio for the frontend and Griptape for the backend.

Get the code

git clone git@github.com:griptape-ai/griptape-chat.git
cd griptape-chat

OpenAI API Key

We'll need to obtain our OpenAI API key. Follow the steps below to do so:

  1. Head to OpenAi's official website and either create or login to your account. Once you are logged in, click on the "Personal" text on the top right of your browser and then click on "View API keys" from the context menu that appears.

  2. Click on "+ Create new secret key" and give it a name.

  3. Copy the key and paste it in the .env file in the root directory of this project. Replacing "your key here"

Setting up the runtime environment

Copy the .env.example into a .env in the root of this project directory and populate your OPENAI_API_KEY:

OPENAI_API_KEY=your key here

optional: if you want to run this on a port other than the default gradio port of 7860 you can add GRADIO_PORT=<your_port_here> to the .env file as well

Cloud Based Conversation Memory

Follow one of the below methods to setup a Griptape Cloud Structure connected to the Conversation Memory instance of your choice.

Griptape Cloud Structure and Threads Conversation Memory

Follow the link and the instructions in the README to set up the Griptape Chat Memory Agent structure. This will create your Griptape Structure ID.

GT_STRUCTURE_ID=<your-structure-id>

Griptape Cloud Structure and AWS DynamoDB Conversation Memory

Follow the link and the instructions in the README to set up the Griptape Structure Chatbot structure and CDK. This will create your AWS Lambda endpoint and Griptape Structure ID.

GT_STRUCTURE_ID=<your-structure-id>
LAMBDA_ENPOINT=<your-lambda-endpoint>

Running the Demo

If you would like to run the demo locally, then COMMENT OUT these variables in your .env.

GT_STRUCTURE_ID=
GT_CLOUD_BASE_URL=
LAMBDA_ENDPOINT=
GT_CLOUD_API_KEY=

If you would like to run the demo in a managed environment, like Skatepark or Griptape Cloud, then define these variables in your .env:

GT_STRUCTURE_ID=<YourStructureID> 
GT_CLOUD_BASE_URL=https://cloud.griptape.ai or http://127.0.0.1:5000
GT_CLOUD_API_KEY=<YourCloudAPIKey>

For the AWS DynamoDB Conversation Memory instance, add this environment variable:

LAMBDA_ENDPOINT=<YourLambdaEndpoint>

via poetry

poetry install
poetry run python app.py

via docker

docker-compose up;

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published