البحث في الملفات

تتيح Gemini API ميزة "التوليد المعزّز بالاسترجاع" (RAG) من خلال أداة "البحث في الملفات". تستورد أداة "البحث في الملفات" بياناتك وتقسّمها وتفهرسها لتتيح استرجاع المعلومات ذات الصلة بسرعة استنادًا إلى طلب مقدَّم. تُستخدم هذه المعلومات بعد ذلك كسياق للنموذج، ما يسمح له بتقديم إجابات أكثر دقة وملاءمةً.

لتسهيل استخدام أداة "البحث في الملفات" وجعلها في متناول المطوّرين، سنوفّر تخزين الملفات وإنشاء عمليات التضمين مجانًا في وقت طلب البحث. لن تدفع إلا مقابل إنشاء عمليات التضمين عند فهرسة ملفاتك لأول مرة (بالتكلفة السارية لنموذج التضمين) والتكلفة العادية لرموز الإدخال والإخراج في نموذج Gemini. يُسهّل نموذج الفوترة الجديد هذا عملية إنشاء أداة "البحث في الملفات" وتوسيع نطاقها ويجعلها أكثر فعالية من حيث التكلفة.

التحميل المباشر إلى مساحة تخزين "البحث في الملفات"

يوضّح هذا المثال كيفية تحميل ملف مباشرةً إلى مساحة تخزين "البحث في الملفات":

Python

# This will only work for SDK newer than 2.0.0
from google import genai
from google.genai import types
import time

client = genai.Client()

# File name will be visible in citations
file_search_store = client.file_search_stores.create(
    config={
        'display_name': 'your-fileSearchStore-name',
        'embedding_model': 'models/gemini-embedding-2'
    }
)

operation = client.file_search_stores.upload_to_file_search_store(
  file='sample.txt',
  file_search_store_name=file_search_store.name,
  config={
      'display_name' : 'display-file-name',
  }
)

while not operation.done:
    time.sleep(5)
    operation = client.operations.get(operation)

interaction = client.interactions.create(
    model="gemini-3-flash-preview",
    input="Can you tell me about [insert question]",
    tools=[{
        "type": "file_search",
        "file_search_store_names": [file_search_store.name]
    }]
)

for step in interaction.steps:
    if step.type == "model_output":
        for content_block in step.content:
            if content_block.type == "text":
                print(content_block.text)
                if content_block.annotations:
                    print("\nSources:")
                    for annotation in content_block.annotations:
                        if annotation.type == "file_citation":
                            print(f"  - {annotation.file_name}: {annotation.source}")

JavaScript

// This will only work for SDK newer than 2.0.0
const { GoogleGenAI } = require('@google/genai');

const ai = new GoogleGenAI({});

async function run() {
  // File name will be visible in citations
  const fileSearchStore = await ai.fileSearchStores.create({
    config: {
      displayName: 'your-fileSearchStore-name',
      embeddingModel: 'models/gemini-embedding-2'
    }
  });

  let operation = await ai.fileSearchStores.uploadToFileSearchStore({
    file: 'file.txt',
    fileSearchStoreName: fileSearchStore.name,
    config: {
      displayName: 'file-name',
    }
  });

  while (!operation.done) {
    await new Promise(resolve => setTimeout(resolve, 5000));
    operation = await ai.operations.get({ operation });
  }

  const interaction = await ai.interactions.create({
    model: "gemini-3-flash-preview",
    input: "Can you tell me about [insert question]",
    tools: [{
      type: "file_search",
      file_search_store_names: [fileSearchStore.name]
    }]
  });

  for (const step of interaction.steps) {
    if (step.type === 'model_output') {
      for (const contentBlock of step.content) {
        if (contentBlock.type === 'text') {
          console.log(contentBlock.text);
          if (contentBlock.annotations) {
            console.log("\nSources:");
            for (const annotation of contentBlock.annotations) {
              if (annotation.type === 'file_citation') {
                console.log(`  - ${annotation.file_name}: ${annotation.source}`);
              }
            }
          }
        }
      }
    }
  }
}

run();

راجِع مرجع واجهة برمجة التطبيقات uploadToFileSearchStore لمزيد من المعلومات.

