Class: LiteLLMClient::CachingApi

Inherits:
Object
  • Object
show all
Defined in:
lib/litellm_client/api/caching_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CachingApi

Returns a new instance of CachingApi.



19
20
21
# File 'lib/litellm_client/api/caching_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/litellm_client/api/caching_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#cache_delete_cache_delete_post(opts = {}) ⇒ Object

Cache Delete Endpoint for deleting a key from the cache. All responses from litellm proxy have ‘x-litellm-cache-key` in the headers Parameters: - keys: Optional[List[str]] - A list of keys to delete from the cache. Example ["key1", "key2"] “`shell curl -X POST "0.0.0.0:4000/cache/delete" -H "Authorization: Bearer sk-1234" -d ’["key1", "key2"]‘ “`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


26
27
28
29
# File 'lib/litellm_client/api/caching_api.rb', line 26

def cache_delete_cache_delete_post(opts = {})
  data, _status_code, _headers = cache_delete_cache_delete_post_with_http_info(opts)
  data
end

#cache_delete_cache_delete_post_0(opts = {}) ⇒ Object

Cache Delete Endpoint for deleting a key from the cache. All responses from litellm proxy have ‘x-litellm-cache-key` in the headers Parameters: - keys: Optional[List[str]] - A list of keys to delete from the cache. Example ["key1", "key2"] “`shell curl -X POST "0.0.0.0:4000/cache/delete" -H "Authorization: Bearer sk-1234" -d ’["key1", "key2"]‘ “`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


83
84
85
86
# File 'lib/litellm_client/api/caching_api.rb', line 83

def cache_delete_cache_delete_post_0(opts = {})
  data, _status_code, _headers = cache_delete_cache_delete_post_0_with_http_info(opts)
  data
end

#cache_delete_cache_delete_post_0_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>

Cache Delete Endpoint for deleting a key from the cache. All responses from litellm proxy have &#x60;x-litellm-cache-key&#x60; in the headers Parameters: - keys: Optional[List[str]] - A list of keys to delete from the cache. Example [&quot;key1&quot;, &quot;key2&quot;] &#x60;&#x60;&#x60;shell curl -X POST &quot;0.0.0.0:4000/cache/delete&quot; -H &quot;Authorization: Bearer sk-1234&quot; -d &#39;[&quot;key1&quot;, &quot;key2&quot;]&#39; &#x60;&#x60;&#x60;

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/litellm_client/api/caching_api.rb', line 92

