Skip to content

Instantly share code, notes, and snippets.

View wsargent's full-sized avatar

Will Sargent wsargent

View GitHub Profile
### Task:
Respond to the user query using the provided context, incorporating inline citations in the format [source_id] **only when the <source_id> tag is explicitly provided** in the context.
### Guidelines:
- If you don't know the answer, clearly state that.
- If uncertain, ask the user for clarification.
- Respond in the same language as the user's query.
- If the context is unreadable or of poor quality, inform the user and provide the best possible answer.
- If the answer isn't present in the context but you possess the knowledge, explain this to the user and provide the answer using your own understanding.
- **Only include inline citations using [source_id] when a <source_id> tag is explicitly provided in the context.**
@wsargent
wsargent / jupyter_lab_config.py.j2
Last active March 14, 2025 03:09
Ansible playbook for installing Jupyter with miniconda and notebook_intelligence
---
- name: Provision JupyterLab on a VM
hosts: all
become: yes
vars_files:
- vars/main.yml
pre_tasks:
- name: Install system dependencies
import_tasks: tasks/system_deps.yml
import json
import requests
import os
# https://schema.org/Recipe
def create_recipe_from_arguments(name: str,
directions: str,
ingredients: str,
author: str = "",
cook_time: str = "10m",
@wsargent
wsargent / read_mealplans.py
Created March 1, 2025 21:30
Read meal plans from Mealie
import requests
import datetime
import json
import os
def read_mealplans(start_date: str = None, end_date: str = None):
"""
Reads the meal plans from Mealie and returns it as a string.
Parameters
@wsargent
wsargent / update_recipe_categories.py
Created March 1, 2025 21:28
Update recipe categories in Mealie
import re
import requests
import os
import json
import logging
#logging.basicConfig(level=logging.DEBUG)
def update_recipe_categories(recipe_slug: str, categories_csv: str) -> None:
@wsargent
wsargent / add_recipe_note.py
Created March 1, 2025 21:28
Adds a note to recipe in mealie.
import re
import requests
import os
import json
def add_recipe_note(recipe_slug: str, note_title: str, note_text:str) -> None:
"""
Appends a new note to the given recipe in Mealie.
@wsargent
wsargent / update_recipe_tags.py
Created March 1, 2025 21:26
Update recipe tags in Mealie
import re
import requests
import os
import json
def update_recipe_tags(recipe_slug: str, tags_csv: str) -> dict:
"""
Updates a recipe in Mealie with the given tags.
Parameters
@wsargent
wsargent / get_recipe_in_mealie.py
Created March 1, 2025 21:26
Get recipe in mealie
import requests
import os
from urllib.parse import urljoin
def get_recipe_in_mealie(slug: str):
"""
Get a recipe from Mealie using its slug. This returns ingredients and instructions on the recipe.
Parameters
@wsargent
wsargent / find_recipes_in_mealie.py
Last active March 3, 2025 23:08
Find recipes in mealie
import requests
import os
from urllib.parse import urljoin
def find_recipes_in_mealie(
searchTerm: str,
categories_csv: str = None,
tags_csv: str = None) -> str:
"""
@wsargent
wsargent / add_recipe_to_mealie_from_url.py
Created March 1, 2025 21:00
Letta function to add recipe to Mealie.
import requests
import os
def add_recipe_to_mealie_from_url(recipe_url: str, include_tags: bool=False):
"""
Adds a recipe to Mealie from a URL of a cooking website containing the recipe.
Use this function when you have found a recipe using Tavily and have the URL or the user has
shared a recipe URL.