mirror of
https://github.com/katanemo/plano.git
synced 2026-06-17 15:25:17 +02:00
add demo for s3
This commit is contained in:
parent
0ea237fbac
commit
6e953ad5ae
11 changed files with 217 additions and 17 deletions
3
demos/samples_python/talk_to_s3/README.md
Normal file
3
demos/samples_python/talk_to_s3/README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
This demo uses s3 public APIs to provide a chat interface to your files.
|
||||
|
||||
For this demo to work make sure you have access key and secret key for your aws account.
|
||||
71
demos/samples_python/talk_to_s3/arch_config.yaml
Normal file
71
demos/samples_python/talk_to_s3/arch_config.yaml
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
version: v0.1
|
||||
listener:
|
||||
address: 127.0.0.1
|
||||
port: 8080 #If you configure port 443, you'll need to update the listener with tls_certificates
|
||||
message_format: huggingface
|
||||
|
||||
overrides:
|
||||
optimize_context_window: true
|
||||
|
||||
endpoints:
|
||||
s3_endpoint:
|
||||
endpoint: host.docker.internal:8090
|
||||
http_host: s3.us-west-1.amazonaws.com
|
||||
|
||||
llm_providers:
|
||||
- name: OpenAI
|
||||
provider_interface: openai
|
||||
access_key: $OPENAI_API_KEY
|
||||
model: gpt-4o
|
||||
default: true
|
||||
|
||||
prompt_targets:
|
||||
- name: get_all_s3_buckets
|
||||
description: get all s3 buckets owned by me
|
||||
parameters:
|
||||
- name: max-buckets
|
||||
description: maximum number of buckets to return
|
||||
type: integer
|
||||
default: 5
|
||||
endpoint:
|
||||
name: s3_endpoint
|
||||
path: /
|
||||
system_prompt: |
|
||||
You are given an xml response with s3 buckets. Your task is to prepare a markdown with following details,
|
||||
- bucket name | creation date | region | owner
|
||||
|
||||
- name: get_s3_bucket_details
|
||||
description: get details of a bucket
|
||||
parameters:
|
||||
- name: bucket_name
|
||||
description: bucket name
|
||||
required: true
|
||||
type: string
|
||||
- name: max-keys
|
||||
description: maximum number of keys to return
|
||||
type: integer
|
||||
default: 5
|
||||
endpoint:
|
||||
name: s3_endpoint
|
||||
path: /{bucket_name}
|
||||
system_prompt: |
|
||||
Show details of a bucket. Specifically list the objects in the bucket along with their size and last modified date in a markdown table. Take following format as reference,
|
||||
- object name | size | last modified date
|
||||
|
||||
- name: get_s3_object_details
|
||||
description: get details of a specific object
|
||||
parameters:
|
||||
- name: bucket_name
|
||||
description: bucket name
|
||||
required: true
|
||||
type: string
|
||||
- name: object_name
|
||||
description: object name this could be a file or a prefix
|
||||
type: string
|
||||
required: true
|
||||
url_encode: false
|
||||
endpoint:
|
||||
name: s3_endpoint
|
||||
path: /{bucket_name}/{object_name}
|
||||
system_prompt: |
|
||||
show details of an object or a prefix
|
||||
29
demos/samples_python/talk_to_s3/docker-compose.yaml
Normal file
29
demos/samples_python/talk_to_s3/docker-compose.yaml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
services:
|
||||
chatbot_ui:
|
||||
build:
|
||||
context: ../../shared/chatbot_ui
|
||||
ports:
|
||||
- "18080:8080"
|
||||
environment:
|
||||
# this is only because we are running the sample app in the same docker container environment as archgw
|
||||
- CHAT_COMPLETION_ENDPOINT=http://host.docker.internal:10000/v1
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
volumes:
|
||||
- ./arch_config.yaml:/app/arch_config.yaml
|
||||
|
||||
jaeger:
|
||||
build:
|
||||
context: ../../shared/jaeger
|
||||
ports:
|
||||
- "16686:16686"
|
||||
- "4317:4317"
|
||||
- "4318:4318"
|
||||
|
||||
sigv4_proxy:
|
||||
image: public.ecr.aws/aws-observability/aws-sigv4-proxy:latest
|
||||
ports:
|
||||
- "8090:8080"
|
||||
environment:
|
||||
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:?error}
|
||||
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:?error}
|
||||
47
demos/samples_python/talk_to_s3/run_demo.sh
Normal file
47
demos/samples_python/talk_to_s3/run_demo.sh
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Function to start the demo
|
||||
start_demo() {
|
||||
# Step 1: Check if .env file exists
|
||||
if [ -f ".env" ]; then
|
||||
echo ".env file already exists. Skipping creation."
|
||||
else
|
||||
# Step 2: Create `.env` file and set OpenAI key
|
||||
if [ -z "$OPENAI_API_KEY" ]; then
|
||||
echo "Error: OPENAI_API_KEY environment variable is not set for the demo."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Creating .env file..."
|
||||
echo "OPENAI_API_KEY=$OPENAI_API_KEY" > .env
|
||||
echo ".env file created with OPENAI_API_KEY."
|
||||
fi
|
||||
|
||||
# Step 3: Start Arch
|
||||
echo "Starting Arch with arch_config.yaml..."
|
||||
archgw up arch_config.yaml
|
||||
|
||||
# Step 4: Start developer services
|
||||
echo "Starting using Docker Compose..."
|
||||
docker compose up -d # Run in detached mode
|
||||
}
|
||||
|
||||
# Function to stop the demo
|
||||
stop_demo() {
|
||||
# Step 1: Stop Docker Compose services
|
||||
echo "Stopping using Docker Compose..."
|
||||
docker compose down
|
||||
|
||||
# Step 2: Stop Arch
|
||||
echo "Stopping Arch..."
|
||||
archgw down
|
||||
}
|
||||
|
||||
# Main script logic
|
||||
if [ "$1" == "down" ]; then
|
||||
stop_demo
|
||||
else
|
||||
# Default action is to bring the demo up
|
||||
start_demo
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue