फ़ाइल खोजने की सुविधा

Gemini API की मदद से, फ़ाइलें खोजने के टूल का इस्तेमाल करके, Retrieval Augmented Generation ("RAG") की सुविधा पाई जा सकती है. फ़ाइलें खोजने का टूल, आपके डेटा को इंपोर्ट करता है, उसे हिस्सों में बांटता है, और इंडेक्स करता है. इससे दिए गए प्रॉम्प्ट के आधार पर, काम की जानकारी तेज़ी से खोजी जा सकती है. इसके बाद, इस जानकारी का इस्तेमाल मॉडल के लिए कॉन्टेक्स्ट के तौर पर किया जाता है. इससे मॉडल, ज़्यादा सटीक और काम के जवाब दे पाता है.

हम फ़ाइलें खोजने के टूल को डेवलपर के लिए आसान और किफ़ायती बनाना चाहते हैं. इसलिए, हम क्वेरी के समय फ़ाइल स्टोरेज और एंबेडिंग जनरेट करने की सुविधा, बिना किसी शुल्क के उपलब्ध करा रहे हैं. फ़ाइलें इंडेक्स करते समय, आपको सिर्फ़ एंबेडिंग बनाने के लिए शुल्क देना होगा. यह शुल्क, लागू होने वाले एंबेडिंग मॉडल की लागत और Gemini मॉडल के इनपुट / आउटपुट टोकन की सामान्य लागत के हिसाब से लिया जाएगा. बिलिंग के इस नए तरीके से, फ़ाइलें खोजने के टूल को बनाना और स्केल करना आसान और किफ़ायती हो जाता है.

फ़ाइलें खोजने के स्टोर में सीधे अपलोड करना

इस उदाहरण में, फ़ाइलें खोजने के स्टोर में सीधे फ़ाइल अपलोड करने का तरीका बताया गया है:

Python

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'})

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)

response = client.models.generate_content(
    model="gemini-3-flash-preview",
    contents="""Can you tell me about [insert question]""",
    config=types.GenerateContentConfig(
        tools=[
            types.Tool(
                file_search=types.FileSearch(
                    file_search_store_names=[file_search_store.name]
                )
            )
        ]
    )
)

print(response.text)

JavaScript

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' }
  });

  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 response = await ai.models.generateContent({
    model: "gemini-3-flash-preview",
    contents: "Can you tell me about [insert question]",
    config: {
      tools: [
        {
          fileSearch: {
            fileSearchStoreNames: [fileSearchStore.name]
          }
        }
      ]
    }
  });

  console.log(response.text);
}

run();

ज़्यादा जानकारी के लिए, uploadToFileSearchStore के लिए एपीआई रेफ़रंस देखें.

फ़ाइलें इंपोर्ट करना

इसके अलावा, मौजूदा फ़ाइल अपलोड की जा सकती है और उसे फ़ाइलें खोजने के स्टोर में इंपोर्ट किया जा सकता है:

Python

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={'name': 'display_file_name'})

file_search_store = client.file_search_stores.create(config={'display_name': 'your-fileSearchStore-name'})

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)

response = client.models.generate_content(
    model="gemini-3-flash-preview",
    contents="""Can you tell me about [insert question]""",
    config=types.GenerateContentConfig(
        tools=[
            types.Tool(
                file_search=types.FileSearch(
                    file_search_store_names=[file_search_store.name]
                )
            )
        ]
    )
)

print(response.text)

JavaScript

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: { name: 'file-name' }
  });

  const fileSearchStore = await ai.fileSearchStores.create({
    config: { displayName: 'your-fileSearchStore-name' }
  });

  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 response = await ai.models.generateContent({
    model: "gemini-3-flash-preview",
    contents: "Can you tell me about [insert question]",
    config: {
      tools: [
        {
          fileSearch: {
            fileSearchStoreNames: [fileSearchStore.name]
          }
        }
      ]
    }
  });

  console.log(response.text);
}

run();

ज़्यादा जानकारी के लिए, importFile के लिए एपीआई रेफ़रंस देखें.

हिस्सों में बांटने का कॉन्फ़िगरेशन

