Skip to main content

HTTP client helpers for the engine matching Flask API.

Project description

Compasia_Chatbot

Setup

  1. Install dependencies:
    pip install -r requirements.txt
    
  2. Create a .env file from the provided example and add your OpenAI API key:
    cp .env.example .env
    # Then edit .env to set OPENAI_API_KEY
    

Translation endpoint

Run python gemini_shipping_flask_api.py and send a POST /translate request with JSON such as:

curl -X POST http://localhost:5050/translate \
  -H "Content-Type: application/json" \
  -d '{"text": "boleh tolong check status order saya?"}'

The API responds with the sanitized original text and an English translation derived from the configured OpenAI model. Basic HTML tags are stripped before translation to handle chat inputs that include markup, and empty prompts are rejected after cleaning. The /search endpoint also removes HTML markup, detects Malay inputs, translates them to English, and only skips translation when the request already appears to be English.

Streamlit chatbot

Run the Flask API first so the UI can delegate search and summarisation to /search:

python gemini_shipping_flask_api.py

Then launch the Streamlit UI in a separate terminal:

streamlit run streamlit_chat.py

By default, the app posts to http://localhost:5050/search. Override the endpoint with CHATBOT_SEARCH_URL if you deploy the API elsewhere. The sidebar shows the running conversation summary returned by the backend, and the conversation history stays in the session so follow-up questions include prior context.

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

engine_matching_client-0.1.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

engine_matching_client-0.1.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file engine_matching_client-0.1.0.tar.gz.

File metadata

  • Download URL: engine_matching_client-0.1.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for engine_matching_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9574c5e6f901e92e9ea86590405f8ab878a139af7597af83dbcc3e227e86b25a
MD5 356de65aee9f14ab0c112353ffd53096
BLAKE2b-256 880d43705a04aafaa37c6562190b5adaa88a33f56966354df0d749ca7559cef6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for engine_matching_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ea2c482959785e4b7abd37813d2be9198cd30e552e5679b2196dcd34ecb46b9
MD5 76f9f589005a0efa3f86439aedf5f18e
BLAKE2b-256 e8317596a0385be5bb736242743e484815893733828adc9577fa15b864e87c7e

See more details on using hashes here.

Supported by

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