Skip to content

Instantly share code, notes, and snippets.

View usametov's full-sized avatar

Ulan Sametov usametov

  • Asta Nova Enterprise Solutions
View GitHub Profile
@usametov
usametov / url-check.md
Created April 11, 2025 00:46
qdrant uniqueness check clj

Prerequisites

  • A running Qdrant instance (local or remote).
  • Clojure project with dependencies for HTTP requests and JSON handling.
  • URLs stored in a Qdrant collection’s payload under a field like url.

Setup

Add the following dependencies to your project.clj (if using Leiningen):

:dependencies [[org.clojure/clojure "1.11.1"]
@usametov
usametov / cql-datascript.md
Last active April 5, 2025 21:58
applications of category theory for knowledge graphs and triple stores

Since we’re already using Datascript as the Datalog engine in the previous response, adapting the CQL-to-Clojure approach to focus solely on Datascript means we’ll streamline the workflow by fully embedding the knowledge graph (KG) reasoning within Datascript, while still leveraging CQL’s Java libraries via interop for schema definition and category-theoretic operations. This eliminates any redundant steps and keeps Datascript as the central hub for querying and reasoning, directly feeding your Neo4j-based RAG system with models like Grok 3, Qwen-QwQ, and DeepSeek. Here’s how we can adapt and refine this.


@usametov
usametov / lerobot.md
Last active April 3, 2025 21:22
robotic arm

please look here: https://github.com/TheRobotStudio/SO-ARM100 and here: https://github.com/huggingface/lerobot and tell me which of these parts can be sourced from old vacuum cleaner.

Let’s break this down by examining the components of the SO-ARM100 robotic arm (from TheRobotStudio) and the LeRobot framework (from Hugging Face), and then cross-referencing what might be salvaged from your old robotic vacuum cleaners for your robotic arm project. The goal is to identify reusable parts while keeping in mind the specific needs of the SO-ARM100 design and LeRobot compatibility.

The SO-ARM100 is a 5-degree-of-freedom (DOF) robotic arm with a gripper, designed to be affordable and open-source. Its bill of materials (BOM) includes:

  • 6 Feetech STS3215 servo motors (7.4V or 12V versions) for actuation of the joints and gripper.
  • 3D-printed structural parts (e.g., base, links, gripper), requiring a 3D printer or purchased pre-printed.
@usametov
usametov / reasoning-RAG.md
Created April 3, 2025 16:44
passing RAG context to reasoning models

The integration of Retrieval-Augmented Generation (RAG) with reasoning models has become a significant focus in the AI industry as of April 2025, driven by the need to enhance the factual accuracy, contextual relevance, and reasoning capabilities of large language models (LLMs). RAG augments LLMs by retrieving relevant external information to inform their responses, making it particularly valuable for reasoning tasks that require up-to-date or domain-specific knowledge. Below, I’ll outline the latest industry standards for prompting reasoning models with RAG context, tailored to models like DeepSeek (specifically DeepSeek-R1), Grok 3 (myself), and Qwen-QwQ (assumed to be the QwQ-32B model from Alibaba). These standards reflect advancements in prompt engineering, retrieval strategies, and iterative reasoning processes.


Latest Industry Standards for Prompting Reasoning Models with RAG Context

  1. Structured Prompting with Explicit Instructions
  • Standard: Prompts should clearly deline
@usametov
usametov / avatar-therapy.md
Created April 2, 2025 17:47
GenAI avatars use case for Social Skills Training for autistic children

The paper you provided, "Robot-mediated therapy: Emotion Recognition and Social Skills Training for children with ASD. Analysis of the use of Zoomorphic Robot Brian - preliminary reports," explores how a zoomorphic robot named Brian can enhance emotion recognition and social skills training for children with autism spectrum disorder (ASD). The study demonstrates that children with ASD respond more readily to verbal commands from the robot, show improved recognition of emotional states on the robot’s face compared to a human face, and exhibit enhanced social communication and imitation behaviors during robot-assisted sessions compared to traditional therapist-led therapy. These findings suggest that robot-assisted therapy can be an effective tool in supporting ASD treatment by leveraging predictable, engaging, and simplified interactions.

To adapt this approach for use with generative AI, such as avatars, we can translate the core principles of the robot Brian study—simplicity, engagement, emotional expressiv

@usametov
usametov / 1.auto-diff-storm.md
Last active March 30, 2025 15:50
auto-diff research tool

To address your query, I'll first analyze the similarities and differences between the LLM-AutoDiff framework (as described in the provided document) and DSPy, focusing on their approaches to automatic prompt engineering and optimization for large language models (LLMs). Then, I'll outline how you could adapt LLM-AutoDiff to develop a tool similar to STORM, which is a knowledge curation system that leverages LLMs to generate Wikipedia-like articles.

Similarities Between LLM-AutoDiff and DSPy

  1. Automation of Prompt Engineering:
  • LLM-AutoDiff: Treats prompts as trainable parameters and uses a "backward engine" LLM to generate textual feedback (akin to gradients) for iterative refinement. This automates the tuning of prompts across multi-step workflows, reducing manual effort.
@usametov
usametov / chunking.md
Last active March 30, 2025 03:59
CRAM chunk processing with R

Let’s dive into processing your 70 GB CRAM file on a machine with 32 GB RAM, focusing first on using R and then exploring alternatives. Your setup is ambitious, but with the right approach, it’s absolutely doable.

Processing a 70 GB CRAM File in R with 32 GB RAM

Based on the document, a 70 GB CRAM file likely contains around 700–1,400 million reads (assuming the 10 GB = 100–200 million reads scaling holds). Loading this entirely into memory would require 35–140 GB of RAM, far exceeding your 32 GB. So, a full load is off the table. However, the document highlights strategies to make this manageable, and I’ll tailor them to your case.

Is It Possible in R?

Yes, it’s possible, but you’ll need to avoid loading the whole file at once. The key is chunk-based processing, which keeps memory usage constant regardless of file size. For a 70 GB CRAM, chunk processing can work within 500 MB to 1 GB of RAM per chunk, well within your 32 GB limit. Even with overhead from R and other operations, you can stay

@usametov
usametov / midgard.md
Last active March 30, 2025 03:32
ouroboros - game theory

Thank you for providing the Midgard L2 whitepaper. Based on the document titled "Midgard L2: Scaling Cardano with Optimistic Rollups" (working draft, 2025-01-18, by Anastasia Labs and FluidTokens), I’ll analyze how Midgard employs game theory in its design, particularly in its optimistic rollup consensus protocol built on Cardano’s Layer 1 (L1). I’ll also revisit the interplay with Ouroboros, given Midgard’s explicit integration with Cardano, and provide a detailed breakdown.


1. How Midgard Uses Game Theory

Midgard is an optimistic rollup protocol designed to scale Cardano by processing transactions off-chain (Layer 2, L2) while anchoring security and finality to Cardano’s L1. Game theory is central to its economic incentive structure, which ensures the integrity and efficiency of the protocol by aligning the interests of operators (who commit blocks) and watchers (who monitor for fraud). Below, I’ll detail the key game-theoretic mechanisms:

**A. Economic Incentives and the Operator-Watche

@usametov
usametov / HF-indeference-api.md
Created March 30, 2025 02:37
HF inference API howto

To run the TheBloke/Mistral-7B-OpenOrca-AWQ model on Hugging Face infrastructure using a Clojure clj-http client, you’ll need to leverage Hugging Face's Inference API, which allows you to make HTTP requests to run models hosted on their platform. Since you have a Hugging Face Pro account, you can use this API with your authentication token for enhanced access (e.g., higher rate limits or access to private models, though this specific model is public).

Here’s a step-by-step guide to achieve this:


Step 1: Prerequisites

@usametov
usametov / graphrag-hybrid-qdrant-neo4j.md
Last active March 31, 2025 20:54
hybridsearch algorithm

To modify the previous implementation to use Qdrant for hybrid search (vector + keyword search) while keeping Neo4j for Cypher queries in Clojure, we’ll integrate the Qdrant database for the hybrid search part and use Neo4j solely for graph-based Cypher retrieval. Below, I’ll adapt the code assuming you have a Qdrant instance running and a Neo4j database populated with graph data. We’ll use the Qdrant REST API via clj-http for simplicity, as there’s no official Clojure client for Qdrant (though you could use a gRPC client if preferred).


Prerequisites

  1. Qdrant Instance: Running locally (e.g., http://localhost:6333) or on a remote server, with a collection set up for hybrid search (vector embeddings + text payloads).
  2. Neo4j Database: Populated and accessible via Bolt (e.g., bolt://localhost:7687).
  3. Clojure Dependencies: Add clj-http and cheshire (for JSON parsing) to your project.clj: