Skip to content

axenzen/claudesearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

claudesearch

English documentation below

Prototyp für ein VuFind-basiertes Recherchesystem, das die eingegebenen Begriffe von einem LLM zu einem von zwei Suchtypen zuordnen lässt: Einer Known-Item-Suche, die über Kombinationen aus Nachnamen und Titelstichwörtern oder ID-Nummern identifziert wird, und thematische Anfragen. Je nach Ergebnis der Analyse werden unterschiedliche Parameter an VuFind übergeben.

Zusätzlich kann eine Checkbox ausgewählt werden, mit der zu dem eingegebenen Suchbegriff Grundlagenliteratur gefunden wird. Dafür wird der Suchbegriff kombiniert mit einer veroderten Menge an typischen Titelstichwörtern (Handbuch, Textbook, Einführung...)

Entwickelt mit Cursor.

Demo unter: https://youtu.be/keNoyD0pskY

Realisiert über eine VuFind-API nach diesem Schema https://github.com/vufind-org/vufind/blob/dev/config/vufind/SearchApiRecordFields.yaml

LLM: claude-3-opus-20240229 über Anthropic VuFind-Index: HCU Testing (nur intern bei eWW)

Credits: Für Inspiration: Ralf Stockmann: https://github.com/rstockm

Für Geduld sowie moralische & technische Unterstützung: Johannes Schultze: https://github.com/jschultze

English Documentation

Server.js Documentation

Overview

This server implements a search interface that connects to a VuFind-based library catalog system. It uses Claude AI to analyze search queries and determine the appropriate search type.

Main Components

Search Types

The system supports three different search types:

  1. Known-Item Search

    • Used when searching for specific books/items
    • Searches in Title field
    • Sorts results by year
    • Identified by combinations of author names and title keywords or ID numbers
  2. Topic Search

    • Used for thematic queries
    • Searches in title and subjects fields
    • Sorts by relevance
    • Can include alternative search terms generated by Claude
  3. Basics Search

    • Activated via checkbox in frontend
    • Combines user's search term with predefined basic literature terms
    • Searches only in titles
    • Filters for physical books only (format:"Book")
    • Sorts by year
    • Uses terms like "Introduction", "Handbook", "Textbook", etc.

API Integration

VuFind API

  • Base URL: [...vufind/api/v1/]
  • Implements standard VuFind search API parameters
  • Returns JSON responses with bibliographic data

Claude AI Integration

  • Uses Claude 3 Opus for query analysis
  • Determines search type based on input
  • Can generate alternative search terms
  • Provides structured analysis results

Search Parameters

  • Default limit: 20 results per page
  • Standard fields included in results:
    • title
    • authors
    • formats
    • publicationDates
    • publishers
    • languages
    • summary
    • subjects

Key Functions

analyzeSearchQuery(searchTerm)

Sends the search term to Claude for analysis and returns structured results including:

  • searchType
  • mainSearchTerm
  • potentialAuthor
  • potentialTitle
  • alternativeSearchTerm

Search Request Handler

The main POST endpoint /api/search processes search requests by:

  1. Receiving search term from frontend
  2. Getting analysis from Claude (unless basics search is forced)
  3. Building appropriate VuFind API query based on search type
  4. Fetching and returning results

Error Handling

  • Includes comprehensive error logging
  • Returns formatted error messages to frontend
  • Handles API response errors
  • Validates search parameters

Environment Requirements

  • Requires Claude API key in .env file
  • Needs access to VuFind API endpoint
  • Node.js environment

About

Searching a VuFind installation with assistance from a LLM (Claude)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published