किसी फ़ाइल को फ़ाइलें खोजने के स्टोर में इंपोर्ट करने पर, वह अपने-आप हिस्सों में बंट जाती है. साथ ही, उसे एंबेड किया जाता है, इंडेक्स किया जाता है, और फ़ाइलें खोजने के स्टोर में अपलोड किया जाता है. अगर आपको हिस्सों में बांटने की रणनीति पर ज़्यादा कंट्रोल चाहिए, तो सेटिंग तय की जा सकती है. इससे, हर हिस्से के लिए टोकन की ज़्यादा से ज़्यादा संख्या और ओवरलैप होने वाले टोकन की ज़्यादा से ज़्यादा संख्या सेट की जा सकती है.chunking_config

Python

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_name=sample_file.name,
    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

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.");

फ़ाइलें खोजने के स्टोर का इस्तेमाल करने के लिए, उसे generateContent तरीके में टूल के तौर पर पास करें. इसके बारे में, अपलोड करने और इंपोर्ट करने के उदाहरणों में बताया गया है.

यह कैसे काम करता है

फ़ाइलें खोजने का टूल, सिमैंटिक सर्च नाम की तकनीक का इस्तेमाल करके, उपयोगकर्ता के प्रॉम्प्ट से जुड़ी जानकारी ढूंढता है. सिमैंटिक सर्च, कीवर्ड पर आधारित सामान्य खोज से अलग होती है. यह आपकी क्वेरी का मतलब और कॉन्टेक्स्ट समझती है.

किसी फ़ाइल को इंपोर्ट करने पर, उसे एंबेडिंग में बदल दिया जाता है. ये संख्या के तौर पर दिखाए जाते हैं और इनमें टेक्स्ट का सिमैंटिक मतलब कैप्चर होता है. इन एंबेडिंग को, फ़ाइलें खोजने के खास डेटाबेस में सेव किया जाता है. क्वेरी करने पर, उसे भी एंबेडिंग में बदल दिया जाता है. इसके बाद, सिस्टम फ़ाइलें खोजने की प्रोसेस पूरी करता है, ताकि फ़ाइलें खोजने के स्टोर से मिलते-जुलते और काम के दस्तावेज़ के हिस्से ढूंढे जा सकें.

एंबेडिंग और फ़ाइलों के लिए, टाइम टू लिव (टीटीएल) की कोई सीमा नहीं होती. ये तब तक मौजूद रहती हैं, जब तक इन्हें मैन्युअल तरीके से मिटाया न जाए या जब तक मॉडल को बंद न कर दिया जाए.

यहां, फ़ाइलें खोजने के uploadToFileSearchStore एपीआई का इस्तेमाल करने की प्रोसेस के बारे में बताया गया है:

  1. फ़ाइलें खोजने का स्टोर बनाना: फ़ाइलें खोजने के स्टोर में, आपकी फ़ाइलों से प्रोसेस किया गया डेटा होता है. यह एंबेडिंग के लिए परसिस्टेंट कंटेनर होता है. सिमैंटिक सर्च, इसी पर काम करती है.

  2. फ़ाइल अपलोड करना और उसे फ़ाइलें खोजने के स्टोर में इंपोर्ट करना: एक साथ फ़ाइल अपलोड करें और नतीजों को फ़ाइलें खोजने के स्टोर में इंपोर्ट करें. इससे एक अस्थायी File ऑब्जेक्ट बनता है. यह आपके रॉ दस्तावेज़ का रेफ़रंस होता है. इसके बाद, उस डेटा को हिस्सों में बांटा जाता है, फ़ाइलें खोजने के एंबेडिंग में बदला जाता है, और इंडेक्स किया जाता है. File ऑब्जेक्ट 48 घंटों के बाद मिट जाता है. वहीं, फ़ाइलें खोजने के स्टोर में इंपोर्ट किया गया डेटा, तब तक सेव रहेगा, जब तक उसे मिटाने का विकल्प नहीं चुना जाता.

  3. फ़ाइलें खोजने के टूल से क्वेरी करना: आखिर में, FileSearch टूल का इस्तेमाल generateContent कॉल में किया जाता है. टूल के कॉन्फ़िगरेशन में, FileSearchRetrievalResource तय किया जाता है. यह उस FileSearchStore की ओर इशारा करता है जिसे खोजना है. इससे मॉडल को उस खास फ़ाइलें खोजने के स्टोर पर सिमैंटिक सर्च करने का निर्देश मिलता है, ताकि जवाब देने के लिए काम की जानकारी खोजी जा सके.

