Skip to content

Instantly share code, notes, and snippets.

@tarasglek
tarasglek / valtown.md
Last active March 29, 2024 14:58
Searching valtown via sql, jq, jo

Searching valtown via sql, jq, jo

In a recent discussion, a useful command line pipeline was shared for querying a database and processing the results. The original command looked like this:

echo "SELECT * FROM vals WHERE lower(name) LIKE '%feed%' and lower(name) like '%email%' LIMIT 100" | jq -R '{args: [.]} ' | xargs -0 -I {} curl -X POST "https://sqlite-execute.web.val.run" -H "Content-Type: application/json" -d {} | yq -P

This command effectively queries a database for records matching certain criteria and processes the results. However, there are several ways this pipeline can be improved for efficiency and clarity.

https://www.youtube.com/watch?app=desktop&v=bXdR46em2-M&feature=youtu.be https://chatcraft.org/c/tarasglek/KdVv7Jgv6wUItzC5XordF

Navigating the Future of Search: Challenges and Innovations in Vector Databases

In the ever-evolving landscape of search technologies, vector databases have emerged as a pivotal element in enhancing the capabilities of search systems. However, as we look to the future, several challenges and opportunities for innovation present themselves.

The Next Frontier for Vector Databases

Vector databases are at the cusp of transformation. The primary challenge lies in scaling. Current systems struggle with managing and indexing the colossal datasets that modern applications demand. The goal is to make vector databases thousands of times more efficient and cost-effective to enable broader adoption across industries.

@tarasglek
tarasglek / webrtc.ts
Last active November 14, 2023 18:18
Lets one remote control a shell via webrtc using https://github.com/tarasglek/webrtc-client
class RTC {
pc;
dc;
_onMessage_cb = null;
_onConnected_cb = null;
constructor() {
this.pc = null;
this.dc = null;
}
onMessage(msg) {
/**
* This function executes clickhouse queries
* @param value Valid Clickhouse SQL query
*/
export function runClickhouseQuery(value: string) {
console.log(value)
return fetch("https://play.clickhouse.com/?user=play", {
method: "POST",
body: `${value} FORMAT Markdown`,
}).then(x => x.text());
/**
* Echo back based on https://gist.github.com/humphd/647bbaddc3099c783b9bb1908f25b64e
* @param s text to echo
*/
function echo(s:string) {
return s;
}
/* 1. Name of your function (must be unique) */
export const name = "pdf_url2markdown";
/* 2. Description of function, used to describe what it does to an LLM */
export const description = "Converts pdf links to markdown";
/**
* 3. A JSON Schema defining the function's parameters. See:
*
* - https://platform.openai.com/docs/guides/gpt/function-calling
export const name = "webrtc_shell_cmd";
export const description = "This executes shell commands over webrtc connection. It's not able to execute interactive commands like vim, prefer to use tee, etc instead";
/**
* 3. A JSON Schema defining the function's parameters. See:
*
* - https://platform.openai.com/docs/guides/gpt/function-calling
* - https://json-schema.org/learn/getting-started-step-by-step
*/
export const parameters = {
type: "object",
/* 1. Name of your function (must be unique) */
export const name = "shell_cmd";
/* 2. Description of function, used to describe what it does to an LLM */
export const description = "This executes shell commands. It's not able to execute interactive commands like vim, prefer to use tee, etc instead";
/**
* 3. A JSON Schema defining the function's parameters. See:
/**
* Example Function Module. Each function needs you to define 4 things:
*/
/* 1. Name of your function */
export const name = "turnIntoChatCraftModule";
/* 2. Description of function, used to describe what it does to an LLM */
export const description = "Exports a javascript/typescript function+docs into a chatcraft module consisting of javascript function with json-schema params";
/**
* Example Function Module. Each function needs you to define 4 things:
*/
/* 1. Name of your function (must be unique) */
export const name = "runClickhouseQuery";
/* 2. Description of function, used to describe what it does to an LLM */
export const description = "This function executes clickhouse queries";