استيراد الملفات

بدلاً من ذلك، يمكنك تحميل ملف حالي واستيراده إلى مساحة تخزين "البحث في الملفات":

Python

# This will only work for SDK newer than 2.0.0
from google import genai
from google.genai import types
import time

client = genai.Client()

# File name will be visible in citations
sample_file = client.files.upload(file='sample.txt', config={'display_name': 'display_file_name'})

file_search_store = client.file_search_stores.create(
    config={
        'display_name': 'your-fileSearchStore-name',
        'embedding_model': 'models/gemini-embedding-2'
    }
)

operation = client.file_search_stores.import_file(
    file_search_store_name=file_search_store.name,
    file_name=sample_file.name
)

while not operation.done:
    time.sleep(5)
    operation = client.operations.get(operation)

interaction = client.interactions.create(
    model="gemini-3-flash-preview",
    input="Can you tell me about [insert question]",
    tools=[{
        "type": "file_search",
        "file_search_store_names": [file_search_store.name]
    }]
)

for step in interaction.steps:
    if step.type == "model_output":
        for content_block in step.content:
            if content_block.type == "text":
                print(content_block.text)

JavaScript

// This will only work for SDK newer than 2.0.0
const { GoogleGenAI } = require('@google/genai');

const ai = new GoogleGenAI({});

async function run() {
  // File name will be visible in citations
  const sampleFile = await ai.files.upload({
    file: 'sample.txt',
    config: { displayName: 'file-name' }
  });

  const fileSearchStore = await ai.fileSearchStores.create({
    config: {
      displayName: 'your-fileSearchStore-name',
      embeddingModel: 'models/gemini-embedding-2'
    }
  });

  let operation = await ai.fileSearchStores.importFile({
    fileSearchStoreName: fileSearchStore.name,
    fileName: sampleFile.name
  });

  while (!operation.done) {
    await new Promise(resolve => setTimeout(resolve, 5000));
    operation = await ai.operations.get({ operation: operation });
  }

  const interaction = await ai.interactions.create({
    model: "gemini-3-flash-preview",
    input: "Can you tell me about [insert question]",
    tools: [{
      type: "file_search",
      file_search_store_names: [fileSearchStore.name]
    }]
  });

  for (const step of interaction.steps) {
    if (step.type === 'model_output') {
      for (const contentBlock of step.content) {
        if (contentBlock.type === 'text') {
          console.log(contentBlock.text);
        }
      }
    }
  }
}

run();

راجِع مرجع واجهة برمجة التطبيقات importFile لمزيد من المعلومات.

إعدادات التقسيم

عند استيراد ملف إلى مساحة تخزين "البحث في الملفات"، يتم تقسيمه تلقائيًا إلى أجزاء وتضمينه وفهرسته وتحميله إلى مساحة تخزين "البحث في الملفات". إذا كنت بحاجة إلى مزيد من التحكّم في استراتيجية التقسيم، يمكنك تحديد إعداد chunking_config لضبط الحد الأقصى لعدد الرموز لكل جزء والحد الأقصى لعدد الرموز المتداخلة.

Python

# This will only work for SDK newer than 2.0.0
from google import genai
from google.genai import types
import time

client = genai.Client()

operation = client.file_search_stores.upload_to_file_search_store(
    file_search_store_name=file_search_store.name,
    file='sample.txt',
    config={
        'chunking_config': {
          'white_space_config': {
            'max_tokens_per_chunk': 200,
            'max_overlap_tokens': 20
          }
        }
    }
)

while not operation.done:
    time.sleep(5)
    operation = client.operations.get(operation)

print("Custom chunking complete.")

JavaScript

// This will only work for SDK newer than 2.0.0
const { GoogleGenAI } = require('@google/genai');

const ai = new GoogleGenAI({});

let operation = await ai.fileSearchStores.uploadToFileSearchStore({
  file: 'file.txt',
  fileSearchStoreName: fileSearchStore.name,
  config: {
    displayName: 'file-name',
    chunkingConfig: {
      whiteSpaceConfig: {
        maxTokensPerChunk: 200,
        maxOverlapTokens: 20
      }
    }
  }
});

