Gemini enables financial institutions to automate Know Your Customer (KYC) processes, analyze risk, process financial documents, and extract insights from unstructured data. This guide demonstrates practical applications using Google Search grounding for real-time information.
def screen_entity_for_negative_news( entity_name: str, entity_type: str, # "person", "company", "vessel") -> dict: """Screen entity for negative news using Google Search. Args: entity_name: Name of person, company, or vessel entity_type: Type of entity to search Returns: Screening report with findings and sources """ system_instruction = f"""You are a KYC compliance analyst specializing in adverse media screening.Your task:1. Search for negative news, scandals, sanctions, or legal issues2. Focus on credible sources (major news outlets, official records)3. Categorize findings by severity4. Provide source URLs for verification5. Distinguish between allegations and proven factsIMPORTANT:- Only report substantiated information from reliable sources- Clearly indicate when information is alleged vs. confirmed- Include publication dates for time-sensitive information- Flag any sanctions, PEP status, or criminal records """ search_tool = Tool(google_search=GoogleSearch()) prompt = f"""Conduct a comprehensive negative news screening for:Entity Name: {entity_name}Entity Type: {entity_type}Search for:1. Criminal charges or convictions2. Sanctions or watchlist mentions3. Fraud or financial crimes4. Politically Exposed Person (PEP) status5. Negative business practices6. Regulatory violations7. Corruption allegationsProvide:- Summary of findings- Risk level (Low, Medium, High, Critical)- Specific incidents with dates- Source links for each finding- Recommendations for next steps """ response = client.models.generate_content( model="gemini-2.5-flash", contents=prompt, config=GenerateContentConfig( system_instruction=system_instruction, tools=[search_tool], temperature=0, # Deterministic for compliance ), ) # Extract grounding metadata (sources) sources = [] if hasattr(response, 'candidates') and response.candidates: metadata = response.candidates[0].grounding_metadata if metadata and metadata.search_entry_point: sources = metadata.search_entry_point.rendered_content return { "entity": entity_name, "report": response.text, "sources": sources, "timestamp": datetime.now().isoformat(), }
from datetime import datetime# Screen a board candidateresult = screen_entity_for_negative_news( entity_name="John Smith, Former CEO of TechCorp", entity_type="person",)print("=== KYC SCREENING REPORT ===")print(f"Entity: {result['entity']}")print(f"Date: {result['timestamp']}")print(f"\n{result['report']}")print(f"\nSources Consulted: {len(result['sources'])}")for i, source in enumerate(result['sources'][:5], 1): print(f" {i}. {source}")
Output:
=== KYC SCREENING REPORT ===Entity: John Smith, Former CEO of TechCorpDate: 2026-03-09T10:30:00## Screening Summary**Risk Level: MEDIUM**### Findings#### 1. Securities Fraud Settlement (2022)- **Status**: Settled without admission of guilt- **Details**: SEC settlement for $2.5M related to TechCorp stock disclosures- **Source**: SEC.gov Press Release, March 15, 2022- **Impact**: Civil penalty, no criminal charges#### 2. Shareholder Lawsuit (2021-2023)- **Status**: Dismissed- **Details**: Class action regarding merger communications- **Source**: Federal Court Records, Case No. 21-CV-1234- **Outcome**: Dismissed with prejudice, no settlement#### 3. PEP Status- **Status**: Not a Politically Exposed Person- **Details**: No government positions or close associations identified#### 4. Sanctions Screening- **OFAC**: No matches- **UN Sanctions**: No matches - **EU Sanctions**: No matches### Recommendations1. **Enhanced Due Diligence**: Recommended due to SEC settlement2. **Review SEC Filing**: Examine settlement details and context3. **Reference Checks**: Contact professional references4. **Board Approval**: Disclosure of findings to full board5. **Ongoing Monitoring**: Quarterly screening for new developments### Next Steps- Schedule interview to discuss SEC matter- Request written explanation of circumstances- Consult legal counsel on board eligibility- Document decision-making processSources Consulted: 15 1. https://www.sec.gov/news/press-release/2022-45 2. https://www.reuters.com/business/techcorp-ceo-settles... 3. https://www.bloomberg.com/news/articles/techcorp-lawsuit... 4. https://www.wsj.com/articles/john-smith-sec-settlement... 5. https://pacer.uscourts.gov/case/21-CV-1234
Regulatory Compliance: Ensure your use of AI in financial services complies with relevant regulations including KYC/AML requirements, data privacy laws, and industry standards. Consult legal counsel for guidance.