मॉडल
बेस URL और आवश्यक होने पर API कुंजी से OpenAI-संगत या Anthropic endpoint सेट करें। कनेक्शन जाँचें। स्थानीय मॉडल सर्वर चालू होना चाहिए; दूरस्थ उपकरण अलग से डेटा भेज सकते हैं।
टकराव देखते समय जोड़ी गई कुंजियों को बिट मानचित्र से मिलाएँ और सकारात्मक उत्तर को निश्चित सदस्यता से अलग रखें।
बेस URL और आवश्यक होने पर API कुंजी से OpenAI-संगत या Anthropic endpoint सेट करें। कनेक्शन जाँचें। स्थानीय मॉडल सर्वर चालू होना चाहिए; दूरस्थ उपकरण अलग से डेटा भेज सकते हैं।
फ़ोल्डर चुनें और संपादन से पहले सहायक से संबंधित फ़ाइलें पढ़ने को कहें। काम का उद्देश्य और सीमाएँ बताएँ।
बदलाव और कमांड का आउटपुट देखें। परिणाम स्वीकार करने से पहले प्रोजेक्ट की जाँच चलाएँ; बनाया गया कोड अपने आप परीक्षण किया हुआ नहीं होता।
from hashlib import sha256
class Bloom:
def __init__(self, width):
if type(width) is not int or not 1 <= width <= 8192:
raise ValueError("width.range")
self.width, self.bits = width, 0
def positions(self, key):
if not isinstance(key, bytes) or len(key) > 1024:
raise ValueError("key.bytes")
digest = sha256(key).digest()
return [int.from_bytes(digest[i:i+4], "big") % self.width
for i in (0, 4, 8, 12)]
def add(self, key):
for position in self.positions(key):
self.bits |= 1 << position
def maybe_contains(self, key):
return all(self.bits & (1 << p) for p in self.positions(key))