Skip to content

Instantly share code, notes, and snippets.

View rajivmehtaflex's full-sized avatar
🚀
smile

Rajiv Mehta rajivmehtaflex

🚀
smile
  • Bacancy Technology
  • Ahmedabad
View GitHub Profile
@rajivmehtaflex
rajivmehtaflex / browser_ui_config.py
Created March 10, 2025 11:30
browser_use Related Notes.
#uv add browser-use
#playwright install-dep
#playwright install-deps
#playwright install
import asyncio
from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
from browser_use.browser.browser import Browser, BrowserConfig
from browser_use import Agent
@rajivmehtaflex
rajivmehtaflex / aichat_config.yml
Last active March 4, 2025 04:09
AICHAT-UTILS-DESCRIPTION
model: mistral:mistral-small-latest
clients:
- type: gemini
api_key: <KEY>
- type: openai
api_key: <KEY>
- type: openai-compatible
name: mistral
api_base: https://api.mistral.ai/v1
api_key: <KEY>
@rajivmehtaflex
rajivmehtaflex / install_rust.sh
Created January 13, 2025 09:49
Rust based Ops
#!/bin/bash
# Set errexit to exit immediately if a command exits with a non-zero status
set -e
# Print a message indicating the start of the script
echo "Starting Rust installation script..."
# Download and execute the rustup installer
echo "Downloading and executing rustup installer..."
@rajivmehtaflex
rajivmehtaflex / contemplative-llms.txt
Created January 8, 2025 04:06 — forked from Maharshi-Pandya/contemplative-llms.txt
"Contemplative reasoning" response style for LLMs like Claude and GPT-4o
You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis.
## Core Principles
1. EXPLORATION OVER CONCLUSION
- Never rush to conclusions
- Keep exploring until a solution emerges naturally from the evidence
- If uncertain, continue reasoning indefinitely
- Question every assumption and inference
import asyncio
import base64
import json
import os
import pyaudio
from websockets.asyncio.client import connect
class SimpleGeminiVoice:
def __init__(self):
@rajivmehtaflex
rajivmehtaflex / gemini_ops.md
Last active December 26, 2024 13:54
Demonstrates the use of Google's Gemini 2.0 Flash model with "thinking" output enabled, showing how the model reveals its thought process while solving a simple math problem.

File: gemini_thinking_deep.py

from google import genai
import os
os.environ['GEMINI_API_KEY'] = '<KEY>'

client = genai.Client(
    api_key=os.environ['GEMINI_API_KEY'],
    http_options={

Custom Context Provider for Continue.dev VS Code Extension

This gist demonstrates how to create a custom context provider for the Continue.dev VS Code extension using a FastAPI server. This allows you to integrate external data sources or custom logic into the Continue.dev context.

Overview

The provided code consists of two files:

  1. server.py: A Python file that sets up a FastAPI server with a single endpoint /check. This endpoint receives data in the form of a JSON object, and returns a JSON response with content and description.
  2. requirements.txt: A text file that lists the Python dependencies required to run the FastAPI server.
@rajivmehtaflex
rajivmehtaflex / Mac_os_set_default_python.md
Last active December 17, 2024 05:43
Steps to set up a fast MCP server using uv

Setting Python 3.12 as Default on macOS Sequoia 15.2

This guide explains how to set Python 3.12 as the default Python version on macOS Sequoia 15.2, so that typing python in the terminal runs Python 3.12. It also covers keeping the ability to call any Python 3.x version using python3.

Understanding the Situation

  • macOS System Python: macOS has a system Python installation at /usr/bin/python, used by the OS and should not be modified.
  • Multiple Python Versions: You likely have multiple Python versions installed, possibly via Homebrew.
  • python vs. python3: Typically, python points to an older version, while python3 specifically calls Python 3. The goal is to have python point to 3.12 while still being able to use python3 for other 3.x versions.
@rajivmehtaflex
rajivmehtaflex / aider-composer.md
Last active November 22, 2024 12:56
AI UTILITY Configuration
@rajivmehtaflex
rajivmehtaflex / HF_AS_OPENAI.py
Last active February 16, 2025 15:27
smolagents - Example
from langchain_openai import ChatOpenAI
model=ChatOpenAI(
temperature=0.5,
model='codellama/CodeLlama-34b-Instruct-hf',
base_url='https://api-inference.huggingface.co/v1/',
api_key='<KEY>'
)
response=model.invoke(input=[{"role": "user", "content": "What is color of flamingo?"}])