llmtuner.interface

Classes

Interface

Base class to handle an interfaces to servers or webpages.

Module Contents

class llmtuner.interface.Interface(interfaceid='', config='')[source]

Base class to handle an interfaces to servers or webpages.

interfaceid = ''[source]
baseurl = ''[source]
authkey = ''[source]
basicauth = None[source]
headers[source]
_set_config(configdict={})[source]

Set configuration of interface if in cofiguration

update_config(valuedict)[source]

Updates interface configuration from dictionary. Should contain parameters for configuration: {‘base_url’: ‘https://…’, ‘api_key’: ‘your_key_ …’, ‘interfaceid’: ‘name_of_interface’ …}

_make_header(add_dict={}, delete_list=[])[source]

Modify standard header by deleting entries (delete_list) or adding entries (add_dict)

_get(endpoint, query='', params={}, set_query_from_params=False)[source]

Basic get from endpoint. If ‘set_query_from_params’, the query will be produced with key-value pairs as direct part of the URL.

_post(endpoint, query, data, content_type='', passdata='files')[source]

Basic post to server for given endpoint, query string and accompanying data, if ‘usedata’ the data is passed to the ‘data’ argument.

_delete(endpoint, data={})[source]

Basic delete command to API