फ़ाइल सर्च की इंडेक्सिंग और क्वेरी करने की प्रोसेस
फ़ाइलें खोजने के टूल की इंडेक्सिंग और क्वेरी करने की प्रोसेस

इस डायग्राम में, दस्तावेज़ से एंबेडिंग मॉडल (जिसमें gemini-embedding-001 का इस्तेमाल किया गया है) तक की डॉटेड लाइन, uploadToFileSearchStore एपीआई (जिसमें फ़ाइल स्टोरेज को बायपास किया गया है) को दिखाती है. इसके अलावा, फ़ाइलें बनाने और फिर उन्हें इंपोर्ट करने के लिए, Files API का इस्तेमाल करने पर, इंडेक्सिंग की प्रोसेस दस्तावेज़ से फ़ाइल स्टोरेज और फिर एंबेडिंग मॉडल तक जाती है.

फ़ाइलें खोजने के स्टोर

फ़ाइलें खोजने का स्टोर, आपके दस्तावेज़ों के एंबेडिंग के लिए कंटेनर होता है. File API की मदद से अपलोड की गई रॉ फ़ाइलें 48 घंटों के बाद मिट जाती हैं. वहीं, फ़ाइलें खोजने के स्टोर में इंपोर्ट किया गया डेटा, तब तक सेव रहता है, जब तक उसे मैन्युअल तरीके से मिटाया न जाए. दस्तावेज़ों को व्यवस्थित करने के लिए, फ़ाइलें खोजने के कई स्टोर बनाए जा सकते हैं. FileSearchStore API की मदद से, फ़ाइलें खोजने के स्टोर मैनेज किए जा सकते हैं. इसके लिए, स्टोर बनाए जा सकते हैं, उनकी सूची देखी जा सकती है, उन्हें ऐक्सेस किया जा सकता है, और मिटाया जा सकता है. फ़ाइलें खोजने के स्टोर के नाम, ग्लोबल लेवल पर तय किए जाते हैं.

यहां, फ़ाइलें खोजने के स्टोर मैनेज करने के कुछ उदाहरण दिए गए हैं:

Python

file_search_store = client.file_search_stores.create(config={'display_name': 'my-file_search-store-123'})

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

const fileSearchStore = await ai.fileSearchStores.create({
  config: { displayName: 'my-file_search-store-123' }
});

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" }'

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}"

फ़ाइलें खोजने के दस्तावेज़

फ़ाइलें खोजने के दस्तावेज़ों के एपीआई की मदद से, फ़ाइलें खोजने के स्टोर में मौजूद अलग-अलग दस्तावेज़ों को मैनेज किया जा सकता है. इसके लिए, फ़ाइलें खोजने के स्टोर में मौजूद हर दस्तावेज़ की list देखी जा सकती है, किसी दस्तावेज़ के बारे में जानकारी get की जा सकती है, और किसी दस्तावेज़ को नाम के हिसाब से delete किया जा सकता है.

Python

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')

JavaScript

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}"

फ़ाइल का मेटाडेटा

फ़ाइलों में कस्टम मेटाडेटा जोड़ा जा सकता है. इससे उन्हें फ़िल्टर करने या अतिरिक्त कॉन्टेक्स्ट देने में मदद मिलती है. मेटाडेटा, की-वैल्यू पेयर का सेट होता है.

Python

op = client.file_search_stores.import_file(
    file_search_store_name=file_search_store.name,
    file_name=sample_file.name,
    custom_metadata=[
        {"key": "author", "string_value": "Robert Graves"},
        {"key": "year", "numeric_value": 1934}
    ]
)

JavaScript

let operation = await ai.fileSearchStores.importFile({
  fileSearchStoreName: fileSearchStore.name,
  fileName: sampleFile.name,
  config: {
    customMetadata: [
      { key: "author", stringValue: "Robert Graves" },
      { key: "year", numericValue: 1934 }
    ]
  }
});

यह तब काम आता है, जब फ़ाइलें खोजने के स्टोर में कई दस्तावेज़ मौजूद हों और सिर्फ़ उनमें से कुछ को खोजना हो.