while (!operation.done) {
  await new Promise(resolve => setTimeout(resolve, 5000));
  operation = await ai.operations.get({ operation });
}
console.log("Custom chunking complete.");

لاستخدام مساحة تخزين "البحث في الملفات"، مرِّرها كأداة إلى طريقة interactions.create ، كما هو موضّح في مثالَي التحميل والاستيراد.

آلية العمل

تستخدم أداة "البحث في الملفات" تقنية تُعرف باسم البحث الدلالي للعثور على معلومات ذات صلة بطلب المستخدم. على عكس البحث العادي المستند إلى الكلمات الرئيسية، يفهم البحث الدلالي معنى طلبك وسياقه.

عند استيراد ملف، يتم تحويله إلى تمثيلات رقمية تُعرف باسم عمليات التضمين، والتي تجسّد المعنى الدلالي لـ النص. يتم تخزين عمليات التضمين هذه في قاعدة بيانات متخصّصة لأداة "البحث في الملفات". عند إجراء طلب بحث، يتم تحويله أيضًا إلى عملية تضمين. بعد ذلك، يُجري النظام عملية "بحث في الملفات" للعثور على أجزاء المستند الأكثر تشابهًا وملاءمةً من مساحة تخزين "البحث في الملفات".

لا تتوفّر مدة بقاء لعمليات التضمين والملفات، بل تظلّ متاحة إلى أن يتم حذفها يدويًا أو عند إيقاف النموذج.

في ما يلي تفصيل لعملية استخدام واجهة برمجة التطبيقات uploadToFileSearchStore لأداة "البحث في الملفات":

  1. إنشاء مساحة تخزين "البحث في الملفات": تحتوي مساحة تخزين "البحث في الملفات" على البيانات المعالَجة من ملفاتك. وهي الحاوية الثابتة لعمليات التضمين التي سيُجري عليها البحث الدلالي عملياته.

  2. تحميل ملف واستيراده إلى مساحة تخزين "البحث في الملفات": يمكنك تحميل ملف واستيراد النتائج إلى مساحة تخزين "البحث في الملفات" في الوقت نفسه. يؤدي ذلك إلى إنشاء عنصر File مؤقت، وهو مرجع لمستندك الأولي. بعد ذلك، يتم تقسيم هذه البيانات وتحويلها إلى عمليات تضمين لأداة "البحث في الملفات" وفهرستها. سيتم حذف عنصر File بعد 48 ساعة، بينما سيتم تخزين البيانات التي تم استيرادها إلى مساحة تخزين "البحث في الملفات" إلى أجل غير مسمّى إلى أن تختار حذفها.

  3. إجراء طلب بحث باستخدام أداة "البحث في الملفات": أخيرًا، يمكنك استخدام أداة FileSearch في طلب generateContent في إعدادات الأداة، يمكنك تحديد FileSearchRetrievalResource، الذي يشير إلى FileSearchStore الذي تريد البحث فيه. يطلب ذلك من النموذج إجراء بحث دلالي في مساحة تخزين "البحث في الملفات" المحدّدة للعثور على معلومات ذات صلة لتستند إليها استجابته.

عملية الفهرسة وطلب البحث في "بحث الملفات"
عملية الفهرسة والاستعلام في أداة "البحث في الملفات"

في هذا الرسم البياني، يمثّل الخط المتقطّع من المستندات إلى نموذج التضمين (باستخدام gemini-embedding-001) واجهة برمجة التطبيقات uploadToFileSearchStore (مع تجاوز مساحة تخزين الملفات). بخلاف ذلك، يؤدي استخدام Files API لإنشاء الملفات بشكل منفصل ثم استيرادها إلى نقل عملية الفهرسة من المستندات إلى مساحة تخزين الملفات ثم إلى نموذج التضمين.

مساحات تخزين "البحث في الملفات"

