التضمينات

تعرف على كيفية تحويل النص إلى متجهات تضمين والعثور على نسبة التشابه بين نصين منفصلين.

سنغطي ما يلي...

نقطة نهاية التضمينات

التضمين هو طريقة لتمثيل البيانات في متجه من الأرقام المتصلة. يمكننا توفير هذه المتجهات لخوارزميات ونماذج التعلم الآلي. للنصوص المتشابهة متجهات التضمين نفسها، وللنصين المختلفين تضمينات مختلفة تمامًا. تأخذ API OpenAI النص إدخال وتُرجع متجه التضمين.

Press + to interact
Embeddings
Embeddings

استدعاء واجهة API) للتضمينات

للحصول على متجه تضمين لجزء من النص، يمكننا استدعاء الوظيفة التالية:

response = client.embeddings.create(
input="The text whose embeddings are required",
model="<model_name>"
)

فهم نقطة نهاية التضمينات

دعونا نلقي نظرة على نقطة نهاية التضمينات بمزيد من التفصيل، ومراجعة معلمات طلب ومعلمات استجابة .

معلمات الطلب

دعونا نلقي نظرة على المعلمات المطلوبة لتقديم طلب في نقطة نهاية التضمينات.

Fields

Format

Type

Description

model

String

Required

The ID of the engine to use for this request.

input

String/Array

Required

Input text for embedding, encoded as either a string or an array of tokens. For embedding multiple inputs within a single request, provide an array consisting of strings or arrays of tokens. The input size should not surpass the maximum input token limit for the model (8192 tokens for text-embedding-ada-002). Additionally, it should not be an empty string, and any array should not exceed 2048 dimensions.

encoding_format

String

Optional

The format in which embeddings is returned. The returned format can either be float or base64.

dimensions

Integer

Optional

The specified number of dimensions for the resulting output embeddings. This feature is supported starting from text-embedding-3 models and later versions.

users

String

Optional

A unique identifier that represents your end-user, aiding OpenAI in monitoring and identifying potential misuse or abuse.

ملاحظة : ...