Python

response = client.models.generate_content(
    model="gemini-3-flash-preview",
    contents="Tell me about the book 'I, Claudius'",
    config=types.GenerateContentConfig(
        tools=[
            types.Tool(
                file_search=types.FileSearch(
                    file_search_store_names=[file_search_store.name],
                    metadata_filter="author=Robert Graves",
                )
            )
        ]
    )
)

print(response.text)

JavaScript

const response = await ai.models.generateContent({
  model: "gemini-3-flash-preview",
  contents: "Tell me about the book 'I, Claudius'",
  config: {
    tools: [
      {
        fileSearch: {
          fileSearchStoreNames: [fileSearchStore.name],
          metadataFilter: 'author="Robert Graves"',
        }
      }
    ]
  }
});

console.log(response.text);

REST

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-flash-preview:generateContent?key=${GEMINI_API_KEY}" \
    -H 'Content-Type: application/json' \
    -X POST \
    -d '{
            "contents": [{
                "parts":[{"text": "Tell me about the book I, Claudius"}]
            }],
            "tools": [{
                "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 पर देखी जा सकती है

उद्धरण

फ़ाइलें खोजने के टूल का इस्तेमाल करने पर, मॉडल के जवाब में उद्धरण शामिल हो सकते हैं. इनसे यह पता चलता है कि जवाब जनरेट करने के लिए, अपलोड किए गए दस्तावेज़ों के किन हिस्सों का इस्तेमाल किया गया है. इससे, तथ्यों की जांच और पुष्टि करने में मदद मिलती है.

जवाब के grounding_metadata एट्रिब्यूट से, उद्धरण की जानकारी ऐक्सेस की जा सकती है.

Python

print(response.candidates[0].grounding_metadata)

JavaScript

console.log(JSON.stringify(response.candidates?.[0]?.groundingMetadata, null, 2));

ग्राउंडिंग मेटाडेटा के स्ट्रक्चर के बारे में ज़्यादा जानकारी पाने के लिए, फ़ाइलें खोजने के टूल के कुकबुक में दिए गए उदाहरण या Google Search की मदद से ग्राउंडिंग के दस्तावेज़ों का ग्राउंडिंग सेक्शन देखें.

ग्राउंडिंग डेटा में कस्टम मेटाडेटा

अगर आपने अपनी फ़ाइलों में कस्टम मेटाडेटा जोड़ा है, तो मॉडल के जवाब के ग्राउंडिंग मेटाडेटा में उसे ऐक्सेस किया जा सकता है. यह, सोर्स दस्तावेज़ों से अपने ऐप्लिकेशन लॉजिक में अतिरिक्त कॉन्टेक्स्ट (जैसे, यूआरएल, पेज नंबर या लेखक) पास करने के लिए काम का है. retrieved_context में मौजूद हर grounding_chunk में, यह कस्टम मेटाडेटा शामिल होता है.

Python

response = client.models.generate_content(
    model="gemini-3-flash-preview",
    contents="Tell me about [insert question]",
    config=types.GenerateContentConfig(
        tools=[
            types.Tool(
                file_search=types.FileSearch(
                    file_search_store_names=[file_search_store.name]
                )
            )
        ]
    )
)

for chunk in response.candidates[0].grounding_metadata.grounding_chunks:
    if chunk.retrieved_context:
        print(f"Text: {chunk.retrieved_context.text}")
        if chunk.retrieved_context.custom_metadata:
            for metadata in chunk.retrieved_context.custom_metadata:
                print(f"Metadata Key: {metadata.key}")
                print(f"Value: {metadata.string_value or metadata.numeric_value}")

JavaScript

const response = await ai.models.generateContent({
  model: "gemini-3-flash-preview",
  contents: "Tell me about [insert question]",
  config: {
    tools: [
      {
        fileSearch: {
          fileSearchStoreNames: [fileSearchStore.name]
        }
      }
    ]
  }
});

const groundingMetadata = response.candidates[0].groundingMetadata;
groundingMetadata.groundingChunks.forEach((chunk) => {
  if (chunk.retrievedContext) {
    console.log(`Text: ${chunk.retrievedContext.text}`);
    if (chunk.retrievedContext.customMetadata) {
      chunk.retrievedContext.customMetadata.forEach((metadata) => {
        console.log(`Metadata Key: ${metadata.key}`);
        console.log(`Value: ${metadata.stringValue || metadata.numericValue}`);
      });
    }
  }
});

REST

{
  "candidates": [
    {
      "content": { ... },
      "grounding_metadata": {
        "grounding_chunks": [
          {
            "retrieved_context": {
              "text": "...",
              "title": "...",
              "uri": "...",
              "custom_metadata": [
                {
                  "key": "author",
                  "string_value": "Robert Graves"
                },
                {
                  "key": "year",
                  "numeric_value": 1934
                }
              ]
            }
          }
        ],
        "grounding_supports": [ ... ]
      }
    }
  ]
}

स्ट्रक्चर्ड आउटपुट

Gemini 3 मॉडल से, फ़ाइलें खोजने के टूल को स्ट्रक्चर्ड आउटपुट के साथ जोड़ा जा सकता है.

Python

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.")

response = client.models.generate_content(
    model="gemini-3-flash-preview",
    contents="What is the minimum hourly wage in Tokyo right now?",
    config=types.GenerateContentConfig(
                tools=[
                    types.Tool(
                        file_search=types.FileSearch(
                            file_search_store_names=[file_search_store.name]
                        )
                    )
                ],
                response_mime_type="application/json",
                response_schema=Money.model_json_schema()
      )
)
result = Money.model_validate_json(response.text)
print(result)

JavaScript

import { z } from "zod";

const moneySchema = z.object({
  amount: z.string().describe("The numerical part of the amount."),
  currency: z.string().describe("The currency of amount."),
});

async function run() {
  const response = await ai.models.generateContent({
    model: "gemini-3-flash-preview",
    contents: "What is the minimum hourly wage in Tokyo right now?",
    config: {
      tools: [
        {
          fileSearch: {
            fileSearchStoreNames: [file_search_store.name],
          },
        },
      ],
      responseMimeType: "application/json",
      responseJsonSchema: z.toJSONSchema(moneySchema),
    },
  });

  const result = moneySchema.parse(JSON.parse(response.text));
  console.log(result);
}

run();

REST

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-flash-preview:generateContent" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -X POST \
  -d '{
    "contents": [{
      "parts": [{"text": "What is the minimum hourly wage in Tokyo right now?"}]
    }],
    "tools": [
      {
        "fileSearch": {
          "fileSearchStoreNames": ["$FILE_SEARCH_STORE_NAME"]
        }
      }
    ],
    "generationConfig": {
        "responseMimeType": "application/json",
        "responseJsonSchema": {
            "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 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

सीमाएं

दर की सीमाएं

सेवा की स्थिरता बनाए रखने के लिए, फ़ाइलें खोजने के एपीआई पर ये सीमाएं लागू होती हैं:

  • फ़ाइल का ज़्यादा से ज़्यादा साइज़ / हर दस्तावेज़ की सीमा: 100 एमबी
  • प्रोजेक्ट के फ़ाइलें खोजने के स्टोर का कुल साइज़ (उपयोगकर्ता के टियर के हिसाब से):
    • मुफ़्त: 1 जीबी
    • टियर 1: 10 जीबी
    • टियर 2: 100 जीबी
    • टियर 3: 1 टीबी
  • सुझाव: फ़ाइलें खोजने के हर स्टोर का साइज़ 20 जीबी से कम रखें, ताकि जानकारी को आसानी से खोजा जा सके.

कीमत

  • डेवलपर से, इंडेक्सिंग के समय एंबेडिंग के लिए शुल्क लिया जाता है. यह शुल्क, एंबेडिंग की मौजूदा कीमत (10 लाख टोकन के लिए 0.15 डॉलर) के हिसाब से लिया जाता है.
  • स्टोरेज के लिए कोई शुल्क नहीं लिया जाता.
  • क्वेरी के समय एंबेडिंग के लिए कोई शुल्क नहीं लिया जाता.
  • खोजे गए दस्तावेज़ों के टोकन के लिए, सामान्य कॉन्टेक्स्ट टोकन के तौर पर शुल्क लिया जाता है.

आगे क्या करना है