مساحة تخزين "البحث في الملفات" هي حاوية لعمليات تضمين مستنداتك. في حين يتم حذف الملفات الأولية التي يتم تحميلها من خلال File API بعد 48 ساعة، يتم تخزين البيانات التي يتم استيرادها إلى مساحة تخزين "البحث في الملفات" إلى أجل غير مسمّى إلى أن تحذفها يدويًا. يمكنك إنشاء مساحات تخزين متعددة لأداة "البحث في الملفات" لتنظيم مستنداتك. تتيح لك واجهة برمجة التطبيقات FileSearchStore إنشاء مساحات تخزين "البحث في الملفات" وإدراجها والحصول عليها وحذفها لإدارتها. تكون أسماء مساحات تخزين "البحث في الملفات" ضمن نطاق عالمي.

في ما يلي بعض الأمثلة عن كيفية إدارة مساحات تخزين "البحث في الملفات":

Python

# This will only work for SDK newer than 2.0.0
file_search_store = client.file_search_stores.create(
    config={
        'display_name': 'my-file_search-store-123',
        'embedding_model': 'models/gemini-embedding-2'
    }
)

for file_search_store in client.file_search_stores.list():
    print(file_search_store)

my_file_search_store = client.file_search_stores.get(name='fileSearchStores/my-file_search-store-123')

client.file_search_stores.delete(name='fileSearchStores/my-file_search-store-123', config={'force': True})

JavaScript

// This will only work for SDK newer than 2.0.0
const fileSearchStore = await ai.fileSearchStores.create({
  config: {
    displayName: 'my-file_search-store-123',
    embeddingModel: 'models/gemini-embedding-2'
  }
});

const fileSearchStores = await ai.fileSearchStores.list();
for await (const store of fileSearchStores) {
  console.log(store);
}

const myFileSearchStore = await ai.fileSearchStores.get({
  name: 'fileSearchStores/my-file_search-store-123'
});

await ai.fileSearchStores.delete({
  name: 'fileSearchStores/my-file_search-store-123',
  config: { force: true }
});

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/fileSearchStores?key=${GEMINI_API_KEY}" \
    -H "Content-Type: application/json" \
    -d '{ "displayName": "My Store", "embedding_model": "models/gemini-embedding-2" }'

curl "https://generativelanguage.googleapis.com/v1beta/fileSearchStores?key=${GEMINI_API_KEY}" \

curl "https://generativelanguage.googleapis.com/v1beta/fileSearchStores/my-file_search-store-123?key=${GEMINI_API_KEY}"

curl -X DELETE "https://generativelanguage.googleapis.com/v1beta/fileSearchStores/my-file_search-store-123?key=${GEMINI_API_KEY}"

مستندات "البحث في الملفات"

يمكنك إدارة المستندات الفردية في مساحات تخزين الملفات باستخدام الـ File Search Documents API لإجراء list لكل مستند في مساحة تخزين "البحث في الملفات"، وget معلومات عن مستند، وdelete مستند بالاسم.

Python

# This will only work for SDK newer than 2.0.0
for document_in_store in client.file_search_stores.documents.list(parent='fileSearchStores/my-file_search-store-123'):
  print(document_in_store)

file_search_document = client.file_search_stores.documents.get(name='fileSearchStores/my-file_search-store-123/documents/my_doc')
print(file_search_document)

client.file_search_stores.documents.delete(name='fileSearchStores/my-file_search-store-123/documents/my_doc', config={'force': True})

JavaScript

// This will only work for SDK newer than 2.0.0
const documents = await ai.fileSearchStores.documents.list({
  parent: 'fileSearchStores/my-file_search-store-123'
});
for await (const doc of documents) {
  console.log(doc);
}

const fileSearchDocument = await ai.fileSearchStores.documents.get({
  name: 'fileSearchStores/my-file_search-store-123/documents/my_doc'
});

await ai.fileSearchStores.documents.delete({
  name: 'fileSearchStores/my-file_search-store-123/documents/my_doc'
});

REST

curl "https://generativelanguage.googleapis.com/v1beta/fileSearchStores/my-file_search-store-123/documents?key=${GEMINI_API_KEY}"

curl "https://generativelanguage.googleapis.com/v1beta/fileSearchStores/my-file_search-store-123/documents/my_doc?key=${GEMINI_API_KEY}"

