This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo ss -tulpn | grep 8080 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 8082:8080 amir20/dozzle:latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo usermod -aG docker $USER |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin git -y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo \ | |
| "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] | |
| https://download.docker.com/linux/ubuntu \ | |
| $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ | |
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
| sudo apt-get update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get update | |
| sudo apt-get install ca-certificates curl | |
| sudo install -m 0755 -d /etc/apt/keyrings | |
| sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc | |
| sudo chmod a+r /etc/apt/keyrings/docker.asc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # eval.py | |
| import json | |
| from langchain.chat_models import ChatOpenAI | |
| from langchain.schema import HumanMessage | |
| judge = ChatOpenAI(model="gpt-4o", temperature=0) | |
| def judge_pair(question, answer, ref): | |
| prompt = f"""You are a strict evaluator. | |
| Q: {question} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # cache.py | |
| from hashlib import sha256 | |
| CACHE = {} | |
| def cache_key(query: str, doc_ids: list[str]) -> str: | |
| return sha256(("||".join([query] + doc_ids)).encode()).hexdigest() | |
| def get_cache(key: str): return CACHE.get(key) | |
| def set_cache(key: str, val: dict): CACHE[key] = val |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # telemetry.py | |
| import time, json, logging | |
| logging.basicConfig(filename="agent.log", level=logging.INFO) | |
| def log_event(kind: str, **kwargs): | |
| logging.info(json.dumps({"ts": time.time(), "kind": kind, **kwargs})) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # app.py | |
| import os, asyncio | |
| from fastapi import FastAPI, HTTPException | |
| from pydantic import BaseModel | |
| from rag import build_index | |
| from agent import agent_run | |
| app = FastAPI(title="Agentic AI API") | |
| # Build a tiny demo index (swap with your corpus) |
NewerOlder