{"id":19998984,"url":"https://github.com/manuelro/gemini-api-langchain-pdf-summary","last_synced_at":"2025-08-02T07:12:15.084Z","repository":{"id":218224398,"uuid":"745909946","full_name":"manuelro/gemini-api-langchain-pdf-summary","owner":"manuelro","description":"This example leverage Google Gemini AI API and LangChain to summarize publicly accessible PDF documents.","archived":false,"fork":false,"pushed_at":"2024-01-28T19:14:30.000Z","size":52,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-01T23:28:55.384Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manuelro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-01-20T14:20:01.000Z","updated_at":"2024-09-29T13:41:05.000Z","dependencies_parsed_at":"2025-01-12T12:46:11.461Z","dependency_job_id":"cfe5e951-2601-4bee-bf34-bb4a47111d63","html_url":"https://github.com/manuelro/gemini-api-langchain-pdf-summary","commit_stats":null,"previous_names":["manuelro/gemini-api-langchain-pdf-summary"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/manuelro/gemini-api-langchain-pdf-summary","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelro%2Fgemini-api-langchain-pdf-summary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelro%2Fgemini-api-langchain-pdf-summary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelro%2Fgemini-api-langchain-pdf-summary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelro%2Fgemini-api-langchain-pdf-summary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manuelro","download_url":"https://codeload.github.com/manuelro/gemini-api-langchain-pdf-summary/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelro%2Fgemini-api-langchain-pdf-summary/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268348289,"owners_count":24236295,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-13T05:10:07.318Z","updated_at":"2025-08-02T07:12:15.017Z","avatar_url":"https://github.com/manuelro.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## About\nThis project demonstrates how to summarize PDF documents using artificial intelligence. Both examples use Google Gemini AI, but one uses [LangChain](https://python.langchain.com/docs/get_started/introduction) and the other one accesses [Gemini AI API](https://deepmind.google/technologies/gemini/#introduction) directly.\n\n### `geminiai-api-example.py` - Google Gemini AI API Implementation\nThis example implements Google Gemini AI API directly (using the PDF loader from LangChain for simplicity).\n\n### `langchain-example.py` - LangChain Implementation\nThis example (the default one) implements LangChain abstraction.\n\n## Installation:\n\n### Step 1: Setup Your Environment (assuming you are using MacOS)\n1. `python -m venv/venv` - Creates a new virtual environment, we will use this to store temporary API keys in a secure way.\n2. `source venv/bin/activate` - Activate the virtual environment.\n\nSee [this guide](https://docs.python.org/3/library/venv.html) if you are using other operating systems.\n\n### Step 2: Istall Dependencies and Configure Your API Key\nRun the following commands in order to install the required dependencies and configure your `GOOGLE_API_KEY`:\n\n1. `pip install -r requirements.txt` - Install the required packages.\n2. `export GOOGLE_API_KEY=\"your_google_api_key\"` - You can obtain your API key by going to [Google AI Studio](https://makersuite.google.com/app/apikey) and following the instructions.\n\n### Step 3: Run the Project\nRun one of the following commands in order to run either one of the examples:\n1. `python geminiai-api-example.py` - Optional, this uses Gemini AI API.\n2. `python langchain-example.py` - Optional, this uses LangChain.\n___\n\n### How to Tweak It\nEither is you are running the `langchain-example.py` (LangChain) or the `geminiai-api-example.py` (Gemini AI API), you simply need to modify lines `5` or `10` of each of the files if you would like to see different results in your output.\n\n___\n### Example Output for a 5 Pages PDF File\nThe output for the current PDF (which contains five pages) is as follows:\n\u003eClimate change poses risks to businesses, including physical risks like floods and droughts, price risks due to resource scarcity, product risks from shifting preferences, ratings risks from investors, regulation risks from government action, and reputation risks from public perception. Companies can adapt by forecasting scenarios, investing in resilience, and embracing sustainability.\n\n![Demo Output](https://raw.githubusercontent.com/manuelro/gemini-api-langchain-pdf-summary/master/screenshots/output.png)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanuelro%2Fgemini-api-langchain-pdf-summary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanuelro%2Fgemini-api-langchain-pdf-summary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanuelro%2Fgemini-api-langchain-pdf-summary/lists"}