def cache_delete_cache_delete_post_0_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CachingApi.cache_delete_cache_delete_post_0 ...'
  end
  # resource path
  local_var_path = '/cache/delete'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['APIKeyHeader']

  new_options = opts.merge(
    :operation => :"CachingApi.cache_delete_cache_delete_post_0",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CachingApi#cache_delete_cache_delete_post_0\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#cache_delete_cache_delete_post_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>

Cache Delete Endpoint for deleting a key from the cache. All responses from litellm proxy have &#x60;x-litellm-cache-key&#x60; in the headers Parameters: - keys: Optional[List[str]] - A list of keys to delete from the cache. Example [&quot;key1&quot;, &quot;key2&quot;] &#x60;&#x60;&#x60;shell curl -X POST &quot;0.0.0.0:4000/cache/delete&quot; -H &quot;Authorization: Bearer sk-1234&quot; -d &#39;[&quot;key1&quot;, &quot;key2&quot;]&#39; &#x60;&#x60;&#x60;

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/litellm_client/api/caching_api.rb', line 35

def cache_delete_cache_delete_post_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CachingApi.cache_delete_cache_delete_post ...'
  end
  # resource path
  local_var_path = '/cache/delete'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['APIKeyHeader']

  new_options = opts.merge(
    :operation => :"CachingApi.cache_delete_cache_delete_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CachingApi#cache_delete_cache_delete_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#cache_flushall_cache_flushall_post(opts = {}) ⇒ Object

Cache Flushall A function to flush all items from the cache. (All items will be deleted from the cache with this) Raises HTTPException if the cache is not initialized or if the cache type does not support flushing. Returns a dictionary with the status of the operation. Usage: “‘ curl -X POST 0.0.0.0:4000/cache/flushall -H "Authorization: Bearer sk-1234" “`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


140
141
142
143
# File 'lib/litellm_client/api/caching_api.rb', line 140

def cache_flushall_cache_flushall_post(opts = {})
  data, _status_code, _headers = cache_flushall_cache_flushall_post_with_http_info(opts)
  data
end

#cache_flushall_cache_flushall_post_0(opts = {}) ⇒ Object

Cache Flushall A function to flush all items from the cache. (All items will be deleted from the cache with this) Raises HTTPException if the cache is not initialized or if the cache type does not support flushing. Returns a dictionary with the status of the operation. Usage: “‘ curl -X POST 0.0.0.0:4000/cache/flushall -H "Authorization: Bearer sk-1234" “`

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


197
198
199
200
# File 'lib/litellm_client/api/caching_api.rb', line 197

def cache_flushall_cache_flushall_post_0(opts = {})
  data, _status_code, _headers = cache_flushall_cache_flushall_post_0_with_http_info(opts)
  data
end

#cache_flushall_cache_flushall_post_0_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>

Cache Flushall A function to flush all items from the cache. (All items will be deleted from the cache with this) Raises HTTPException if the cache is not initialized or if the cache type does not support flushing. Returns a dictionary with the status of the operation. Usage: &#x60;&#x60;&#x60; curl -X POST 0.0.0.0:4000/cache/flushall -H &quot;Authorization: Bearer sk-1234&quot; &#x60;&#x60;&#x60;

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/litellm_client/api/caching_api.rb', line 206

def cache_flushall_cache_flushall_post_0_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CachingApi.cache_flushall_cache_flushall_post_0 ...'
  end
  # resource path
  local_var_path = '/cache/flushall'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['APIKeyHeader']

  new_options = opts.merge(
    :operation => :"CachingApi.cache_flushall_cache_flushall_post_0",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CachingApi#cache_flushall_cache_flushall_post_0\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#cache_flushall_cache_flushall_post_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>

Cache Flushall A function to flush all items from the cache. (All items will be deleted from the cache with this) Raises HTTPException if the cache is not initialized or if the cache type does not support flushing. Returns a dictionary with the status of the operation. Usage: &#x60;&#x60;&#x60; curl -X POST 0.0.0.0:4000/cache/flushall -H &quot;Authorization: Bearer sk-1234&quot; &#x60;&#x60;&#x60;

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/litellm_client/api/caching_api.rb', line 149

def cache_flushall_cache_flushall_post_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CachingApi.cache_flushall_cache_flushall_post ...'
  end
  # resource path
  local_var_path = '/cache/flushall'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['APIKeyHeader']

  new_options = opts.merge(
    :operation => :"CachingApi.cache_flushall_cache_flushall_post",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CachingApi#cache_flushall_cache_flushall_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#cache_ping_cache_ping_get(opts = {}) ⇒ CachePingResponse

Cache Ping Endpoint for checking if cache can be pinged

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



254
255
256
257
# File 'lib/litellm_client/api/caching_api.rb', line 254

def cache_ping_cache_ping_get(opts = {})
  data, _status_code, _headers = cache_ping_cache_ping_get_with_http_info(opts)
  data
end

#cache_ping_cache_ping_get_with_http_info(opts = {}) ⇒ Array<(CachePingResponse, Integer, Hash)>

Cache Ping Endpoint for checking if cache can be pinged

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(CachePingResponse, Integer, Hash)>)

    CachePingResponse data, response status code and response headers



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/litellm_client/api/caching_api.rb', line 263

def cache_ping_cache_ping_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CachingApi.cache_ping_cache_ping_get ...'
  end
  # resource path
  local_var_path = '/cache/ping'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CachePingResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['APIKeyHeader']

  new_options = opts.merge(
    :operation => :"CachingApi.cache_ping_cache_ping_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CachingApi#cache_ping_cache_ping_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#cache_redis_info_cache_redis_info_get(opts = {}) ⇒ Object

Cache Redis Info Endpoint for getting /redis/info

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Object)


311
312
313
314
# File 'lib/litellm_client/api/caching_api.rb', line 311

def cache_redis_info_cache_redis_info_get(opts = {})
  data, _status_code, _headers = cache_redis_info_cache_redis_info_get_with_http_info(opts)
  data
end

#cache_redis_info_cache_redis_info_get_with_http_info(opts = {}) ⇒ Array<(Object, Integer, Hash)>

Cache Redis Info Endpoint for getting /redis/info

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Object, Integer, Hash)>)

    Object data, response status code and response headers



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/litellm_client/api/caching_api.rb', line 320

def cache_redis_info_cache_redis_info_get_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CachingApi.cache_redis_info_cache_redis_info_get ...'
  end
  # resource path
  local_var_path = '/cache/redis/info'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Object'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['APIKeyHeader']

  new_options = opts.merge(
    :operation => :"CachingApi.cache_redis_info_cache_redis_info_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CachingApi#cache_redis_info_cache_redis_info_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end