microsoft-foundry.rest.security.o-auth2-auth
Vector stores
Get a vector store file content
GET
/openai/v1/vector_stores/{vector_store_id}/files/{file_id}/content
Retrieves a vector store file content by its identifier.
Yol parametreleri
vector_store_id
string
gerekli
The ID of the vector store.
file_id
string
gerekli
The ID of the file within the vector store.
Yanıtlar
The request has succeeded.
Gövde
Content-Type: application/json
object
enum
gerekli
The object type, which is always vector_store.file_content.page
vector_store.file_content.page
data
OpenAI.VectorStoreFileContentResponseData[]
gerekli
Parsed content of the file.
has_more
boolean
gerekli
Indicates if there are more content pages to fetch.
next_page
string | null
gerekli
İstek
curl \
https://api.openai.com/v1/vector_stores/vs_abc123/files/file-abc123/content \
-H "Authorization: Bearer $OPENAI_API_KEY"
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const fileContentResponse of client.vectorStores.files.content('file-abc123', {
vector_store_id: 'vs_abc123',
})) {
console.log(fileContentResponse.text);
}
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
page = client.vector_stores.files.content(
file_id="file-abc123",
vector_store_id="vs_abc123",
)
page = page.data[0]
print(page.text)
package main
import (
"context"
"fmt"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.VectorStores.Files.Content(
context.TODO(),
"vs_abc123",
"file-abc123",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v
", page)
}
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.files.FileContentPage;
import com.openai.models.vectorstores.files.FileContentParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FileContentParams params = FileContentParams.builder()
.vectorStoreId("vs_abc123")
.fileId("file-abc123")
.build();
FileContentPage page = client.vectorStores().files().content(params);
}
}
require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
page = openai.vector_stores.files.content("file-abc123", vector_store_id: "vs_abc123")
puts(page)
Response
{
"file_id": "file-abc123",
"filename": "example.txt",
"attributes": {"key": "value"},
"content": [
{"type": "text", "text": "..."},
...
]
}