Skip to content

Instantly share code, notes, and snippets.

View wsargent's full-sized avatar

Will Sargent wsargent

View GitHub Profile
package fix
import scalafix.v1._
import scala.meta._
class RewriteToStructured extends SemanticRule("RewriteToStructured") {
override def fix(implicit doc: SemanticDocument): Patch = {
doc.tree.collect {
case [email protected](Term.Select(loggerName, methodName), List(Term.Interpolate(Term.Name("s"), parts, args))) if matchesType(loggerName) =>
package com.example
import com.tersesystems.echopraxia.api.{Condition => JCondition, _}
import com.tersesystems.echopraxia.plusscala.{DefaultLoggerMethods, Logger}
import com.tersesystems.echopraxia.plusscala.api.{FieldBuilder, _}
import scala.jdk.FunctionConverters.enrichAsJavaFunction
case class Foo(name: String, age: Int)
case class Bar(name: String, age: Int)
@wsargent
wsargent / playbook.yml
Last active February 12, 2025 18:28
ansible playbook for installing Letta + Postgres + pgvector
---
- name: Install Letta Server with Docker
hosts: all
become: true
vars:
letta_data_dir: /opt/letta/data
postgres_data_dir: /opt/letta/pgdata
postgres_password: "{{ lookup('community.general.onepassword', 'letta-postgres database', field='password', vault='will-connect-vault') }}"
anthropic_api_key: "{{ lookup('community.general.onepassword', 'Anthropic API Key', field='credential', vault='will-connect-vault') }}"
mistral_api_key: "{{ lookup('community.general.onepassword', 'Mistral API Key', field='credential', vault='will-connect-vault') }}"
@wsargent
wsargent / playbook.yml
Last active March 10, 2025 15:13
pgvector install for letta
---
- hosts: all
become: true
vars:
postgres_version: "16"
postgres_password: ""
tasks:
- name: Install required packages
apt:
name:
@wsargent
wsargent / playbook.yml
Last active February 27, 2025 23:27
Ansible playbook for installing Letta with an external pgvector database
---
- name: Install Letta Server with Docker
hosts: all
become: true
vars:
letta_data_dir: /opt/letta/data
postgres_password: ""
anthropic_api_key: ""
mistral_api_key: ""
postgres_host: ""
@wsargent
wsargent / config.yaml.j2
Last active March 11, 2025 22:55
LiteLLM install with ansible playbook
# https://docs.litellm.ai/docs/proxy/configs
# https://docs.litellm.ai/docs/proxy/quickstart
model_list:
# https://docs.lambdalabs.com/public-cloud/lambda-inference-api/#listing-models
- model_name: hermes3-70b
litellm_params:
model: openai/hermes3-70b
api_key: "os.environ/OPENAI_API_KEY"
api_base: "os.environ/OPENAI_API_BASE"
@wsargent
wsargent / due_links_prompt.md
Created February 24, 2025 03:08
A prompt to show an LLM how to create timer links from https://www.dueapp.com/developer.html
@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.
@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:
"""