curl -X DELETE "https://generativelanguage.googleapis.com/v1beta/fileSearchStores/my-file_search-store-123/documents/my_doc?key=${GEMINI_API_KEY}&force=true"

البيانات الوصفية للملف

يمكنك إضافة بيانات وصفية مخصّصة إلى ملفاتك للمساعدة في فلترتها أو تقديم سياق إضافي. البيانات الوصفية هي مجموعة من أزواج المفاتيح والقيم.

Python

# This will only work for SDK newer than 2.0.0
op = client.file_search_stores.import_file(
    file_search_store_name=file_search_store.name,
    file_name=sample_file.name,
    config={
        'custom_metadata': [
            {"key": "author", "string_value": "Robert Graves"},
            {"key": "year", "numeric_value": 1934}
        ]
    }
)

JavaScript

// This will only work for SDK newer than 2.0.0
let operation = await ai.fileSearchStores.importFile({
  fileSearchStoreName: fileSearchStore.name,
  fileName: sampleFile.name,
  config: {
    customMetadata: [
      { key: "author", stringValue: "Robert Graves" },
      { key: "year", numericValue: 1934 }
    ]
  }
});

يكون ذلك مفيدًا عندما يكون لديك مستندات متعددة في مساحة تخزين "البحث في الملفات" وتريد البحث في مجموعة فرعية منها فقط.

Python

# This will only work for SDK newer than 2.0.0
interaction = client.interactions.create(
    model="gemini-3-flash-preview",
    input="Tell me about the book 'I, Claudius'",
    tools=[{
        "type": "file_search",
        "file_search_store_names": [file_search_store.name],
        "metadata_filter": 'author="Robert Graves"',
    }]
)

for step in interaction.steps:
    if step.type == "model_output":
        for content_block in step.content:
            if content_block.type == "text":
                print(content_block.text)

JavaScript

// This will only work for SDK newer than 2.0.0
const interaction = await ai.interactions.create({
  model: "gemini-3-flash-preview",
  input: "Tell me about the book 'I, Claudius'",
  tools: [{
    type: "file_search",
    file_search_store_names: [fileSearchStore.name],
    metadata_filter: 'author="Robert Graves"',
  }]
});

for (const step of interaction.steps) {
  if (step.type === 'model_output') {
    for (const contentBlock of step.content) {
      if (contentBlock.type === 'text') {
        console.log(contentBlock.text);
      }
    }
  }
}

REST

# Specifies the API revision to avoid breaking changes when they become default
curl "https://generativelanguage.googleapis.com/v1beta/interactions" \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H 'Content-Type: application/json' \
    -H "Api-Revision: 2026-05-20" \
    -X POST \
    -d '{
            "model": "gemini-3-flash-preview",
            "input": [{"type": "text", "text": "Tell me about the book I, Claudius"}],
            "tools": [{
                "type": "file_search",
                "file_search_store_names": ["'$STORE_NAME'"],
                "metadata_filter": "author = \"Robert Graves\""
            }]
        }' 2> /dev/null > response.json

cat response.json

يمكنك الاطّلاع على إرشادات حول تنفيذ بنية فلتر القائمة لـ metadata_filter على google.aip.dev/160 .

الاقتباسات

عند استخدام أداة "البحث في الملفات"، قد تتضمّن استجابة النموذج اقتباسات تحدّد أجزاء مستنداتك التي تم تحميلها والتي استُخدمت لإنشاء الإجابة. يساعد ذلك في التحقّق من الحقائق والتحقّق من صحتها.

يمكنك الوصول إلى معلومات الاقتباس من خلال حقل annotations ضمن فقرات المحتوى في خطوة model_output.

Python

# This will only work for SDK newer than 2.0.0
for step in interaction.steps:
    if step.type == "model_output":
        for content_block in step.content:
            if content_block.annotations:
                print(content_block.annotations)

JavaScript

// This will only work for SDK newer than 2.0.0
for (const step of interaction.steps) {
    if (step.type === "model_output") {
        for (const contentBlock of step.content) {
            if (contentBlock.annotations) {
                console.log(contentBlock.annotations);
            }
        }
    }
}

