Igor's AI Journal

A journal of random explorations in AI. Keeping track of them so I don’t get super lost

Visualization

Blog to bot

Join the discord here, and then just ‘/ask’. See the source on github Standard workflow, chunk blog -> Embedding(chunk) -> vector DB <- Retrieve <- Project Inject <- Rago this begs the Q what to chuck, and how to chunk it

Useful features:

  • ☐ Do an offline evaluation model for various retrieval approaches.
  • ☑ Give the answer
  • ☑ Link back to specific pages
  • Link back to the specific anchors
  • TBD Ask follow up questions

Open Questions

  • Does back link data help?
  • Does a smarter retrieval strategy help?
  • Play w/cRAG?

RAG Challenges

  • Some words don’t map, so terzepatide doesn’t pick up my terzeptatide blog post. Diet doesn’t match terzepatide
  • Chunk size vs relevance
  • My time off posts keep getting picked up since their template has good stuff, but content is light

Text to speech our friends

Well that was super easy, eleven labs has perfect instant voice clones, and what’s coolest is you can clone in multiple languages, so you can hear yourself talking in lots of languages. Let me give a sample

This took me about 30 minutes to setup - crazy!!

The code

RAG a psychiatrist

OK, I used to go to this psychiatrist, who had a full “consistent model” of psychiatry

here

lets see if we can simulate him, step #1, lets bring the site down into markdown

  1. Lets use https://github.com/paulpierre/markdown-crawler:
  2. pip install markdown-crawler markdown-crawler https://whatilearnedsofar.com/practice/ –output-dir ./practice

What I wrote summary

  • I tend to write a fair bit over a time span, and forget what I did. I used a simple git log stat creator to see it, but it was too simple
  • Turns, out LLMs are a great way to do this. So I wrote an app for it. It does great summaries. Inlining changes to this app as follows:

    • changes.py
    • Creation of a new Python script to handle Git diffs and summarize changes using OpenAI.
    • Major functionalities include:
      • Asynchronous retrieval of file diffs from Git using specified commit ranges.
      • Summarization of changes in files between two commits.
      • Filtering out specific files (e.g., Jupyter notebooks and back-links.json).
      • Environment setup for OpenAI API key from a secrets file.
      • Generation of prompts for OpenAI to summarize and rank changes based on impact.
      • Command-line interface implementation using Typer for user interaction.
    • Functions to interact with Git:
      • Retrieval of repository path from Git remote URL.
      • Fetching first and last commit hashes within a specified date range.
    • Obtaining a list of changed files between two commits.
    • Utilities for handling dates and generating summaries:
      • Function to calculate tomorrow’s date.
      • Prompt generation for summarizing and reordering file changes.
    • Logging and debugging setup with Loguru and PuDB.

Diary

2024-04-06

  • Containerize Bot

    • Secret Injection
    • Auto Starting
  • Retrieval

    • Better Observability
    • Better Retrieval Strategies
    • Chunk Manager Book my chapters

2024-03-24

2024-02-03

  • TL;DR: While upgrading my improv coach bot, it refused to do any coaching. I had to spend 1.5 hours adjusting the prompt till it worked.
    • When you look at the diff it looks obvious, but this stuff is alchemy groan.
  • I built an improv bot way back before openai supported function calls.
  • Of course, all the APIs broke in the last 6 months, so I decided to upgrade it.
  • Worked pretty well, about 2 hours to figure out the new spellings of things,
  • But then the model kept refusing to extend my improv story. I wasted a full hour trying to figure out how to change the prompt.
    • Pretty surprising given this was GPT-4

2024-01-27

  • OpenAI released new embedding models
  • Restarted playing with using RAG on my blog
    • Works better than before, maybe since GPT-4 is faster, and I’m using it by default now
  • Biggest challenge is how to do the document chunking. Playing around with keeping global context on chunks (hard)
  • Also building latent space search for my journal entries
    • Interesting observation here, the embedding vector is bigger than the source
    • 750 words = 750* 8 letters/chars per word = 6K bytes
    • Embedding = 3K * 4 bytes = 12K
  • I used to worry about the embedding model endpoint being leaked for my journal entries, but I think I’m now assuming OpenAI is trustworthy.
  • In theory I can search my journal corpus through 3 approaches (which I’ll blend):
    • Lexical -> regexp search
    • Semantic -> vector similarity
    • Structured -> LLM to create structure (maybe do semantic over that)

2023-11-26

  • Found content on red teaming
  • Found out new models like Orca and they are pretty darn fast on GPT4all
  • Updated my code to use the latest OpenAI models
  • Updated my code to use langchain
  • Fixed up journal to have stuff again

2023-08-17

  • Playing with Autonomous Agents
    • AutoGPT
    • GPTResearcher
    • Both of these run through docker-compose. Kind of nice as 1/ runtime sandbox, 2/ environment mess up avoidance
  • Playing with new LangChain Syntax
  • Figuring out that I can use debugger to attach so I can debug easily. Figured out how to hook all typer commands (wish I knew that earlier)

2023-07-16

2023-07-15

2023-07-04

export LANGCHAIN_WANDBB_TRACING=true
export LANGCHAIN_WANDB_TRACING=playing-around
  • Consider a better git commit message generator… Including nested calls. Checkout

https://github.com/zurawiki/gptcommit/blob/main/prompts/summarize_file_diff.tera

  • Using AI chat in co-pilot on nightlysf

Use meta -I (e.g. Alt-I) e.g. AI :)