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 dotenv import load_dotenv | |
| from pydantic import BaseModel, Field | |
| from pydantic_ai import Agent as PydanticAgent | |
| from pydantic_ai.models import ModelSettings | |
| from pydantic_ai.models.openai import OpenAIChatModel | |
| from pydantic_ai.profiles.openai import OpenAIModelProfile | |
| from pydantic_ai.providers.openai import OpenAIProvider | |
| # to make Context-aware tools (need agent state, memory, deps) |
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
| configure wifi on ubuntu server: | |
| need to update the yaml key-value pair: | |
| check if it exists: | |
| >> ls -l /etc/netplan/50-cloud-init.yaml | |
| update: | |
| >> sudo nano /etc/netplan/50-cloud-init.yaml |
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 | |
| from pprint import pprint | |
| from dotenv import load_dotenv | |
| from openai.types import CreateEmbeddingResponse | |
| _ = load_dotenv("../.env") | |
| from openai import ( | |
| OpenAI, APIError, RateLimitError, APITimeoutError, APIConnectionError, ChatCompletion, | |
| ) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 os | |
| import numpy as np | |
| from databricks.vector_search.client import VectorSearchClient | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| DATABRICKS_WORKSPACE_URL = os.getenv("DATABRICKS_WORKSPACE_URL") | |
| access_token_dbx = os.getenv("access_token_dbx") | |
| VECTOR_SEARCH_ENDPOINT = os.getenv("VECTOR_SEARCH_ENDPOINT") |
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
| ## set postgres data folder: | |
| 1. set env PGDATA = "C:/Development/psql_data" | |
| 2. RUN | |
| go inside bin folder of postgres and RUN | |
| initdb -D %PGDATA% | |
| ## create user | |
| > createuser.exe -U <ROLE> --superuser --pwprompt <USERNAME> |
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 concurrent.futures | |
| import collections | |
| import threading | |
| import time | |
| import random | |
| from fastapi import FastAPI, BackgroundTasks | |
| from fastapi.responses import JSONResponse | |
| t_pool = concurrent.futures.ThreadPoolExecutor(max_workers=3) |
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 json | |
| import socket | |
| def parse_http_request(request): | |
| headers, _, body = request.partition("\r\n\r\n") | |
| request_line = headers.splitlines()[0] | |
| method, path, _ = request_line.split() | |
| return method, path, headers, body | |
| server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
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
| version: '3' | |
| services: | |
| zookeeper: | |
| # image: confluentinc/cp-zookeeper:latest | |
| image: bitnami/zookeeper:3.9 | |
| container_name: zookeeper | |
| ports: | |
| - "2181:2181" | |
| environment: | |
| ALLOW_ANONYMOUS_LOGIN: 1 |
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
| # gunicorn -w 2 -k uvicorn.workers.UvicornWorker main:app --max-requests 100 --max-requests-jitter 10 --threads 5 | |
| # .......................................................................................... | |
| import asyncio | |
| import os | |
| import logging | |
| # from asyncio.log import logger | |
| from time import sleep |
NewerOlder