Vector Stores
List vector stores
VectorStoreListPage vectorStores().list(VectorStoreListParamsparams = VectorStoreListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /vector_stores
Returns a list of vector stores.
Parameters
-
VectorStoreListParams params-
Optional<String> afterA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
Optional<String> beforeA cursor for use in pagination.
beforeis an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. -
Optional<Long> limitA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Optional<Order> orderSort order by the
created_attimestamp of the objects.ascfor ascending order anddescfor descending order.-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class VectorStore:A vector store is a collection of processed files can be used by the
file_searchtool.-
String idThe identifier, which can be referenced in API endpoints.
-
long createdAtThe Unix timestamp (in seconds) for when the vector store was created.
-
FileCounts fileCounts-
long cancelledThe number of files that were cancelled.
-
long completedThe number of files that have been successfully processed.
-
long failedThe number of files that have failed to process.
-
long inProgressThe number of files that are currently being processed.
-
long totalThe total number of files.
-
-
Optional<Long> lastActiveAtThe Unix timestamp (in seconds) for when the vector store was last active.
-
Optional<Metadata> metadataSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
String nameThe name of the vector store.
-
JsonValue; object_ "vector_store"constantThe object type, which is always
vector_store.VECTOR_STORE("vector_store")
-
Status statusThe status of the vector store, which can be either
expired,in_progress, orcompleted. A status ofcompletedindicates that the vector store is ready for use.-
EXPIRED("expired") -
IN_PROGRESS("in_progress") -
COMPLETED("completed")
-
-
long usageBytesThe total number of bytes used by the files in the vector store.
-
Optional<ExpiresAfter> expiresAfterThe expiration policy for a vector store.
-
JsonValue; anchor "last_active_at"constantAnchor timestamp after which the expiration policy applies. Supported anchors:
last_active_at.LAST_ACTIVE_AT("last_active_at")
-
long daysThe number of days after the anchor time that the vector store will expire.
-
-
Optional<Long> expiresAtThe Unix timestamp (in seconds) for when the vector store will expire.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.VectorStoreListPage;
import com.openai.models.vectorstores.VectorStoreListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
VectorStoreListPage page = client.vectorStores().list();
}
}
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"file_counts": {
"cancelled": 0,
"completed": 0,
"failed": 0,
"in_progress": 0,
"total": 0
},
"last_active_at": 0,
"metadata": {
"foo": "string"
},
"name": "name",
"object": "vector_store",
"status": "expired",
"usage_bytes": 0,
"expires_after": {
"anchor": "last_active_at",
"days": 1
},
"expires_at": 0
}
],
"first_id": "vs_abc123",
"has_more": false,
"last_id": "vs_abc456",
"object": "list"
}
Create vector store
VectorStore vectorStores().create(VectorStoreCreateParamsparams = VectorStoreCreateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
post /vector_stores
Create a vector store.
Parameters
-
VectorStoreCreateParams params-
Optional<FileChunkingStrategyParam> chunkingStrategyThe chunking strategy used to chunk the file(s). If not set, will use the
autostrategy. Only applicable iffile_idsis non-empty. -
Optional<String> descriptionA description for the vector store. Can be used to describe the vector store's purpose.
-
Optional<ExpiresAfter> expiresAfterThe expiration policy for a vector store.
-
JsonValue; anchor "last_active_at"constantAnchor timestamp after which the expiration policy applies. Supported anchors:
last_active_at.LAST_ACTIVE_AT("last_active_at")
-
long daysThe number of days after the anchor time that the vector store will expire.
-
-
Optional<List<String>> fileIdsA list of File IDs that the vector store should use. Useful for tools like
file_searchthat can access files. -
Optional<Metadata> metadataSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
Optional<String> nameThe name of the vector store.
-
Returns
-
class VectorStore:A vector store is a collection of processed files can be used by the
file_searchtool.-
String idThe identifier, which can be referenced in API endpoints.
-
long createdAtThe Unix timestamp (in seconds) for when the vector store was created.
-
FileCounts fileCounts-
long cancelledThe number of files that were cancelled.
-
long completedThe number of files that have been successfully processed.
-
long failedThe number of files that have failed to process.
-
long inProgressThe number of files that are currently being processed.
-
long totalThe total number of files.
-
-
Optional<Long> lastActiveAtThe Unix timestamp (in seconds) for when the vector store was last active.
-
Optional<Metadata> metadataSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
String nameThe name of the vector store.
-
JsonValue; object_ "vector_store"constantThe object type, which is always
vector_store.VECTOR_STORE("vector_store")
-
Status statusThe status of the vector store, which can be either
expired,in_progress, orcompleted. A status ofcompletedindicates that the vector store is ready for use.-
EXPIRED("expired") -
IN_PROGRESS("in_progress") -
COMPLETED("completed")
-
-
long usageBytesThe total number of bytes used by the files in the vector store.
-
Optional<ExpiresAfter> expiresAfterThe expiration policy for a vector store.
-
JsonValue; anchor "last_active_at"constantAnchor timestamp after which the expiration policy applies. Supported anchors:
last_active_at.LAST_ACTIVE_AT("last_active_at")
-
long daysThe number of days after the anchor time that the vector store will expire.
-
-
Optional<Long> expiresAtThe Unix timestamp (in seconds) for when the vector store will expire.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.VectorStore;
import com.openai.models.vectorstores.VectorStoreCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
VectorStore vectorStore = client.vectorStores().create();
}
}
Response
{
"id": "id",
"created_at": 0,
"file_counts": {
"cancelled": 0,
"completed": 0,
"failed": 0,
"in_progress": 0,
"total": 0
},
"last_active_at": 0,
"metadata": {
"foo": "string"
},
"name": "name",
"object": "vector_store",
"status": "expired",
"usage_bytes": 0,
"expires_after": {
"anchor": "last_active_at",
"days": 1
},
"expires_at": 0
}
Retrieve vector store
VectorStore vectorStores().retrieve(VectorStoreRetrieveParamsparams = VectorStoreRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /vector_stores/{vector_store_id}
Retrieves a vector store.
Parameters
-
VectorStoreRetrieveParams paramsOptional<String> vectorStoreId
Returns
-
class VectorStore:A vector store is a collection of processed files can be used by the
file_searchtool.-
String idThe identifier, which can be referenced in API endpoints.
-
long createdAtThe Unix timestamp (in seconds) for when the vector store was created.
-
FileCounts fileCounts-
long cancelledThe number of files that were cancelled.
-
long completedThe number of files that have been successfully processed.
-
long failedThe number of files that have failed to process.
-
long inProgressThe number of files that are currently being processed.
-
long totalThe total number of files.
-
-
Optional<Long> lastActiveAtThe Unix timestamp (in seconds) for when the vector store was last active.
-
Optional<Metadata> metadataSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
String nameThe name of the vector store.
-
JsonValue; object_ "vector_store"constantThe object type, which is always
vector_store.VECTOR_STORE("vector_store")
-
Status statusThe status of the vector store, which can be either
expired,in_progress, orcompleted. A status ofcompletedindicates that the vector store is ready for use.-
EXPIRED("expired") -
IN_PROGRESS("in_progress") -
COMPLETED("completed")
-
-
long usageBytesThe total number of bytes used by the files in the vector store.
-
Optional<ExpiresAfter> expiresAfterThe expiration policy for a vector store.
-
JsonValue; anchor "last_active_at"constantAnchor timestamp after which the expiration policy applies. Supported anchors:
last_active_at.LAST_ACTIVE_AT("last_active_at")
-
long daysThe number of days after the anchor time that the vector store will expire.
-
-
Optional<Long> expiresAtThe Unix timestamp (in seconds) for when the vector store will expire.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.VectorStore;
import com.openai.models.vectorstores.VectorStoreRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
VectorStore vectorStore = client.vectorStores().retrieve("vector_store_id");
}
}
Response
{
"id": "id",
"created_at": 0,
"file_counts": {
"cancelled": 0,
"completed": 0,
"failed": 0,
"in_progress": 0,
"total": 0
},
"last_active_at": 0,
"metadata": {
"foo": "string"
},
"name": "name",
"object": "vector_store",
"status": "expired",
"usage_bytes": 0,
"expires_after": {
"anchor": "last_active_at",
"days": 1
},
"expires_at": 0
}
Modify vector store
VectorStore vectorStores().update(VectorStoreUpdateParamsparams = VectorStoreUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
post /vector_stores/{vector_store_id}
Modifies a vector store.
Parameters
-
VectorStoreUpdateParams params-
Optional<String> vectorStoreId -
Optional<ExpiresAfter> expiresAfterThe expiration policy for a vector store.
-
JsonValue; anchor "last_active_at"constantAnchor timestamp after which the expiration policy applies. Supported anchors:
last_active_at.LAST_ACTIVE_AT("last_active_at")
-
long daysThe number of days after the anchor time that the vector store will expire.
-
-
Optional<Metadata> metadataSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
Optional<String> nameThe name of the vector store.
-
Returns
-
class VectorStore:A vector store is a collection of processed files can be used by the
file_searchtool.-
String idThe identifier, which can be referenced in API endpoints.
-
long createdAtThe Unix timestamp (in seconds) for when the vector store was created.
-
FileCounts fileCounts-
long cancelledThe number of files that were cancelled.
-
long completedThe number of files that have been successfully processed.
-
long failedThe number of files that have failed to process.
-
long inProgressThe number of files that are currently being processed.
-
long totalThe total number of files.
-
-
Optional<Long> lastActiveAtThe Unix timestamp (in seconds) for when the vector store was last active.
-
Optional<Metadata> metadataSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
String nameThe name of the vector store.
-
JsonValue; object_ "vector_store"constantThe object type, which is always
vector_store.VECTOR_STORE("vector_store")
-
Status statusThe status of the vector store, which can be either
expired,in_progress, orcompleted. A status ofcompletedindicates that the vector store is ready for use.-
EXPIRED("expired") -
IN_PROGRESS("in_progress") -
COMPLETED("completed")
-
-
long usageBytesThe total number of bytes used by the files in the vector store.
-
Optional<ExpiresAfter> expiresAfterThe expiration policy for a vector store.
-
JsonValue; anchor "last_active_at"constantAnchor timestamp after which the expiration policy applies. Supported anchors:
last_active_at.LAST_ACTIVE_AT("last_active_at")
-
long daysThe number of days after the anchor time that the vector store will expire.
-
-
Optional<Long> expiresAtThe Unix timestamp (in seconds) for when the vector store will expire.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.VectorStore;
import com.openai.models.vectorstores.VectorStoreUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
VectorStore vectorStore = client.vectorStores().update("vector_store_id");
}
}
Response
{
"id": "id",
"created_at": 0,
"file_counts": {
"cancelled": 0,
"completed": 0,
"failed": 0,
"in_progress": 0,
"total": 0
},
"last_active_at": 0,
"metadata": {
"foo": "string"
},
"name": "name",
"object": "vector_store",
"status": "expired",
"usage_bytes": 0,
"expires_after": {
"anchor": "last_active_at",
"days": 1
},
"expires_at": 0
}
Delete vector store
VectorStoreDeleted vectorStores().delete(VectorStoreDeleteParamsparams = VectorStoreDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
delete /vector_stores/{vector_store_id}
Delete a vector store.
Parameters
-
VectorStoreDeleteParams paramsOptional<String> vectorStoreId
Returns
-
class VectorStoreDeleted:-
String id -
boolean deleted -
JsonValue; object_ "vector_store.deleted"constantVECTOR_STORE_DELETED("vector_store.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.VectorStoreDeleteParams;
import com.openai.models.vectorstores.VectorStoreDeleted;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
VectorStoreDeleted vectorStoreDeleted = client.vectorStores().delete("vector_store_id");
}
}
Response
{
"id": "id",
"deleted": true,
"object": "vector_store.deleted"
}
Search vector store
VectorStoreSearchPage vectorStores().search(VectorStoreSearchParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /vector_stores/{vector_store_id}/search
Search a vector store for relevant chunks based on a query and file attributes filter.
Parameters
-
VectorStoreSearchParams params-
Optional<String> vectorStoreId -
Query queryA query string for a search
-
String -
List<String>
-
-
Optional<Filters> filtersA filter to apply based on file attributes.
-
class ComparisonFilter:A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
String keyThe key to compare against the value.
-
Type typeSpecifies the comparison operator:
eq,ne,gt,gte,lt,lte,in,nin.-
eq: equals -
ne: not equal -
gt: greater than -
gte: greater than or equal -
lt: less than -
lte: less than or equal -
in: in -
nin: not in -
EQ("eq") -
NE("ne") -
GT("gt") -
GTE("gte") -
LT("lt") -
LTE("lte") -
IN("in") -
NIN("nin")
-
-
Value valueThe value to compare against the attribute key; supports string, number, or boolean types.
-
String -
double -
boolean -
List<ComparisonFilterValueItem>-
String -
double
-
-
-
-
class CompoundFilter:Combine multiple filters using
andoror.-
List<Filter> filtersArray of filters to combine. Items can be
ComparisonFilterorCompoundFilter.-
class ComparisonFilter:A filter used to compare a specified attribute key to a given value using a defined comparison operation.
-
JsonValue
-
-
Type typeType of operation:
andoror.-
AND("and") -
OR("or")
-
-
-
-
Optional<Long> maxNumResultsThe maximum number of results to return. This number should be between 1 and 50 inclusive.
-
Optional<RankingOptions> rankingOptionsRanking options for search.
-
Optional<Ranker> rankerEnable re-ranking; set to
noneto disable, which can help reduce latency.-
NONE("none") -
AUTO("auto") -
DEFAULT_2024_11_15("default-2024-11-15")
-
-
Optional<Double> scoreThreshold
-
-
Optional<Boolean> rewriteQueryWhether to rewrite the natural language query for vector search.
-
Returns
-
class VectorStoreSearchResponse:-
Optional<Attributes> attributesSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.
-
String -
double -
boolean
-
-
List<Content> contentContent chunks from the file.
-
String textThe text content returned from search.
-
Type typeThe type of content.
TEXT("text")
-
-
String fileIdThe ID of the vector store file.
-
String filenameThe name of the vector store file.
-
double scoreThe similarity score for the result.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.VectorStoreSearchPage;
import com.openai.models.vectorstores.VectorStoreSearchParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
VectorStoreSearchParams params = VectorStoreSearchParams.builder()
.vectorStoreId("vs_abc123")
.query("string")
.build();
VectorStoreSearchPage page = client.vectorStores().search(params);
}
}
Response
{
"data": [
{
"attributes": {
"foo": "string"
},
"content": [
{
"text": "text",
"type": "text"
}
],
"file_id": "file_id",
"filename": "filename",
"score": 0
}
],
"has_more": true,
"next_page": "next_page",
"object": "vector_store.search_results.page",
"search_query": [
"string"
]
}
Domain Types
Auto File Chunking Strategy Param
-
class AutoFileChunkingStrategyParam:The default strategy. This strategy currently uses a
max_chunk_size_tokensof800andchunk_overlap_tokensof400.-
JsonValue; type "auto"constantAlways
auto.AUTO("auto")
-
File Chunking Strategy
-
class FileChunkingStrategy: A class that can be one of several variants.unionThe strategy used to chunk the file.
-
class StaticFileChunkingStrategyObject:-
StaticFileChunkingStrategy static_-
long chunkOverlapTokensThe number of tokens that overlap between chunks. The default value is
400.Note that the overlap must not exceed half of
max_chunk_size_tokens. -
long maxChunkSizeTokensThe maximum number of tokens in each chunk. The default value is
800. The minimum value is100and the maximum value is4096.
-
-
JsonValue; type "static"constantAlways
static.STATIC("static")
-
-
class OtherFileChunkingStrategyObject:This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the
chunking_strategyconcept was introduced in the API.-
JsonValue; type "other"constantAlways
other.OTHER("other")
-
-
File Chunking Strategy Param
-
class FileChunkingStrategyParam: A class that can be one of several variants.unionThe chunking strategy used to chunk the file(s). If not set, will use the
autostrategy. Only applicable iffile_idsis non-empty.-
class AutoFileChunkingStrategyParam:The default strategy. This strategy currently uses a
max_chunk_size_tokensof800andchunk_overlap_tokensof400.-
JsonValue; type "auto"constantAlways
auto.AUTO("auto")
-
-
class StaticFileChunkingStrategyObjectParam:Customize your own chunking strategy by setting chunk size and chunk overlap.
-
StaticFileChunkingStrategy static_-
long chunkOverlapTokensThe number of tokens that overlap between chunks. The default value is
400.Note that the overlap must not exceed half of
max_chunk_size_tokens. -
long maxChunkSizeTokensThe maximum number of tokens in each chunk. The default value is
800. The minimum value is100and the maximum value is4096.
-
-
JsonValue; type "static"constantAlways
static.STATIC("static")
-
-
Other File Chunking Strategy Object
-
class OtherFileChunkingStrategyObject:This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the
chunking_strategyconcept was introduced in the API.-
JsonValue; type "other"constantAlways
other.OTHER("other")
-
Static File Chunking Strategy
-
class StaticFileChunkingStrategy:-
long chunkOverlapTokensThe number of tokens that overlap between chunks. The default value is
400.Note that the overlap must not exceed half of
max_chunk_size_tokens. -
long maxChunkSizeTokensThe maximum number of tokens in each chunk. The default value is
800. The minimum value is100and the maximum value is4096.
-
Static File Chunking Strategy Object
-
class StaticFileChunkingStrategyObject:-
StaticFileChunkingStrategy static_-
long chunkOverlapTokensThe number of tokens that overlap between chunks. The default value is
400.Note that the overlap must not exceed half of
max_chunk_size_tokens. -
long maxChunkSizeTokensThe maximum number of tokens in each chunk. The default value is
800. The minimum value is100and the maximum value is4096.
-
-
JsonValue; type "static"constantAlways
static.STATIC("static")
-
Static File Chunking Strategy Object Param
-
class StaticFileChunkingStrategyObjectParam:Customize your own chunking strategy by setting chunk size and chunk overlap.
-
StaticFileChunkingStrategy static_-
long chunkOverlapTokensThe number of tokens that overlap between chunks. The default value is
400.Note that the overlap must not exceed half of
max_chunk_size_tokens. -
long maxChunkSizeTokensThe maximum number of tokens in each chunk. The default value is
800. The minimum value is100and the maximum value is4096.
-
-
JsonValue; type "static"constantAlways
static.STATIC("static")
-
Vector Store
-
class VectorStore:A vector store is a collection of processed files can be used by the
file_searchtool.-
String idThe identifier, which can be referenced in API endpoints.
-
long createdAtThe Unix timestamp (in seconds) for when the vector store was created.
-
FileCounts fileCounts-
long cancelledThe number of files that were cancelled.
-
long completedThe number of files that have been successfully processed.
-
long failedThe number of files that have failed to process.
-
long inProgressThe number of files that are currently being processed.
-
long totalThe total number of files.
-
-
Optional<Long> lastActiveAtThe Unix timestamp (in seconds) for when the vector store was last active.
-
Optional<Metadata> metadataSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
String nameThe name of the vector store.
-
JsonValue; object_ "vector_store"constantThe object type, which is always
vector_store.VECTOR_STORE("vector_store")
-
Status statusThe status of the vector store, which can be either
expired,in_progress, orcompleted. A status ofcompletedindicates that the vector store is ready for use.-
EXPIRED("expired") -
IN_PROGRESS("in_progress") -
COMPLETED("completed")
-
-
long usageBytesThe total number of bytes used by the files in the vector store.
-
Optional<ExpiresAfter> expiresAfterThe expiration policy for a vector store.
-
JsonValue; anchor "last_active_at"constantAnchor timestamp after which the expiration policy applies. Supported anchors:
last_active_at.LAST_ACTIVE_AT("last_active_at")
-
long daysThe number of days after the anchor time that the vector store will expire.
-
-
Optional<Long> expiresAtThe Unix timestamp (in seconds) for when the vector store will expire.
-
Vector Store Deleted
-
class VectorStoreDeleted:-
String id -
boolean deleted -
JsonValue; object_ "vector_store.deleted"constantVECTOR_STORE_DELETED("vector_store.deleted")
-
Files
List vector store files
FileListPage vectorStores().files().list(FileListParamsparams = FileListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
get /vector_stores/{vector_store_id}/files
Returns a list of vector store files.
Parameters
-
FileListParams params-
Optional<String> vectorStoreId -
Optional<String> afterA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
Optional<String> beforeA cursor for use in pagination.
beforeis an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. -
Optional<Filter> filterFilter by file status. One of
in_progress,completed,failed,cancelled.-
IN_PROGRESS("in_progress") -
COMPLETED("completed") -
FAILED("failed") -
CANCELLED("cancelled")
-
-
Optional<Long> limitA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Optional<Order> orderSort order by the
created_attimestamp of the objects.ascfor ascending order anddescfor descending order.-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class VectorStoreFile:A list of files attached to a vector store.
-
String idThe identifier, which can be referenced in API endpoints.
-
long createdAtThe Unix timestamp (in seconds) for when the vector store file was created.
-
Optional<LastError> lastErrorThe last error associated with this vector store file. Will be
nullif there are no errors.-
Code codeOne of
server_error,unsupported_file, orinvalid_file.-
SERVER_ERROR("server_error") -
UNSUPPORTED_FILE("unsupported_file") -
INVALID_FILE("invalid_file")
-
-
String messageA human-readable description of the error.
-
-
JsonValue; object_ "vector_store.file"constantThe object type, which is always
vector_store.file.VECTOR_STORE_FILE("vector_store.file")
-
Status statusThe status of the vector store file, which can be either
in_progress,completed,cancelled, orfailed. The statuscompletedindicates that the vector store file is ready for use.-
IN_PROGRESS("in_progress") -
COMPLETED("completed") -
CANCELLED("cancelled") -
FAILED("failed")
-
-
long usageBytesThe total vector store usage in bytes. Note that this may be different from the original file size.
-
String vectorStoreIdThe ID of the vector store that the File is attached to.
-
Optional<Attributes> attributesSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.
-
String -
double -
boolean
-
-
Optional<FileChunkingStrategy> chunkingStrategyThe strategy used to chunk the file.
-
class StaticFileChunkingStrategyObject:-
StaticFileChunkingStrategy static_-
long chunkOverlapTokensThe number of tokens that overlap between chunks. The default value is
400.Note that the overlap must not exceed half of
max_chunk_size_tokens. -
long maxChunkSizeTokensThe maximum number of tokens in each chunk. The default value is
800. The minimum value is100and the maximum value is4096.
-
-
JsonValue; type "static"constantAlways
static.STATIC("static")
-
-
class OtherFileChunkingStrategyObject:This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the
chunking_strategyconcept was introduced in the API.-
JsonValue; type "other"constantAlways
other.OTHER("other")
-
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.files.FileListPage;
import com.openai.models.vectorstores.files.FileListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FileListPage page = client.vectorStores().files().list("vector_store_id");
}
}
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"last_error": {
"code": "server_error",
"message": "message"
},
"object": "vector_store.file",
"status": "in_progress",
"usage_bytes": 0,
"vector_store_id": "vector_store_id",
"attributes": {
"foo": "string"
},
"chunking_strategy": {
"static": {
"chunk_overlap_tokens": 0,
"max_chunk_size_tokens": 100
},
"type": "static"
}
}
],
"first_id": "file-abc123",
"has_more": false,
"last_id": "file-abc456",
"object": "list"
}
Create vector store file
VectorStoreFile vectorStores().files().create(FileCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /vector_stores/{vector_store_id}/files
Create a vector store file by attaching a File to a vector store.
Parameters
-
FileCreateParams params-
Optional<String> vectorStoreId -
String fileIdA File ID that the vector store should use. Useful for tools like
file_searchthat can access files. For multi-file ingestion, we recommendfile_batchesto minimize per-vector-store write requests. -
Optional<Attributes> attributesSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.
-
String -
double -
boolean
-
-
Optional<FileChunkingStrategyParam> chunkingStrategyThe chunking strategy used to chunk the file(s). If not set, will use the
autostrategy. Only applicable iffile_idsis non-empty.
-
Returns
-
class VectorStoreFile:A list of files attached to a vector store.
-
String idThe identifier, which can be referenced in API endpoints.
-
long createdAtThe Unix timestamp (in seconds) for when the vector store file was created.
-
Optional<LastError> lastErrorThe last error associated with this vector store file. Will be
nullif there are no errors.-
Code codeOne of
server_error,unsupported_file, orinvalid_file.-
SERVER_ERROR("server_error") -
UNSUPPORTED_FILE("unsupported_file") -
INVALID_FILE("invalid_file")
-
-
String messageA human-readable description of the error.
-
-
JsonValue; object_ "vector_store.file"constantThe object type, which is always
vector_store.file.VECTOR_STORE_FILE("vector_store.file")
-
Status statusThe status of the vector store file, which can be either
in_progress,completed,cancelled, orfailed. The statuscompletedindicates that the vector store file is ready for use.-
IN_PROGRESS("in_progress") -
COMPLETED("completed") -
CANCELLED("cancelled") -
FAILED("failed")
-
-
long usageBytesThe total vector store usage in bytes. Note that this may be different from the original file size.
-
String vectorStoreIdThe ID of the vector store that the File is attached to.
-
Optional<Attributes> attributesSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.
-
String -
double -
boolean
-
-
Optional<FileChunkingStrategy> chunkingStrategyThe strategy used to chunk the file.
-
class StaticFileChunkingStrategyObject:-
StaticFileChunkingStrategy static_-
long chunkOverlapTokensThe number of tokens that overlap between chunks. The default value is
400.Note that the overlap must not exceed half of
max_chunk_size_tokens. -
long maxChunkSizeTokensThe maximum number of tokens in each chunk. The default value is
800. The minimum value is100and the maximum value is4096.
-
-
JsonValue; type "static"constantAlways
static.STATIC("static")
-
-
class OtherFileChunkingStrategyObject:This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the
chunking_strategyconcept was introduced in the API.-
JsonValue; type "other"constantAlways
other.OTHER("other")
-
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.files.FileCreateParams;
import com.openai.models.vectorstores.files.VectorStoreFile;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FileCreateParams params = FileCreateParams.builder()
.vectorStoreId("vs_abc123")
.fileId("file_id")
.build();
VectorStoreFile vectorStoreFile = client.vectorStores().files().create(params);
}
}
Response
{
"id": "id",
"created_at": 0,
"last_error": {
"code": "server_error",
"message": "message"
},
"object": "vector_store.file",
"status": "in_progress",
"usage_bytes": 0,
"vector_store_id": "vector_store_id",
"attributes": {
"foo": "string"
},
"chunking_strategy": {
"static": {
"chunk_overlap_tokens": 0,
"max_chunk_size_tokens": 100
},
"type": "static"
}
}
Update vector store file attributes
VectorStoreFile vectorStores().files().update(FileUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /vector_stores/{vector_store_id}/files/{file_id}
Update attributes on a vector store file.
Parameters
-
FileUpdateParams params-
String vectorStoreId -
Optional<String> fileId -
Optional<Attributes> attributesSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.
-
String -
double -
boolean
-
-
Returns
-
class VectorStoreFile:A list of files attached to a vector store.
-
String idThe identifier, which can be referenced in API endpoints.
-
long createdAtThe Unix timestamp (in seconds) for when the vector store file was created.
-
Optional<LastError> lastErrorThe last error associated with this vector store file. Will be
nullif there are no errors.-
Code codeOne of
server_error,unsupported_file, orinvalid_file.-
SERVER_ERROR("server_error") -
UNSUPPORTED_FILE("unsupported_file") -
INVALID_FILE("invalid_file")
-
-
String messageA human-readable description of the error.
-
-
JsonValue; object_ "vector_store.file"constantThe object type, which is always
vector_store.file.VECTOR_STORE_FILE("vector_store.file")
-
Status statusThe status of the vector store file, which can be either
in_progress,completed,cancelled, orfailed. The statuscompletedindicates that the vector store file is ready for use.-
IN_PROGRESS("in_progress") -
COMPLETED("completed") -
CANCELLED("cancelled") -
FAILED("failed")
-
-
long usageBytesThe total vector store usage in bytes. Note that this may be different from the original file size.
-
String vectorStoreIdThe ID of the vector store that the File is attached to.
-
Optional<Attributes> attributesSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.
-
String -
double -
boolean
-
-
Optional<FileChunkingStrategy> chunkingStrategyThe strategy used to chunk the file.
-
class StaticFileChunkingStrategyObject:-
StaticFileChunkingStrategy static_-
long chunkOverlapTokensThe number of tokens that overlap between chunks. The default value is
400.Note that the overlap must not exceed half of
max_chunk_size_tokens. -
long maxChunkSizeTokensThe maximum number of tokens in each chunk. The default value is
800. The minimum value is100and the maximum value is4096.
-
-
JsonValue; type "static"constantAlways
static.STATIC("static")
-
-
class OtherFileChunkingStrategyObject:This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the
chunking_strategyconcept was introduced in the API.-
JsonValue; type "other"constantAlways
other.OTHER("other")
-
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.core.JsonValue;
import com.openai.models.vectorstores.files.FileUpdateParams;
import com.openai.models.vectorstores.files.VectorStoreFile;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FileUpdateParams params = FileUpdateParams.builder()
.vectorStoreId("vs_abc123")
.fileId("file-abc123")
.attributes(FileUpdateParams.Attributes.builder()
.putAdditionalProperty("foo", JsonValue.from("string"))
.build())
.build();
VectorStoreFile vectorStoreFile = client.vectorStores().files().update(params);
}
}
Response
{
"id": "id",
"created_at": 0,
"last_error": {
"code": "server_error",
"message": "message"
},
"object": "vector_store.file",
"status": "in_progress",
"usage_bytes": 0,
"vector_store_id": "vector_store_id",
"attributes": {
"foo": "string"
},
"chunking_strategy": {
"static": {
"chunk_overlap_tokens": 0,
"max_chunk_size_tokens": 100
},
"type": "static"
}
}
Retrieve vector store file
VectorStoreFile vectorStores().files().retrieve(FileRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /vector_stores/{vector_store_id}/files/{file_id}
Retrieves a vector store file.
Parameters
-
FileRetrieveParams params-
String vectorStoreId -
Optional<String> fileId
-
Returns
-
class VectorStoreFile:A list of files attached to a vector store.
-
String idThe identifier, which can be referenced in API endpoints.
-
long createdAtThe Unix timestamp (in seconds) for when the vector store file was created.
-
Optional<LastError> lastErrorThe last error associated with this vector store file. Will be
nullif there are no errors.-
Code codeOne of
server_error,unsupported_file, orinvalid_file.-
SERVER_ERROR("server_error") -
UNSUPPORTED_FILE("unsupported_file") -
INVALID_FILE("invalid_file")
-
-
String messageA human-readable description of the error.
-
-
JsonValue; object_ "vector_store.file"constantThe object type, which is always
vector_store.file.VECTOR_STORE_FILE("vector_store.file")
-
Status statusThe status of the vector store file, which can be either
in_progress,completed,cancelled, orfailed. The statuscompletedindicates that the vector store file is ready for use.-
IN_PROGRESS("in_progress") -
COMPLETED("completed") -
CANCELLED("cancelled") -
FAILED("failed")
-
-
long usageBytesThe total vector store usage in bytes. Note that this may be different from the original file size.
-
String vectorStoreIdThe ID of the vector store that the File is attached to.
-
Optional<Attributes> attributesSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.
-
String -
double -
boolean
-
-
Optional<FileChunkingStrategy> chunkingStrategyThe strategy used to chunk the file.
-
class StaticFileChunkingStrategyObject:-
StaticFileChunkingStrategy static_-
long chunkOverlapTokensThe number of tokens that overlap between chunks. The default value is
400.Note that the overlap must not exceed half of
max_chunk_size_tokens. -
long maxChunkSizeTokensThe maximum number of tokens in each chunk. The default value is
800. The minimum value is100and the maximum value is4096.
-
-
JsonValue; type "static"constantAlways
static.STATIC("static")
-
-
class OtherFileChunkingStrategyObject:This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the
chunking_strategyconcept was introduced in the API.-
JsonValue; type "other"constantAlways
other.OTHER("other")
-
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.files.FileRetrieveParams;
import com.openai.models.vectorstores.files.VectorStoreFile;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FileRetrieveParams params = FileRetrieveParams.builder()
.vectorStoreId("vs_abc123")
.fileId("file-abc123")
.build();
VectorStoreFile vectorStoreFile = client.vectorStores().files().retrieve(params);
}
}
Response
{
"id": "id",
"created_at": 0,
"last_error": {
"code": "server_error",
"message": "message"
},
"object": "vector_store.file",
"status": "in_progress",
"usage_bytes": 0,
"vector_store_id": "vector_store_id",
"attributes": {
"foo": "string"
},
"chunking_strategy": {
"static": {
"chunk_overlap_tokens": 0,
"max_chunk_size_tokens": 100
},
"type": "static"
}
}
Delete vector store file
VectorStoreFileDeleted vectorStores().files().delete(FileDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
delete /vector_stores/{vector_store_id}/files/{file_id}
Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the delete file endpoint.
Parameters
-
FileDeleteParams params-
String vectorStoreId -
Optional<String> fileId
-
Returns
-
class VectorStoreFileDeleted:-
String id -
boolean deleted -
JsonValue; object_ "vector_store.file.deleted"constantVECTOR_STORE_FILE_DELETED("vector_store.file.deleted")
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.files.FileDeleteParams;
import com.openai.models.vectorstores.files.VectorStoreFileDeleted;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FileDeleteParams params = FileDeleteParams.builder()
.vectorStoreId("vector_store_id")
.fileId("file_id")
.build();
VectorStoreFileDeleted vectorStoreFileDeleted = client.vectorStores().files().delete(params);
}
}
Response
{
"id": "id",
"deleted": true,
"object": "vector_store.file.deleted"
}
Retrieve vector store file content
FileContentPage vectorStores().files().content(FileContentParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /vector_stores/{vector_store_id}/files/{file_id}/content
Retrieve the parsed contents of a vector store file.
Parameters
-
FileContentParams params-
String vectorStoreId -
Optional<String> fileId
-
Returns
-
class FileContentResponse:-
Optional<String> textThe text content
-
Optional<String> typeThe content type (currently only
"text")
-
Example
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);
}
}
Response
{
"data": [
{
"text": "text",
"type": "type"
}
],
"has_more": true,
"next_page": "next_page",
"object": "vector_store.file_content.page"
}
Domain Types
Vector Store File
-
class VectorStoreFile:A list of files attached to a vector store.
-
String idThe identifier, which can be referenced in API endpoints.
-
long createdAtThe Unix timestamp (in seconds) for when the vector store file was created.
-
Optional<LastError> lastErrorThe last error associated with this vector store file. Will be
nullif there are no errors.-
Code codeOne of
server_error,unsupported_file, orinvalid_file.-
SERVER_ERROR("server_error") -
UNSUPPORTED_FILE("unsupported_file") -
INVALID_FILE("invalid_file")
-
-
String messageA human-readable description of the error.
-
-
JsonValue; object_ "vector_store.file"constantThe object type, which is always
vector_store.file.VECTOR_STORE_FILE("vector_store.file")
-
Status statusThe status of the vector store file, which can be either
in_progress,completed,cancelled, orfailed. The statuscompletedindicates that the vector store file is ready for use.-
IN_PROGRESS("in_progress") -
COMPLETED("completed") -
CANCELLED("cancelled") -
FAILED("failed")
-
-
long usageBytesThe total vector store usage in bytes. Note that this may be different from the original file size.
-
String vectorStoreIdThe ID of the vector store that the File is attached to.
-
Optional<Attributes> attributesSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.
-
String -
double -
boolean
-
-
Optional<FileChunkingStrategy> chunkingStrategyThe strategy used to chunk the file.
-
class StaticFileChunkingStrategyObject:-
StaticFileChunkingStrategy static_-
long chunkOverlapTokensThe number of tokens that overlap between chunks. The default value is
400.Note that the overlap must not exceed half of
max_chunk_size_tokens. -
long maxChunkSizeTokensThe maximum number of tokens in each chunk. The default value is
800. The minimum value is100and the maximum value is4096.
-
-
JsonValue; type "static"constantAlways
static.STATIC("static")
-
-
class OtherFileChunkingStrategyObject:This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the
chunking_strategyconcept was introduced in the API.-
JsonValue; type "other"constantAlways
other.OTHER("other")
-
-
-
Vector Store File Deleted
-
class VectorStoreFileDeleted:-
String id -
boolean deleted -
JsonValue; object_ "vector_store.file.deleted"constantVECTOR_STORE_FILE_DELETED("vector_store.file.deleted")
-
File Batches
Create vector store file batch
VectorStoreFileBatch vectorStores().fileBatches().create(FileBatchCreateParamsparams = FileBatchCreateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())
post /vector_stores/{vector_store_id}/file_batches
Create a vector store file batch.
Parameters
-
FileBatchCreateParams params-
Optional<String> vectorStoreId -
Optional<Attributes> attributesSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.
-
String -
double -
boolean
-
-
Optional<FileChunkingStrategyParam> chunkingStrategyThe chunking strategy used to chunk the file(s). If not set, will use the
autostrategy. Only applicable iffile_idsis non-empty. -
Optional<List<String>> fileIdsA list of File IDs that the vector store should use. Useful for tools like
file_searchthat can access files. Ifattributesorchunking_strategyare provided, they will be applied to all files in the batch. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive withfiles. -
Optional<List<File>> filesA list of objects that each include a
file_idplus optionalattributesorchunking_strategy. Use this when you need to override metadata for specific files. The globalattributesorchunking_strategywill be ignored and must be specified for each file. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive withfile_ids.-
String fileIdA File ID that the vector store should use. Useful for tools like
file_searchthat can access files. For multi-file ingestion, we recommendfile_batchesto minimize per-vector-store write requests. -
Optional<Attributes> attributesSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.
-
String -
double -
boolean
-
-
Optional<FileChunkingStrategyParam> chunkingStrategyThe chunking strategy used to chunk the file(s). If not set, will use the
autostrategy. Only applicable iffile_idsis non-empty.-
class AutoFileChunkingStrategyParam:The default strategy. This strategy currently uses a
max_chunk_size_tokensof800andchunk_overlap_tokensof400.-
JsonValue; type "auto"constantAlways
auto.AUTO("auto")
-
-
class StaticFileChunkingStrategyObjectParam:Customize your own chunking strategy by setting chunk size and chunk overlap.
-
StaticFileChunkingStrategy static_-
long chunkOverlapTokensThe number of tokens that overlap between chunks. The default value is
400.Note that the overlap must not exceed half of
max_chunk_size_tokens. -
long maxChunkSizeTokensThe maximum number of tokens in each chunk. The default value is
800. The minimum value is100and the maximum value is4096.
-
-
JsonValue; type "static"constantAlways
static.STATIC("static")
-
-
-
-
Returns
-
class VectorStoreFileBatch:A batch of files attached to a vector store.
-
String idThe identifier, which can be referenced in API endpoints.
-
long createdAtThe Unix timestamp (in seconds) for when the vector store files batch was created.
-
FileCounts fileCounts-
long cancelledThe number of files that where cancelled.
-
long completedThe number of files that have been processed.
-
long failedThe number of files that have failed to process.
-
long inProgressThe number of files that are currently being processed.
-
long totalThe total number of files.
-
-
JsonValue; object_ "vector_store.files_batch"constantThe object type, which is always
vector_store.file_batch.VECTOR_STORE_FILES_BATCH("vector_store.files_batch")
-
Status statusThe status of the vector store files batch, which can be either
in_progress,completed,cancelledorfailed.-
IN_PROGRESS("in_progress") -
COMPLETED("completed") -
CANCELLED("cancelled") -
FAILED("failed")
-
-
String vectorStoreIdThe ID of the vector store that the File is attached to.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.filebatches.FileBatchCreateParams;
import com.openai.models.vectorstores.filebatches.VectorStoreFileBatch;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().create("vs_abc123");
}
}
Response
{
"id": "id",
"created_at": 0,
"file_counts": {
"cancelled": 0,
"completed": 0,
"failed": 0,
"in_progress": 0,
"total": 0
},
"object": "vector_store.files_batch",
"status": "in_progress",
"vector_store_id": "vector_store_id"
}
Retrieve vector store file batch
VectorStoreFileBatch vectorStores().fileBatches().retrieve(FileBatchRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /vector_stores/{vector_store_id}/file_batches/{batch_id}
Retrieves a vector store file batch.
Parameters
-
FileBatchRetrieveParams params-
String vectorStoreId -
Optional<String> batchId
-
Returns
-
class VectorStoreFileBatch:A batch of files attached to a vector store.
-
String idThe identifier, which can be referenced in API endpoints.
-
long createdAtThe Unix timestamp (in seconds) for when the vector store files batch was created.
-
FileCounts fileCounts-
long cancelledThe number of files that where cancelled.
-
long completedThe number of files that have been processed.
-
long failedThe number of files that have failed to process.
-
long inProgressThe number of files that are currently being processed.
-
long totalThe total number of files.
-
-
JsonValue; object_ "vector_store.files_batch"constantThe object type, which is always
vector_store.file_batch.VECTOR_STORE_FILES_BATCH("vector_store.files_batch")
-
Status statusThe status of the vector store files batch, which can be either
in_progress,completed,cancelledorfailed.-
IN_PROGRESS("in_progress") -
COMPLETED("completed") -
CANCELLED("cancelled") -
FAILED("failed")
-
-
String vectorStoreIdThe ID of the vector store that the File is attached to.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.filebatches.FileBatchRetrieveParams;
import com.openai.models.vectorstores.filebatches.VectorStoreFileBatch;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FileBatchRetrieveParams params = FileBatchRetrieveParams.builder()
.vectorStoreId("vs_abc123")
.batchId("vsfb_abc123")
.build();
VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().retrieve(params);
}
}
Response
{
"id": "id",
"created_at": 0,
"file_counts": {
"cancelled": 0,
"completed": 0,
"failed": 0,
"in_progress": 0,
"total": 0
},
"object": "vector_store.files_batch",
"status": "in_progress",
"vector_store_id": "vector_store_id"
}
Cancel vector store file batch
VectorStoreFileBatch vectorStores().fileBatches().cancel(FileBatchCancelParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
post /vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel
Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.
Parameters
-
FileBatchCancelParams params-
String vectorStoreId -
Optional<String> batchId
-
Returns
-
class VectorStoreFileBatch:A batch of files attached to a vector store.
-
String idThe identifier, which can be referenced in API endpoints.
-
long createdAtThe Unix timestamp (in seconds) for when the vector store files batch was created.
-
FileCounts fileCounts-
long cancelledThe number of files that where cancelled.
-
long completedThe number of files that have been processed.
-
long failedThe number of files that have failed to process.
-
long inProgressThe number of files that are currently being processed.
-
long totalThe total number of files.
-
-
JsonValue; object_ "vector_store.files_batch"constantThe object type, which is always
vector_store.file_batch.VECTOR_STORE_FILES_BATCH("vector_store.files_batch")
-
Status statusThe status of the vector store files batch, which can be either
in_progress,completed,cancelledorfailed.-
IN_PROGRESS("in_progress") -
COMPLETED("completed") -
CANCELLED("cancelled") -
FAILED("failed")
-
-
String vectorStoreIdThe ID of the vector store that the File is attached to.
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.filebatches.FileBatchCancelParams;
import com.openai.models.vectorstores.filebatches.VectorStoreFileBatch;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FileBatchCancelParams params = FileBatchCancelParams.builder()
.vectorStoreId("vector_store_id")
.batchId("batch_id")
.build();
VectorStoreFileBatch vectorStoreFileBatch = client.vectorStores().fileBatches().cancel(params);
}
}
Response
{
"id": "id",
"created_at": 0,
"file_counts": {
"cancelled": 0,
"completed": 0,
"failed": 0,
"in_progress": 0,
"total": 0
},
"object": "vector_store.files_batch",
"status": "in_progress",
"vector_store_id": "vector_store_id"
}
List vector store files in a batch
FileBatchListFilesPage vectorStores().fileBatches().listFiles(FileBatchListFilesParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
get /vector_stores/{vector_store_id}/file_batches/{batch_id}/files
Returns a list of vector store files in a batch.
Parameters
-
FileBatchListFilesParams params-
String vectorStoreId -
Optional<String> batchId -
Optional<String> afterA cursor for use in pagination.
afteris an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. -
Optional<String> beforeA cursor for use in pagination.
beforeis an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. -
Optional<Filter> filterFilter by file status. One of
in_progress,completed,failed,cancelled.-
IN_PROGRESS("in_progress") -
COMPLETED("completed") -
FAILED("failed") -
CANCELLED("cancelled")
-
-
Optional<Long> limitA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
-
Optional<Order> orderSort order by the
created_attimestamp of the objects.ascfor ascending order anddescfor descending order.-
ASC("asc") -
DESC("desc")
-
-
Returns
-
class VectorStoreFile:A list of files attached to a vector store.
-
String idThe identifier, which can be referenced in API endpoints.
-
long createdAtThe Unix timestamp (in seconds) for when the vector store file was created.
-
Optional<LastError> lastErrorThe last error associated with this vector store file. Will be
nullif there are no errors.-
Code codeOne of
server_error,unsupported_file, orinvalid_file.-
SERVER_ERROR("server_error") -
UNSUPPORTED_FILE("unsupported_file") -
INVALID_FILE("invalid_file")
-
-
String messageA human-readable description of the error.
-
-
JsonValue; object_ "vector_store.file"constantThe object type, which is always
vector_store.file.VECTOR_STORE_FILE("vector_store.file")
-
Status statusThe status of the vector store file, which can be either
in_progress,completed,cancelled, orfailed. The statuscompletedindicates that the vector store file is ready for use.-
IN_PROGRESS("in_progress") -
COMPLETED("completed") -
CANCELLED("cancelled") -
FAILED("failed")
-
-
long usageBytesThe total vector store usage in bytes. Note that this may be different from the original file size.
-
String vectorStoreIdThe ID of the vector store that the File is attached to.
-
Optional<Attributes> attributesSet of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters, booleans, or numbers.
-
String -
double -
boolean
-
-
Optional<FileChunkingStrategy> chunkingStrategyThe strategy used to chunk the file.
-
class StaticFileChunkingStrategyObject:-
StaticFileChunkingStrategy static_-
long chunkOverlapTokensThe number of tokens that overlap between chunks. The default value is
400.Note that the overlap must not exceed half of
max_chunk_size_tokens. -
long maxChunkSizeTokensThe maximum number of tokens in each chunk. The default value is
800. The minimum value is100and the maximum value is4096.
-
-
JsonValue; type "static"constantAlways
static.STATIC("static")
-
-
class OtherFileChunkingStrategyObject:This is returned when the chunking strategy is unknown. Typically, this is because the file was indexed before the
chunking_strategyconcept was introduced in the API.-
JsonValue; type "other"constantAlways
other.OTHER("other")
-
-
-
Example
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.vectorstores.filebatches.FileBatchListFilesPage;
import com.openai.models.vectorstores.filebatches.FileBatchListFilesParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FileBatchListFilesParams params = FileBatchListFilesParams.builder()
.vectorStoreId("vector_store_id")
.batchId("batch_id")
.build();
FileBatchListFilesPage page = client.vectorStores().fileBatches().listFiles(params);
}
}
Response
{
"data": [
{
"id": "id",
"created_at": 0,
"last_error": {
"code": "server_error",
"message": "message"
},
"object": "vector_store.file",
"status": "in_progress",
"usage_bytes": 0,
"vector_store_id": "vector_store_id",
"attributes": {
"foo": "string"
},
"chunking_strategy": {
"static": {
"chunk_overlap_tokens": 0,
"max_chunk_size_tokens": 100
},
"type": "static"
}
}
],
"first_id": "file-abc123",
"has_more": false,
"last_id": "file-abc456",
"object": "list"
}
Domain Types
Vector Store File Batch
-
class VectorStoreFileBatch:A batch of files attached to a vector store.
-
String idThe identifier, which can be referenced in API endpoints.
-
long createdAtThe Unix timestamp (in seconds) for when the vector store files batch was created.
-
FileCounts fileCounts-
long cancelledThe number of files that where cancelled.
-
long completedThe number of files that have been processed.
-
long failedThe number of files that have failed to process.
-
long inProgressThe number of files that are currently being processed.
-
long totalThe total number of files.
-
-
JsonValue; object_ "vector_store.files_batch"constantThe object type, which is always
vector_store.file_batch.VECTOR_STORE_FILES_BATCH("vector_store.files_batch")
-
Status statusThe status of the vector store files batch, which can be either
in_progress,completed,cancelledorfailed.-
IN_PROGRESS("in_progress") -
COMPLETED("completed") -
CANCELLED("cancelled") -
FAILED("failed")
-
-
String vectorStoreIdThe ID of the vector store that the File is attached to.
-