Skip to content

Instantly share code, notes, and snippets.

@smrati
smrati / opencode.json
Created October 4, 2026 10:49
customize opencode model list and mcp integration
{
"$schema": "https://opencode.ai/config.json",
"model": "<remote_provider>/<default-model>",
"provider": {
"llama_cpp": {
"models": {
"<local-gguf-model>.gguf": {
"_launch": false,
"name": "<local-gguf-model>.gguf",
"limit": {

How Do I Add Local OpenAI-Compatible Models (Ollama, vLLM, LM Studio) to Pi?

Pi connects to any local OpenAI-compatible server by adding a providers entry to ~/.pi/agent/models.json — you give it a baseUrl (the server's /v1 endpoint), an api type (openai-completions for the chat-completions API), a throwaway apiKey, and a list of model ids. No extension, no OAuth; local servers ignore the key, it just has to be present so pi marks the model "available" in /model.

A simple view

  pi session                                  your machine
   ┌──────────────┐   models.json says:      ┌─────────────────────────────┐
   │              │   "ollama →              │ ollama serve    :11434 /v1  │

Code Is the Source of Truth

When answering questions about how software in the current workspace actually behaves (runtime, configuration, APIs, CLI, builds, tests, deployment, or infrastructure), treat the current repository artifacts as the primary source of truth.

Prioritize evidence roughly in this order:

  1. Executable source and configuration

    • Application source
  • Scripts
@smrati
smrati / xml2json.py
Created February 4, 2026 14:02
xml to json convertor
import xmltodict
import json
import os # Import os module
def read_xml_to_dict(file_path):
"""
Reads an XML file and converts it into a Python dictionary.
Args:
file_path (str): The path to the XML file.
@smrati
smrati / kg_prompt_generator.html
Created January 24, 2026 11:11
Advanced KG Prompt Generator
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Advanced KG Prompt Generator</title>
<style>
:root {
--primary: #667eea;
@smrati
smrati / ollama_faiss.py
Last active October 31, 2024 07:53
ollama embeddings + FAISS
from langchain_community.embeddings import OllamaEmbeddings
import faiss
import numpy as np
# Initialize Ollama embeddings model
embedding_model = (
OllamaEmbeddings(model="llama3.2:3b")
)
# Sample sentences
@smrati
smrati / chromaConnect.py
Created October 25, 2024 11:37
ChromaDB + Glove Embeddings : Create a text search engine
import chromadb
from loguru import logger
class ChromaHelper:
def __init__(self, host, port):
self.host = host
self.port = port
self.chroma_client = None
@smrati
smrati / globe_based_text_retrieval.py
Created October 24, 2024 17:09
Glove embeddigs text retrival
import numpy as np
import re
from sklearn.metrics.pairwise import cosine_similarity
# Load GloVe embeddings
def load_glove_embeddings(glove_file):
embeddings_index = {}
with open(glove_file, 'r', encoding='utf-8') as f:
for line in f:
@smrati
smrati / wordle_helper.py
Created January 30, 2022 08:41
wordle solver: brute force
class wordle:
def __init__(self, input_data_path):
self.input_data_path = input_data_path
def get_path(self):
print(self.input_data_path)
def get_words_by_len(self, word_length):
"""
filter words of specific length
@smrati
smrati / multiple_ssh_setting.md
Created August 9, 2020 19:08 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"