Insight Lang is a Python 🐍 project aimed at exploring various technologies and develop new skills. The primary goal is to create an API that leverages advanced NLP capabilities such as text translation, emotion detection, and more. To ensure easy deployment, Insight Lang will be containerized using Docker 🐳.
MIT License
Insight Lang is a Python 🐍 project aimed at exploring various technologies and develop new skills. The primary goal is to create an API that leverages advanced NLP capabilities such as text translation, emotion detection, and more. To ensure easy deployment, Insight Lang will be containerized using Docker 🐳.
This project is purely educational 📚 and open-source, intended to provide hands-on experience with modern technologies and best practices in software development 🚀.
Currently, there is no documentation for the project. However, once the project is deployed, you can access the API documentation at the following URL: http://localhost/docs
.
Create a copy of the .env.example
file and rename it to .env
. Fill in the required values for the environment variables.
Example .env
file:
# Application Variables
APP_NAME='🧠🔤 Insight Lang'
APP_VERSION='0.0.1'
# Backend Variables
BACKEND_PORT=8000
AI_MODEL='gpt-3.5-turbo'
OPENAI_API_KEY='sk-baPo...AxLP'
# Security Variables
SECRET_KEY='yoursupermegaultrasecretkey'
ACCESS_TOKEN_EXPIRATION_DELTA=15 # minutes
## Password Hashing Variables
# Specific argon2 hashing algorithm parameters https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html
HASHING_TIME_COST=20
HASHING_MEMORY_COST=47104
HASHING_PARALLELISM=1
HASHING_HASH_LENGTH=32
## Password Requirements
PASSWORD_MIN_UPPERCASE_LETTERS=2
PASSWORD_MIN_LOWERCASE_LETTERS=2
PASSWORD_MIN_DIGITS=2
PASSWORD_MIN_SPECIAL_CHARACTERS=2
PASSWORD_VALID_SPECIAL_CHARACTERS='!@#$%^&*()-_+={}[]|:;"<>,.?/ '
# Database Variables
DB_USERNAME='root'
DB_PASSWORD='root'
DB_HOST='localhost'
DB_PORT=3306
DB_NAME='database'
DB_VERSION='latest'
git clone [email protected]:adriamontoto/insight-lang.git
cd insight-lang
.env.example
file, rename it to .env
and fill it with the required values
cp .env.example .env
docker-compose up --build -d
curl "http://localhost:8000"
docker-compose down
General endpoints are available for testing the API and checking the status of the service them can be accessed at the following URL: http://localhost:8000
without any authentication.
curl "http://localhost:8000"
curl "http://localhost:8000/docs"
Authentication related endpoints can be accessed at the following URL: http://localhost:8000/auth
.
curl -X POST "http://localhost:8000/auth/login" \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "P#ssW0rd@23!"}'
>>> {"access_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJcdWQ4M2VcdWRkZTBcdWQ4M2RcdWRkMjQgSW5zaWdodCBMYW5nIiwic3ViIjoiYjZkYTE2MTMtMjMxMC00OWFiLWExNjYtOGZlOWU0NmM1NWYzIiwiYXVkIjoiYXV0aGVudGljYXRpb24iLCJleHAiOjE3MTYxNDQzNzYsImlhdCI6MTcxNjE0MzQ3Nn0.PWquMnf3n27vKswaeeeXarBmSNhoFq8rN85SPO3NEI4","token_type":"bearer"}
User related endpoints require authentication and can be accessed at the following URL: http://localhost:8000/user
.
curl -X GET "http://localhost:8000/user" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJcdWQ4M2VcdWRkZTBcdWQ4M2RcdWRkMjQgSW5zaWdodCBMYW5nIiwic3ViIjoiYjZkYTE2MTMtMjMxMC00OWFiLWExNjYtOGZlOWU0NmM1NWYzIiwiYXVkIjoiYXV0aGVudGljYXRpb24iLCJleHAiOjE3MTYxNDQzNzYsImlhdCI6MTcxNjE0MzQ3Nn0.PWquMnf3n27vKswaeeeXarBmSNhoFq8rN85SPO3NEI4"
>>> {"email":"[email protected]","creation_date":"2024-05-19T18:14:36","update_date":"2024-05-19T18:14:36"}
curl -X POST "http://localhost:8000/user/api-key" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJcdWQ4M2VcdWRkZTBcdWQ4M2RcdWRkMjQgSW5zaWdodCBMYW5nIiwic3ViIjoiYjZkYTE2MTMtMjMxMC00OWFiLWExNjYtOGZlOWU0NmM1NWYzIiwiYXVkIjoiYXV0aGVudGljYXRpb24iLCJleHAiOjE3MTYxNDQzNzYsImlhdCI6MTcxNjE0MzQ3Nn0.PWquMnf3n27vKswaeeeXarBmSNhoFq8rN85SPO3NEI4" \
-H "Content-Type: application/json" \
-d '{"name": "Development"}'
>>> {"id":"806c877c-d506-4e83-bc49-50d219a0a3d9","name":"Development","secret_key":"3eee4f8febee75400df0e3b260ee968b83e6289e7b7ecd671967aaacbce17dfd","creation_date":"2024-05-19T18:40:02","last_utilization_date":null}
AI related endpoints only require API key authentication and can be accessed at the following URL: http://localhost:8000/translate
for the translation service.
curl -X POST "http://localhost:8000/translate" \
-H "X-API-Key: 3eee4f8febee75400df0e3b260ee968b83e6289e7b7ecd671967aaacbce17dfd" \
-H "Content-Type: application/json" \
-d '{"text": "I am learning to translate texts with LLM models.", "language": "es"}'
>>> {"original_text":"I am learning to translate texts with LLM models.","text":"Estoy aprendiendo a traducir textos con modelos LLM.","language":"es"}
This project is licensed under the terms of the MIT license.