|
31 | 31 | - [Threads Messages Resource](#threads-messages-resource)
|
32 | 32 | - [Threads Runs Resource](#threads-runs-resource)
|
33 | 33 | - [Threads Runs Steps Resource](#threads-runs-steps-resource)
|
| 34 | + - [Vector Stores Resource](#vector-stores-resource) |
| 35 | + - [Vector Stores Files Resource](#vector-store-files-resource) |
| 36 | + - [Vector Stores File Batches Resource](#vector-store-file-batches-resource) |
34 | 37 | - [Batches Resource](#batches-resource)
|
35 | 38 | - [FineTunes Resource (deprecated)](#finetunes-resource-deprecated)
|
36 | 39 | - [Edits Resource (deprecated)](#edits-resource-deprecated)
|
@@ -1820,6 +1823,336 @@ foreach ($response->data as $result) {
|
1820 | 1823 | $response->toArray(); // ['object' => 'list', ...]]
|
1821 | 1824 | ```
|
1822 | 1825 |
|
| 1826 | + |
| 1827 | +### `Vector Stores` Resource |
| 1828 | + |
| 1829 | +#### `create` |
| 1830 | + |
| 1831 | +Create a vector store. |
| 1832 | + |
| 1833 | +```php |
| 1834 | +$response = $client->vectorStores()->create([ |
| 1835 | + 'file_ids' => [ |
| 1836 | + 'file-fUU0hFRuQ1GzhOweTNeJlCXG', |
| 1837 | + ], |
| 1838 | + 'name' => 'My first Vector Store', |
| 1839 | +]); |
| 1840 | + |
| 1841 | +$response->id; // 'vs_vzfQhlTWVUl38QGqQAoQjeDF' |
| 1842 | +$response->object; // 'vector_store' |
| 1843 | +$response->createdAt; // 1717703267 |
| 1844 | +$response->name; // 'My first Vector Store' |
| 1845 | +$response->usageBytes; // 0 |
| 1846 | +$response->fileCounts->inProgress; // 1 |
| 1847 | +$response->fileCounts->completed; // 0 |
| 1848 | +$response->fileCounts->failed; // 0 |
| 1849 | +$response->fileCounts->cancelled; // 0 |
| 1850 | +$response->fileCounts->total; // 1 |
| 1851 | +$response->status; // 'in_progress' |
| 1852 | +$response->expiresAfter; // null |
| 1853 | +$response->expiresAt; // null |
| 1854 | +$response->lastActiveAt; // 1717703267 |
| 1855 | + |
| 1856 | +$response->toArray(); // ['id' => 'vs_vzfQhlTWVUl38QGqQAoQjeDF', ...] |
| 1857 | +``` |
| 1858 | + |
| 1859 | +#### `retrieve` |
| 1860 | + |
| 1861 | +Retrieves a vector store. |
| 1862 | + |
| 1863 | +```php |
| 1864 | +$response = $client->vectorStores()->retrieve( |
| 1865 | + vectorStoreId: 'vs_vzfQhlTWVUl38QGqQAoQjeDF', |
| 1866 | +); |
| 1867 | + |
| 1868 | +$response->id; // 'vs_vzfQhlTWVUl38QGqQAoQjeDF' |
| 1869 | +$response->object; // 'vector_store' |
| 1870 | +$response->createdAt; // 1717703267 |
| 1871 | +$response->name; // 'My first Vector Store' |
| 1872 | +$response->usageBytes; // 0 |
| 1873 | +$response->fileCounts->inProgress; // 1 |
| 1874 | +$response->fileCounts->completed; // 0 |
| 1875 | +$response->fileCounts->failed; // 0 |
| 1876 | +$response->fileCounts->cancelled; // 0 |
| 1877 | +$response->fileCounts->total; // 1 |
| 1878 | +$response->status; // 'in_progress' |
| 1879 | +$response->expiresAfter; // null |
| 1880 | +$response->expiresAt; // null |
| 1881 | +$response->lastActiveAt; // 1717703267 |
| 1882 | + |
| 1883 | +$response->toArray(); // ['id' => 'vs_vzfQhlTWVUl38QGqQAoQjeDF', ...] |
| 1884 | +``` |
| 1885 | + |
| 1886 | +#### `modify` |
| 1887 | + |
| 1888 | +Modifies a vector store. |
| 1889 | + |
| 1890 | +```php |
| 1891 | +$response = $client->vectorStores()->modify( |
| 1892 | + vectorStoreId: 'vs_vzfQhlTWVUl38QGqQAoQjeDF', |
| 1893 | + parameters: [ |
| 1894 | + 'name' => 'New name', |
| 1895 | + ], |
| 1896 | +); |
| 1897 | + |
| 1898 | +$response->id; // 'vs_vzfQhlTWVUl38QGqQAoQjeDF' |
| 1899 | +$response->object; // 'vector_store' |
| 1900 | +$response->createdAt; // 1717703267 |
| 1901 | +$response->name; // 'New name' |
| 1902 | +$response->usageBytes; // 0 |
| 1903 | +$response->fileCounts->inProgress; // 1 |
| 1904 | +$response->fileCounts->completed; // 0 |
| 1905 | +$response->fileCounts->failed; // 0 |
| 1906 | +$response->fileCounts->cancelled; // 0 |
| 1907 | +$response->fileCounts->total; // 1 |
| 1908 | +$response->status; // 'in_progress' |
| 1909 | +$response->expiresAfter; // null |
| 1910 | +$response->expiresAt; // null |
| 1911 | +$response->lastActiveAt; // 1717703267 |
| 1912 | + |
| 1913 | +$response->toArray(); // ['id' => 'vs_vzfQhlTWVUl38QGqQAoQjeDF', ...] |
| 1914 | +``` |
| 1915 | + |
| 1916 | +#### `delete` |
| 1917 | + |
| 1918 | +Delete a vector store. |
| 1919 | + |
| 1920 | +```php |
| 1921 | +$response = $client->vectorStores()->delete( |
| 1922 | + vectorStoreId: 'vs_vzfQhlTWVUl38QGqQAoQjeDF', |
| 1923 | +); |
| 1924 | + |
| 1925 | +$response->id; // 'vs_vzfQhlTWVUl38QGqQAoQjeDF' |
| 1926 | +$response->object; // 'vector_store.deleted' |
| 1927 | +$response->deleted; // true |
| 1928 | + |
| 1929 | +$response->toArray(); // ['id' => 'vs_vzfQhlTWVUl38QGqQAoQjeDF', ...] |
| 1930 | +``` |
| 1931 | + |
| 1932 | +#### `list` |
| 1933 | + |
| 1934 | +Returns a list of vector stores. |
| 1935 | + |
| 1936 | +```php |
| 1937 | +$response = $client->vectorStores()->list( |
| 1938 | + parameters: [ |
| 1939 | + 'limit' => 10, |
| 1940 | + ], |
| 1941 | +); |
| 1942 | + |
| 1943 | +$response->object; // 'list' |
| 1944 | +$response->firstId; // 'vs_vzfQhlTWVUl38QGqQAoQjeDF' |
| 1945 | +$response->lastId; // 'vs_D5DPOgBxSoEBTmYBgUESdPpa' |
| 1946 | +$response->hasMore; // true |
| 1947 | + |
| 1948 | +foreach ($response->data as $result) { |
| 1949 | + $result->id; // 'vs_vzfQhlTWVUl38QGqQAoQjeDF' |
| 1950 | + // ... |
| 1951 | +} |
| 1952 | + |
| 1953 | +$response->toArray(); // ['object' => 'list', ...]] |
| 1954 | +``` |
| 1955 | + |
| 1956 | + |
| 1957 | +### `Vector Store Files` Resource |
| 1958 | + |
| 1959 | +#### `create` |
| 1960 | + |
| 1961 | +Create a vector store file by attaching a File to a vector store. |
| 1962 | + |
| 1963 | +```php |
| 1964 | +$response = $client->vectorStores()->files()->create( |
| 1965 | + vectorStoreId: 'vs_vzfQhlTWVUl38QGqQAoQjeDF', |
| 1966 | + parameters: [ |
| 1967 | + 'file_id' => 'file-fUU0hFRuQ1GzhOweTNeJlCXG', |
| 1968 | + ] |
| 1969 | +); |
| 1970 | + |
| 1971 | +$response->id; // 'file-fUU0hFRuQ1GzhOweTNeJlCXG' |
| 1972 | +$response->object; // 'vector_store.file' |
| 1973 | +$response->usageBytes; // 4553 |
| 1974 | +$response->createdAt; // 1717703267 |
| 1975 | +$response->vectorStoreId; // 'vs_vzfQhlTWVUl38QGqQAoQjeDF' |
| 1976 | +$response->status; // 'completed' |
| 1977 | +$response->lastError; // null |
| 1978 | +$response->chunkingStrategy->type; // 'static' |
| 1979 | +$response->chunkingStrategy->maxChunkSizeTokens; // 800 |
| 1980 | +$response->chunkingStrategy->chunkOverlapTokens; // 400 |
| 1981 | + |
| 1982 | +$response->toArray(); // ['id' => 'file-fUU0hFRuQ1GzhOweTNeJlCXG', ...] |
| 1983 | +``` |
| 1984 | + |
| 1985 | +#### `retrieve` |
| 1986 | + |
| 1987 | +Retrieves a vector store file. |
| 1988 | + |
| 1989 | +```php |
| 1990 | +$response = $client->vectorStores()->files()->retrieve( |
| 1991 | + vectorStoreId: 'vs_vzfQhlTWVUl38QGqQAoQjeDF', |
| 1992 | + fileId: 'file-fUU0hFRuQ1GzhOweTNeJlCXG', |
| 1993 | +); |
| 1994 | + |
| 1995 | +$response->id; // 'file-fUU0hFRuQ1GzhOweTNeJlCXG' |
| 1996 | +$response->object; // 'vector_store.file' |
| 1997 | +$response->usageBytes; // 4553 |
| 1998 | +$response->createdAt; // 1717703267 |
| 1999 | +$response->vectorStoreId; // 'vs_vzfQhlTWVUl38QGqQAoQjeDF' |
| 2000 | +$response->status; // 'completed' |
| 2001 | +$response->lastError; // null |
| 2002 | +$response->chunkingStrategy->type; // 'static' |
| 2003 | +$response->chunkingStrategy->maxChunkSizeTokens; // 800 |
| 2004 | +$response->chunkingStrategy->chunkOverlapTokens; // 400 |
| 2005 | + |
| 2006 | +$response->toArray(); // ['id' => 'file-fUU0hFRuQ1GzhOweTNeJlCXG', ...] |
| 2007 | +``` |
| 2008 | + |
| 2009 | +#### `delete` |
| 2010 | + |
| 2011 | +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. |
| 2012 | + |
| 2013 | +```php |
| 2014 | +$response = $client->vectorStores()->files()->delete( |
| 2015 | + vectorStoreId: 'vs_vzfQhlTWVUl38QGqQAoQjeDF', |
| 2016 | + fileId: 'file-fUU0hFRuQ1GzhOweTNeJlCXG', |
| 2017 | +); |
| 2018 | + |
| 2019 | +$response->id; // 'file-fUU0hFRuQ1GzhOweTNeJlCXG' |
| 2020 | +$response->object; // 'vector_store.file.deleted' |
| 2021 | +$response->deleted; // true |
| 2022 | + |
| 2023 | +$response->toArray(); // ['id' => 'file-fUU0hFRuQ1GzhOweTNeJlCXG', ...] |
| 2024 | +``` |
| 2025 | + |
| 2026 | +#### `list` |
| 2027 | + |
| 2028 | +Returns a list of vector store files. |
| 2029 | + |
| 2030 | +```php |
| 2031 | +$response = $client->vectorStores()->files()->list( |
| 2032 | + vectorStoreId: 'vs_vzfQhlTWVUl38QGqQAoQjeDF', |
| 2033 | + parameters: [ |
| 2034 | + 'limit' => 10, |
| 2035 | + ], |
| 2036 | +); |
| 2037 | + |
| 2038 | +$response->object; // 'list' |
| 2039 | +$response->firstId; // 'file-fUU0hFRuQ1GzhOweTNeJlCXG' |
| 2040 | +$response->lastId; // 'file-D5DPOgBxSoEBTmYBgUESdPpa' |
| 2041 | +$response->hasMore; // true |
| 2042 | + |
| 2043 | +foreach ($response->data as $result) { |
| 2044 | + $result->id; // 'file-fUU0hFRuQ1GzhOweTNeJlCXG' |
| 2045 | + // ... |
| 2046 | +} |
| 2047 | + |
| 2048 | +$response->toArray(); // ['object' => 'list', ...]] |
| 2049 | +``` |
| 2050 | + |
| 2051 | + |
| 2052 | +### `Vector Store File Batches` Resource |
| 2053 | + |
| 2054 | +#### `create` |
| 2055 | + |
| 2056 | +Create a vector store file batch. |
| 2057 | + |
| 2058 | +```php |
| 2059 | +$response = $client->vectorStores()->batches()->create( |
| 2060 | + vectorStoreId: 'vs_vzfQhlTWVUl38QGqQAoQjeDF', |
| 2061 | + parameters: [ |
| 2062 | + 'file_ids' => [ |
| 2063 | + 'file-fUU0hFRuQ1GzhOweTNeJlCXG', |
| 2064 | + ], |
| 2065 | + ] |
| 2066 | +); |
| 2067 | + |
| 2068 | +$response->id; // 'vsfb_123' |
| 2069 | +$response->object; // 'vector_store.files_batch' |
| 2070 | +$response->createdAt; // 1698107661 |
| 2071 | +$response->vectorStoreId; // 'vs_vzfQhlTWVUl38QGqQAoQjeDF' |
| 2072 | +$response->status; // 'completed' |
| 2073 | +$response->fileCounts->inProgress; // 1 |
| 2074 | +$response->fileCounts->completed; // 0 |
| 2075 | +$response->fileCounts->failed; // 0 |
| 2076 | +$response->fileCounts->cancelled; // 0 |
| 2077 | +$response->fileCounts->total; // 1 |
| 2078 | + |
| 2079 | +$response->toArray(); // ['id' => 'vsfb_123', ...] |
| 2080 | +``` |
| 2081 | + |
| 2082 | +#### `retrieve` |
| 2083 | + |
| 2084 | +Retrieves a vector store file batch. |
| 2085 | + |
| 2086 | +```php |
| 2087 | +$response = $client->vectorStores()->batches()->retrieve( |
| 2088 | + vectorStoreId: 'vs_vzfQhlTWVUl38QGqQAoQjeDF', |
| 2089 | + fileBatchId: 'vsfb_123', |
| 2090 | +); |
| 2091 | + |
| 2092 | +$response->id; // 'vsfb_123' |
| 2093 | +$response->object; // 'vector_store.files_batch' |
| 2094 | +$response->createdAt; // 1698107661 |
| 2095 | +$response->vectorStoreId; // 'vs_vzfQhlTWVUl38QGqQAoQjeDF' |
| 2096 | +$response->status; // 'completed' |
| 2097 | +$response->fileCounts->inProgress; // 1 |
| 2098 | +$response->fileCounts->completed; // 0 |
| 2099 | +$response->fileCounts->failed; // 0 |
| 2100 | +$response->fileCounts->cancelled; // 0 |
| 2101 | +$response->fileCounts->total; // 1 |
| 2102 | + |
| 2103 | +$response->toArray(); // ['id' => 'vsfb_123', ...] |
| 2104 | +``` |
| 2105 | + |
| 2106 | +#### `cancel` |
| 2107 | + |
| 2108 | +Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. |
| 2109 | + |
| 2110 | +```php |
| 2111 | +$response = $client->vectorStores()->batches()->cancel( |
| 2112 | + vectorStoreId: 'vs_vzfQhlTWVUl38QGqQAoQjeDF', |
| 2113 | + fileBatchId: 'vsfb_123', |
| 2114 | +); |
| 2115 | + |
| 2116 | +$response->id; // 'vsfb_123' |
| 2117 | +$response->object; // 'vector_store.files_batch' |
| 2118 | +$response->createdAt; // 1698107661 |
| 2119 | +$response->vectorStoreId; // 'vs_vzfQhlTWVUl38QGqQAoQjeDF' |
| 2120 | +$response->status; // 'cancelling' |
| 2121 | +$response->fileCounts->inProgress; // 1 |
| 2122 | +$response->fileCounts->completed; // 0 |
| 2123 | +$response->fileCounts->failed; // 0 |
| 2124 | +$response->fileCounts->cancelled; // 0 |
| 2125 | +$response->fileCounts->total; // 1 |
| 2126 | + |
| 2127 | +$response->toArray(); // ['id' => 'vsfb_123', ...] |
| 2128 | +``` |
| 2129 | + |
| 2130 | +#### `list` |
| 2131 | + |
| 2132 | +Returns a list of vector store files. |
| 2133 | + |
| 2134 | +```php |
| 2135 | +$response = $client->vectorStores()->batches()->listFiles( |
| 2136 | + vectorStoreId: 'vs_vzfQhlTWVUl38QGqQAoQjeDF', |
| 2137 | + fileBatchId: 'vsfb_123', |
| 2138 | + parameters: [ |
| 2139 | + 'limit' => 10, |
| 2140 | + ], |
| 2141 | +); |
| 2142 | + |
| 2143 | +$response->object; // 'list' |
| 2144 | +$response->firstId; // 'file-fUU0hFRuQ1GzhOweTNeJlCXG' |
| 2145 | +$response->lastId; // 'file-D5DPOgBxSoEBTmYBgUESdPpa' |
| 2146 | +$response->hasMore; // true |
| 2147 | + |
| 2148 | +foreach ($response->data as $result) { |
| 2149 | + $result->id; // 'file-fUU0hFRuQ1GzhOweTNeJlCXG' |
| 2150 | + // ... |
| 2151 | +} |
| 2152 | + |
| 2153 | +$response->toArray(); // ['object' => 'list', ...]] |
| 2154 | +``` |
| 2155 | + |
1823 | 2156 | ### `Edits` Resource (deprecated)
|
1824 | 2157 |
|
1825 | 2158 | > OpenAI has deprecated the Edits API and will stop working by January 4, 2024.
|
|
0 commit comments