للحصول على معلومات مفصّلة عن بنية البيانات الوصفية للاستناد إلى المصادر، راجِع الـ أمثلة في دليل استخدام البحث في الملفات أو قسم الاستناد إلى المصادر في مستندات الاستناد إلى المصادر باستخدام بحث Google .

البيانات الوصفية المخصّصة في بيانات الاستناد إلى المصادر

إذا أضفت بيانات وصفية مخصّصة إلى ملفاتك، يمكنك الوصول إليها في البيانات الوصفية للاستناد إلى المصادر في استجابة النموذج. يكون ذلك مفيدًا لتمرير سياق إضافي (مثل عناوين URL أو أرقام الصفحات أو المؤلّفين) من مستنداتك المصدر إلى منطق تطبيقك. تحتوي كل grounding_chunk في retrieved_context على هذه البيانات الوصفية المخصّصة.

Python

# This will only work for SDK newer than 2.0.0
interaction = client.interactions.create(
    model="gemini-3-flash-preview",
    input="Tell me about [insert question]",
    tools=[{
        "type": "file_search",
        "file_search_store_names": [file_search_store.name]
    }]
)

for step in interaction.steps:
    if step.type == "model_output":
        for content_block in step.content:
            if content_block.annotations:
                for annotation in content_block.annotations:
                    print(annotation)

JavaScript

  // This will only work for SDK newer than 2.0.0
  const interaction = await ai.interactions.create({
    model: "gemini-3-flash-preview",
    input: "Tell me about [insert question]",
    tools: [{
      type: "file_search",
      file_search_store_names: [fileSearchStore.name]
    }]
  });

  for (const step of interaction.steps) {
    if (step.type === 'model_output') {
      for (const contentBlock of step.content) {
        if (contentBlock.annotations) {
          contentBlock.annotations.forEach((annotation) => {
            console.log(annotation);
          });
        }
      }
    }
  }

REST

