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
| from pydantic import SecretStr | |
| import requests | |
| from pymupdf import pymupdf | |
| from langchain_text_splitters import RecursiveCharacterTextSplitter | |
| print("# 1. Load e Split do PDF") | |
| file = pymupdf.open('./doc.pdf') | |
| content = "" | |
| content += file[0].get_text("text") |
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
| import httpx | |
| MAX_TOKENS = 2048 | |
| truncated_snippets = [] | |
| print('[INFO] Reading file...') | |
| snippets = [] | |
| with open('./pacmanlog.txt', 'r') as f: | |
| snippets = f.readlines() |
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
| from langchain_core.messages import SystemMessage, HumanMessage | |
| from pydantic import SecretStr | |
| from langchain_openai import ChatOpenAI | |
| from langchain_text_splitters import RecursiveCharacterTextSplitter | |
| from typing import cast | |
| from pymupdf import pymupdf | |
| print('[INFO] Loading text...') | |
| doc = pymupdf.open('./report.pdf') |
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
| #!/bin/bash | |
| # Fix paths for crontab | |
| PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
| TARGET_DIR="/home/rubus/backups" | |
| # Error handling | |
| set -euo pipefail | |
| trap cleanup ERR SIGINT SIGTERM | |
| cleanup() { |
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
| from langchain_text_splitters import RecursiveCharacterTextSplitter | |
| from llama_cpp import Llama, CreateChatCompletionResponse | |
| from typing import cast | |
| from pymupdf import pymupdf | |
| print('[INFO] Loading text...') | |
| doc = pymupdf.open('./report.pdf') | |
| content = '' | |
| for page in doc: |
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
| -- Personal preferences | |
| vim.opt.tabstop = 4 | |
| vim.opt.shiftwidth = 4 | |
| vim.opt.softtabstop = 4 | |
| -- Other custom required stuff | |
| vim.opt.termguicolors = true | |
| -- Set <space> as the leader key | |
| -- See `:help mapleader` |
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
| [ | |
| { | |
| "model": "BAAI/bge-base-en", | |
| "sources": { | |
| "hf": "Qdrant/fast-bge-base-en", | |
| "url": "https://storage.googleapis.com/qdrant-fastembed/fast-bge-base-en.tar.gz", | |
| "_deprecated_tar_struct": true | |
| }, | |
| "model_file": "model_optimized.onnx", | |
| "description": "Text embeddings, Unimodal (text), English, 512 input tokens truncation, Prefixes for queries/documents: necessary, 2023 year.", |
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
| #include "esp32-hal-gpio.h" | |
| #include <Arduino.h> | |
| #include <WiFi.h> | |
| #include <asyncHTTPrequest.h> | |
| asyncHTTPrequest request; | |
| unsigned long lastReq = 0; | |
| const unsigned long interval = 5000; | |
| void requestCB(void* optParm, asyncHTTPrequest* request, int readyState) { |
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
| class Led { | |
| public: | |
| Led(byte pinNo) : _pinNo(pinNo), _prev(0) { | |
| pinMode(_pinNo, OUTPUT); | |
| } | |
| void update(unsigned const long interval); | |
| private: | |
| byte _pinNo; | |
| unsigned long _prev; | |
| }; |
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
| from typing import Any, cast | |
| import chainlit as cl | |
| from langchain_core.runnables import Runnable, RunnableConfig | |
| from langchain_google_genai import ChatGoogleGenerativeAI | |
| @cl.on_chat_start | |
| async def on_chat_start(): | |
| model = 'gemini-2.5-flash-lite' | |
| llm = ChatGoogleGenerativeAI(model=model) |
NewerOlder