--- title: INSPIRE HEP Search emoji: ⚛️ colorFrom: blue colorTo: green sdk: gradio sdk_version: "5.8.0" app_file: app.py pinned: false --- This code creates a web interface using Gradio that combines INSPIRE HEP (High Energy Physics) database searches with AI-powered responses. Here's what it does: Search Enhancement: Takes a user query and uses GPT-4 to expand it into multiple relevant search variations Searches the INSPIRE HEP database using these expanded queries Example: "how far are black holes?" gets expanded into multiple variations like "distance from black holes", "remoteness of black holes", etc. Result Processing: Retrieves academic papers from INSPIRE HEP Formats the paper metadata including authors, year, title, and DOI Creates a context from the papers' titles and abstracts AI Answer Generation: Uses GPT-4 to generate a comprehensive answer based on the search results Citations are included in the format [1], [2], etc. Cleans up and renumbers the references to match only the cited papers Provides a summary at the end of each answer