{
  "steps": [
    {
      "type": "model_output",
      "content": [
        {
          "type": "text",
          "text": "...",
          "annotations": [
            {
              "file_name": "...",
              "source": "...",
              "custom_metadata": [
                {
                  "key": "author",
                  "string_value": "Robert Graves"
                },
                {
                  "key": "year",
                  "numeric_value": 1934
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}

ناتج منظَّم

بدءًا من نماذج Gemini 3، يمكنك الجمع بين أداة "البحث في الملفات" و الناتج المنظَّم.

Python

# This will only work for SDK newer than 2.0.0
from pydantic import BaseModel, Field

class Money(BaseModel):
    amount: str = Field(description="The numerical part of the amount.")
    currency: str = Field(description="The currency of amount.")

interaction = client.interactions.create(
    model="gemini-3-flash-preview",
    input="What is the minimum hourly wage in Tokyo right now?",
    tools=[{
        "type": "file_search",
        "file_search_store_names": [file_search_store.name]
    }],
    response_format={
        "type": "text",
        "mime_type": "application/json",
        "schema": Money.model_json_schema()
    },
)
result = Money.model_validate_json(interaction.steps[-1].content[0].text)
print(result)

JavaScript

// This will only work for SDK newer than 2.0.0
import { z } from "zod";

const moneyJsonSchema = {
  type: "object",
  properties: {
    amount: { type: "string", description: "The numerical part of the amount." },
    currency: { type: "string", description: "The currency of amount." }
  },
  required: ["amount", "currency"]
};

const moneySchema = z.fromJSONSchema(moneyJsonSchema);

async function run() {
  const interaction = await ai.interactions.create({
    model: "gemini-3-flash-preview",
    input: "What is the minimum hourly wage in Tokyo right now?",
    tools: [{
      type: "file_search",
      file_search_store_names: [fileSearchStore.name],
    }],
    response_format: {
      type: 'text',
      mime_type: 'application/json',
      schema: moneyJsonSchema
    },
  });

  const result = moneySchema.parse(JSON.parse(interaction.steps.at(-1).content[0].text));
  console.log(result);
}

run();

REST

# Specifies the API revision to avoid breaking changes when they become default
curl "https://generativelanguage.googleapis.com/v1beta/interactions" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Api-Revision: 2026-05-20" \
  -X POST \
  -d '{
    "model": "gemini-3-flash-preview",
    "input": "What is the minimum hourly wage in Tokyo right now?",
    "tools": [{
      "type": "file_search",
      "file_search_store_names": ["$FILE_SEARCH_STORE_NAME"]
    }],
    "response_format": {
      "type": "text",
      "mime_type": "application/json",
      "schema": {
        "type": "object",
        "properties": {
          "amount": {"type": "string", "description": "The numerical part of the amount."},
          "currency": {"type": "string", "description": "The currency of amount."}
        },
        "required": ["amount", "currency"]
      }
    }
  }'

النماذج المتوافقة

تتيح النماذج التالية أداة "البحث في الملفات":

الطراز البحث في الملفات
Gemini 3.1 Pro (إصدار تجريبي) ✔️
Gemini 3.1 Flash-Lite ✔️
Gemini 3.1 Flash-Lite (إصدار تجريبي) ✔️
Gemini 3 Flash (إصدار تجريبي) ✔️
Gemini 2.5 Pro ✔️
Gemini 2.5 Flash-Lite ✔️

مجموعات الأدوات المتوافقة

تتيح نماذج Gemini 3 الجمع بين الأدوات المضمّنة (مثل "البحث في الملفات") والأدوات المخصّصة (استدعاء الدوال). مزيد من المعلومات على صفحة مجموعات الأدوات.

أنواع الملفات المعتمدة

تتيح أداة "البحث في الملفات" مجموعة كبيرة من تنسيقات الملفات، والمدرَجة في الأقسام التالية.

أنواع ملفات التطبيقات

  • application/dart
  • application/ecmascript
  • application/json
  • application/ms-java
  • application/msword
  • application/pdf
  • application/sql
  • application/typescript
  • application/vnd.curl
  • application/vnd.dart
  • application/vnd.ibm.secure-container
  • application/vnd.jupyter
  • application/vnd.ms-excel
  • application/vnd.oasis.opendocument.text
  • application/vnd.openxmlformats-officedocument.presentationml.presentation
  • application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • application/vnd.openxmlformats-officedocument.wordprocessingml.document
  • application/vnd.openxmlformats-officedocument.wordprocessingml.template
  • application/x-csh
  • application/x-hwp
  • application/x-hwp-v5
  • application/x-latex
  • application/x-php
  • application/x-powershell
  • application/x-sh
  • application/x-shellscript
  • application/x-tex
  • application/x-zsh
  • application/xml
  • application/zip

أنواع الملفات النصية

  • text/1d-interleaved-parityfec
  • text/RED
  • text/SGML
  • text/cache-manifest
  • text/calendar
  • text/cql
  • text/cql-extension
  • text/cql-identifier
  • text/css
  • text/csv
  • text/csv-schema
  • text/dns
  • text/encaprtp
  • text/enriched
  • text/example
  • text/fhirpath
  • text/flexfec
  • text/fwdred
  • text/gff3
  • text/grammar-ref-list
  • text/hl7v2
  • text/html
  • text/javascript
  • text/jcr-cnd
  • text/jsx
  • text/markdown
  • text/mizar
  • text/n3
  • text/parameters
  • text/parityfec
  • text/php
  • text/plain
  • text/provenance-notation
  • text/prs.fallenstein.rst
  • text/prs.lines.tag
  • text/prs.prop.logic
  • text/raptorfec
  • text/rfc822-headers
  • text/rtf
  • text/rtp-enc-aescm128
  • text/rtploopback
  • text/rtx
  • text/sgml
  • text/shaclc
  • text/shex
  • text/spdx
  • text/strings
  • text/t140
  • text/tab-separated-values
  • text/texmacs
  • text/troff
  • text/tsv
  • text/tsx
  • text/turtle
  • text/ulpfec
  • text/uri-list
  • text/vcard
  • text/vnd.DMClientScript
  • text/vnd.IPTC.NITF
  • text/vnd.IPTC.NewsML
  • text/vnd.a
  • text/vnd.abc
  • text/vnd.ascii-art
  • text/vnd.curl
  • text/vnd.debian.copyright
  • text/vnd.dvb.subtitle
  • text/vnd.esmertec.theme-descriptor
  • text/vnd.exchangeable
  • text/vnd.familysearch.gedcom
  • text/vnd.ficlab.flt
  • text/vnd.fly
  • text/vnd.fmi.flexstor
  • text/vnd.gml
  • text/vnd.graphviz
  • text/vnd.hans
  • text/vnd.hgl
  • text/vnd.in3d.3dml
  • text/vnd.in3d.spot
  • text/vnd.latex-z
  • text/vnd.motorola.reflex
  • text/vnd.ms-mediapackage
  • text/vnd.net2phone.commcenter.command
  • text/vnd.radisys.msml-basic-layout
  • text/vnd.senx.warpscript
  • text/vnd.sosi
  • text/vnd.sun.j2me.app-descriptor
  • text/vnd.trolltech.linguist
  • text/vnd.wap.si
  • text/vnd.wap.sl
  • text/vnd.wap.wml
  • text/vnd.wap.wmlscript
  • text/vtt
  • text/wgsl
  • text/x-asm
  • text/x-bibtex
  • text/x-boo
  • text/x-c
  • text/x-c++hdr
  • text/x-c++src
  • text/x-cassandra
  • text/x-chdr
  • text/x-coffeescript
  • text/x-component
  • text/x-csh
  • text/x-csharp
  • text/x-csrc
  • text/x-cuda
  • text/x-d
  • text/x-diff
  • text/x-dsrc
  • text/x-emacs-lisp
  • text/x-erlang
  • text/x-gff3
  • text/x-go
  • text/x-haskell
  • text/x-java
  • text/x-java-properties
  • text/x-java-source
  • text/x-kotlin
  • text/x-lilypond
  • text/x-lisp
  • text/x-literate-haskell
  • text/x-lua
  • text/x-moc
  • text/x-objcsrc
  • text/x-pascal
  • text/x-pcs-gcd
  • text/x-perl
  • text/x-perl-script
  • text/x-python
  • text/x-python-script
  • text/x-r-markdown
  • text/x-rsrc
  • text/x-rst
  • text/x-ruby-script
  • text/x-rust
  • text/x-sass
  • text/x-scala
  • text/x-scheme
  • text/x-script.python
  • text/x-scss
  • text/x-setext
  • text/x-sfv
  • text/x-sh
  • text/x-siesta
  • text/x-sos
  • text/x-sql
  • text/x-swift
  • text/x-tcl
  • text/x-tex
  • text/x-vbasic
  • text/x-vcalendar
  • text/xml
  • text/xml-dtd
  • text/xml-external-parsed-entity
  • text/yaml

القيود

الحدود القصوى لمعدّل الاستخدام

تفرض File Search API الحدود التالية لضمان استقرار الخدمة:

  • الحد الأقصى لحجم الملف أو المستند الواحد: 100 ميغابايت
  • الحجم الإجمالي لمساحات تخزين "البحث في الملفات" في المشروع (استنادًا إلى مستوى المستخدم):
    • المستوى المجاني: 1 غيغابايت
    • المستوى 1: 10 غيغابايت
    • المستوى 2: 100 غيغابايت
    • المستوى 3: 1 تيرابايت
  • اقتراح: ننصحك بتقليل حجم كل مساحة تخزين "البحث في الملفات" إلى أقل من 20 غيغابايت لضمان الحد الأدنى من وقت استرجاع البيانات.

الأسعار

  • يتم تحصيل رسوم من المطوّرين مقابل عمليات التضمين في وقت الفهرسة استنادًا إلى الأسعار الحالية لعمليات التضمين (0.15 دولار أمريكي لكل مليون رمز).
  • تخزين البيانات مجاني.
  • عمليات التضمين في وقت طلب البحث مجانية.
  • يتم تحصيل رسوم مقابل رموز المستند الذي تم استرجاعه كرموز سياق عادية .

الخطوات التالية

  • راجِع مرجع واجهة برمجة التطبيقات لمساحات تخزين "البحث في الملفات" ومستندات "البحث في الملفات" .