Skip to content

A Python/Prolog project for generating and validating sandwich recipes using LLMs, semantic embeddings, and logic programming. Demonstrates a simple neurosymbolic pipeline.

Notifications You must be signed in to change notification settings

erno-szabados/wichdoctor

Repository files navigation

Wich Doctor

A Python/Prolog project for generating and validating sandwich recipes using LLMs, semantic embeddings, and logic programming. Demonstrates a simple neurosymbolic pipeline.

Code generated by GPT-4.1, refined manually.

Features

  • Generates sandwich ideas using Google Gemini LLM.
  • Canonicalizes ingredients with semantic similarity (embeddings).
  • Validates sandwich combinations using Prolog rules.
  • Ingredients and rules are managed from a shared YAML file.
  • Embedding caching for efficiency.

Requirements

  • Python 3.8+
  • Prolog (GProlog or SWI-Prolog)
  • Google GenerativeAI Python SDK
  • NumPy, PyYAML, pyswip

Usage

  1. Set your GOOGLE_API_KEY environment variable.
  2. Install dependencies: pip install -r requirements.txt
  3. Run: python main_wich_doctor.py

Project Structure

  • main_wich_doctor.py — Main application logic
  • ingredients.yaml — Ingredient knowledge base
  • wich_doctor.pl — Auto-generated Prolog facts
  • canonical_embeddings.npy — Cached embeddings

License

MIT License

Copyright (c) 2025 Erno Szabados

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A Python/Prolog project for generating and validating sandwich recipes using LLMs, semantic embeddings, and logic programming. Demonstrates a simple neurosymbolic pipeline.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published