{"id":16201254,"url":"https://github.com/mjunaidca/travel-ai-service","last_synced_at":"2025-06-12T11:34:08.724Z","repository":{"id":213436551,"uuid":"732574031","full_name":"mjunaidca/travel-ai-service","owner":"mjunaidca","description":"A fun AI Powered Traveling Assistant that annotates map and help in planning travel trips","archived":false,"fork":false,"pushed_at":"2023-12-28T13:51:55.000Z","size":575,"stargazers_count":19,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T23:51:17.030Z","etag":null,"topics":["ai","ai-travel-planner","docker","gpt-4","nextjs14","openai-api","openai-api-chatbot","openai-api-python","streamlit","travel"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mjunaidca.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-17T05:57:21.000Z","updated_at":"2025-02-15T11:56:12.000Z","dependencies_parsed_at":"2023-12-28T14:41:14.064Z","dependency_job_id":null,"html_url":"https://github.com/mjunaidca/travel-ai-service","commit_stats":null,"previous_names":["mjunaidca/travel-ai-service"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mjunaidca/travel-ai-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjunaidca%2Ftravel-ai-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjunaidca%2Ftravel-ai-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjunaidca%2Ftravel-ai-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjunaidca%2Ftravel-ai-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mjunaidca","download_url":"https://codeload.github.com/mjunaidca/travel-ai-service/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mjunaidca%2Ftravel-ai-service/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259456091,"owners_count":22860484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-travel-planner","docker","gpt-4","nextjs14","openai-api","openai-api-chatbot","openai-api-python","streamlit","travel"],"created_at":"2024-10-10T09:36:43.601Z","updated_at":"2025-06-12T11:34:08.611Z","avatar_url":"https://github.com/mjunaidca.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Travel Assistant Complete MicroService\n\n- FastAPI Backend To Manage and Scale Microservice\n   - Geminin Pro Function Calling Streaming API\n   - OpenAI Assistants API\n- A Simple NextJS 14  Frontend to test your MVP\n- For python geeks a Streamlit Frontend to test your MVP\n- Pydanitc and SQLAlchemy ORM to Save and Update Client Chat in Neon Postgress Database\n\nNote: To locally run Gemini API Endpoints first setup your google vertex ai account\n```https://cloud.google.com/sdk/docs/initializing```\nThis Travel Assistant Application is designed to test complete Generative AI Applications Scalable Architecture. \n\nWe have extensively explored gemini pro function calling, and open ai dev day features. The services are developed using FastAPI framework and the Frontend frontier is powered with NextJS 14 as well as streamlit for pure python devs.\n\nThe AI Powered Maps are powered with \"Google Maps javascript API\" for NextJS and \"Plotly with MapBox\" for streamlit.\n\nIn this video I have walkthrough the overall architecture and gemini pro streaming api pipeline, and function calling architecture.\n\n[\u003cimg src=\"https://img.youtube.com/vi/qas4aLEkXTk/hqdefault.jpg\" width=\"580\" height=\"360\"\n/\u003e](https://www.youtube.com/embed/qas4aLEkXTk)\n\n## Features\n\n1. Open AI Assistants API Implementation\n2. GEMINI STREAMING \u0026 FUNCTION CALLING Implementation\n\ngemmini =\u003e fastapi backend =\u003e nextjs frontend (fully streamed response)\n\n- Interactive map to explore travel destinations.\n- Real-time data fetching and display using FastAPI.\n- Easy-to-navigate user interface with Streamlit.\n\n## Locally Run the Project\n\n## Option 1: Run on The Machine\n\n### A. Installation\n\nClone the repository to your local machine:\n\n### B. Environment Variables Setup\n\nRename .env.template to .env and add your API Keys and Database URLs there. Create an issue or feel free to message me if you face any issue while setting up the application\n\n### C. Setup and Running FastAPI Backend Service\n\nInstall the required Python packages:\n\n1. Go to the `backend -\u003e src` directory.\n\n```\npip install -r requirements.txt\n```\n\n2. Start the FastAPI server by running:\n\n   ```\n   uvicorn main:app\n   ```\n\n   Test the backend directly by making following POST request in PostMan or any API testing software.\n\n   `http://localhost:8000/travel_assistant?prompt=\"Share 2 places to visit in UAE\"`\n\nEnsure that both the frontend and backend services are running simultaneously for the application to function properly.\n\n### D.  Streamlit Frontend\n\n1. Navigate to the streamlit directory containing `app.py`.\n2. Run the Streamlit application using the following command:\n   ```\n   streamlit run app.py\n   ```\n\nAccess the frontend at: `http://localhost:8501/`\n\n\n### E. NextJS Frontend\n\nGo to nextjs dir, run pnpm install and the pnpm dev\n\n## Option 2: Run on Docker\n\nPull te docker images and run there\n\n## Usage\n\nWith both the frontend and backend services running, access the Streamlit application in your web browser and interact with the travel assistant's features.\n\n## Containorization \u0026 Deployment\n\n### 1. Backend - Create Docker image and Deplpoy on Google Cloud Run\n\nLet's create a docker image first and run the frontend using a container running from this image.\n\nNext we will push the image and deply our backend on Google Run\n\n1. Build Docker Image\n\n`docker build -t travel_ai_service .`\n\nFor Mac M2 Users use this command instead: `docker buildx build --platform linux/amd64 -t \u003cImage Name\u003e .`\n\n2. View your Image\n\ndocker images\n\n3.  Run the Contianer for thus Image\n\n```\ndocker run --env-file .env  -d --name 2bd90a3c026f -p 80:80 travel_ai_assistant\n```\n\n4.  Tag Your Image and Push it on Docker Hub\n\n```\ndocker tag travel_ai_assistant mjunaidca/travel_ai_assistant:latest\n```\n\n```\n docker push mjunaidca/travel_ai_assistant:latest\n```\n\n5. Deply your service on Google Cloud\n\nThrough Cli\n\n```\n gcloud run deploy ai-travel-assistant --image mjunaidca/travel_ai_assistant:latest\n```\n\nThen Go to Google Cloud and Click on \"Edit \u0026 Deply New Revision\"\n\nAdd your Environment Variables and change the port from 8080 to 80 (this is what we configured in dockerfile).\n\nOr you can directly visit Google Run and click on Create a Service. Fill in the details to deploy your docker image\n\n6. Now Get your Google Deplyment URL and replace streamlit localhost:8000 port backend calls with it.\n\nFirstly past the url in browser and you will see \"\"top here\"\" text. Next repalce it with streamlit\n\n### 1 B. Backend V1 - Gemini Streaming Update\n\nGet your Google Cloud Project Service API Keys. Download them in json format and\nstore in the backend directory.\n\nWe pass them at runtime after building image to run the container locally.\n\nAlways include them in .gitignore and .dockerignore. ,I accidently exposed them docker hub before ***\n\n1. Build Docker Image\n\n`docker build -t travel_ai_service .`\n\nFor Mac M2 Users use this command instead: \n```\n docker buildx build --platform linux/amd64 -t mjunaidca/travel_ai_assistant:v1 .\n ```\n\n2. View your Image\n\ndocker images\n\n3.  Run the Contianer for thus Image\n\n```\n docker run --env-file .env -d --name travel_ai_assistant -p 80:80 -v /Users/mjs/Documents/GitHub/genai_fastapi/travel_ai_service/backend/travel-ai-gauth.json:/app/travel-ai-gauth.json -e GOOGLE_APPLICATION_CREDENTIALS=/app/travel-ai-gauth.json mjunaidca/travel_ai_assistant:v1```\n\n4.  Test Locally and then Push it on Docker Hub\n\nIs API Working?\nhttp://localhost:80\n\nAre Gemini Endpoints Working?\nhttp://localhost/gemini_streaming_travel_ai/?query=%22hello%22\nhttp://localhost/gemini_streaming_travel_ai/mapstate\n\n\nFor OpenAi it's Post request using postman\n\nhttp://localhost:80/travel_assistant/?prompt=\"Share 2 places to visit in UAE\"\n\n```\n docker push mjunaidca/travel_ai_assistant:v1\n```\n\n5. Deply your service on Google Cloud\n\nThrough Cli\n\n```\n gcloud run deploy ai-travel-assistant --image mjunaidca/travel_ai_assistant:latest\n\nThen Go to Google Cloud and Click on \"Edit \u0026 Deply New Revision\"\n\nAdd your Environment Variables and change the port from 8080 to 80 (this is what we configured in dockerfile).\n\nOr you can directly visit Google Run and click on Create a Service. Fill in the details to deploy your docker image\n\n6. Now Get your Google Deplyment URL and replace streamlit localhost:8000 port backend calls with it.\n\nFirstly past the url in browser and you will see \"\"top here\"\" text. Next repalce it with streamlit\n\n\n### 2. Stream - Simple deply on Streamlit Cloud\n\n### 3. NextJs - Create Docker image and Deplpoy on Google Cloud Run\n\nWhy not vercel: Vercel default inocation timeout is 10.01 seconds. Using edge we can increase it to 25 seconds and on top of it using streaming we can increase to to infinite time.\n\nHere average response time with function calling is 30-40s so my plan is to dockerize and deply this on google cloud as well.\n\n```\ndocker buildx build --platform linux/amd64 -t nextjs_travel_ai .\n\ndocker images\n\ndocker run --env-file .env -d --name 4f04288c45a8 -p 3000:8000 nextjs_travel_ai\n\nverify the containor is running and no error occured\n\ndocker ps\n\ndocker tag nextjs_travel_ai mjunaidca/nextjs_travel_ai:latest\n\ndocker push mjunaidca/nextjs_travel_ai:latest\n\ngcloud run deploy nextjs-travel-ai --image mjunaidca/nextjs_travel_ai:latest\n```\n\n## Contributing\n\nContributions to this project are welcome. To contribute:\n\n1. Fork the repository.\n2. Create a new branch (`git checkout -b feature-branch`).\n3. Make your changes and commit them (`git commit -am 'Add some feature'`).\n4. Push to the branch (`git push origin feature-branch`).\n5. Create a new Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.\n\n## Contact\n\nFor any additional questions or comments, please contact the project maintainers.\n\n---\n\nEnjoy exploring the world with the Travel Assistant Application!\n\n---\n\nEnjoy your virtual travel assistant experience!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjunaidca%2Ftravel-ai-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmjunaidca%2Ftravel-ai-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmjunaidca%2Ftravel-ai-service/lists"}