โมเดล
ตั้งค่า endpoint ที่รองรับ OpenAI หรือ Anthropic ด้วย URL หลักและคีย์ API หากจำเป็น ทดสอบการเชื่อมต่อ เซิร์ฟเวอร์โมเดลในเครื่องต้องทำงานอยู่ เครื่องมือระยะไกลอาจส่งข้อมูลแยกต่างหาก
ใช้ histogram.py ตรวจว่าค่าที่ตรงขอบภายในหรือขอบสุดท้ายเป็นของช่องใด.
ตั้งค่า endpoint ที่รองรับ OpenAI หรือ Anthropic ด้วย URL หลักและคีย์ API หากจำเป็น ทดสอบการเชื่อมต่อ เซิร์ฟเวอร์โมเดลในเครื่องต้องทำงานอยู่ เครื่องมือระยะไกลอาจส่งข้อมูลแยกต่างหาก
เลือกโฟลเดอร์และให้ผู้ช่วยอ่านไฟล์ที่เกี่ยวข้องก่อนแก้ไข ระบุเป้าหมายและขอบเขตของงานให้ชัดเจน
ตรวจสอบการแก้ไขและผลลัพธ์คำสั่ง รันการตรวจสอบของโปรเจกต์ก่อนยอมรับผล โค้ดที่สร้างขึ้นไม่ได้ผ่านการทดสอบโดยอัตโนมัติ
import bisect, math
def histogram(edges, values):
if type(edges) is not list or type(values) is not list or not 2 <= len(edges) <= 257 or len(values) > 4096:
raise ValueError("bins.shape")
if any(type(x) not in (int, float) or not -10**100 <= x <= 10**100 or not math.isfinite(x) for x in edges+values):
raise ValueError("bins.value")
if any(a >= b for a, b in zip(edges, edges[1:])):
raise ValueError("bins.edges")
counts, under, over = [0]*(len(edges)-1), 0, 0
for value in values:
if value < edges[0]:
under += 1
elif value > edges[-1]:
over += 1
else:
counts[min(bisect.bisect_right(edges, value)-1, len(counts)-1)] += 1
return counts, under, over