Examples with Redis Vector and ChromaDB
Embeddings via ru-en-RoSBERTa https://huggingface.co/ai-forever/ru-en-RoSBERTa
Examples with Redis Vector and ChromaDB
Embeddings via ru-en-RoSBERTa https://huggingface.co/ai-forever/ru-en-RoSBERTa
| MIT License | |
| Copyright (c) 2026 mahenzon | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: |
| class A: | |
| def __init__(self, val): | |
| self.val = val | |
| def __hash__(self): | |
| return hash(self.val) | |
| def __str__(self): | |
| return str(self.val) |
| """ | |
| Based on https://github.com/tough-dev-school/education-backend/blob/master/src/core/services.py | |
| """ | |
| from abc import ABC, abstractmethod | |
| from collections.abc import Callable, Sequence | |
| from typing import Any, Generic, TypeVar | |
| ReturnType = TypeVar('ReturnType') |
| """ | |
| Suggestion for implementing | |
| https://github.com/redis/redis-py/pull/3619 | |
| Try it here: | |
| https://mypy-play.net/?mypy=latest&python=3.14&gist=bded9af8fe83b0625ad6bf72ad4b9338&flags=strict | |
| """ | |
| from typing import Awaitable, Generic, Literal, TypeVar, overload, reveal_type | |
| OptionalDecodedString = str | None |
| -- №1 | |
| CREATE TABLE users ( | |
| id BIGINT GENERATED ALWAYS AS IDENTITY, | |
| name TEXT NOT NULL CHECK (length(name) <= 100), | |
| PRIMARY KEY (id) | |
| ) | |
| -- №2 | |
| CREATE TABLE users ( |
| import requests | |
| API_KEY = "EMPTY" | |
| # BASE_URL = "http://localhost:12345/engines/llama.cpp/v1" | |
| BASE_URL = "http://localhost:11223/v1" | |
| URL = f"{BASE_URL}/chat/completions" | |
| # MODEL = "ai/gemma3" | |
| # MODEL = "ai/gemma3n" | |
| MODEL = "gemma3:1b" |
| 3.13 |
| def bcd_to_int(n): | |
| return int(('%x' % n), base=10) | |
| def int_to_bcd(n): | |
| return int(str(n), base=16) |