Module: css
Utilities for encoding and decoding closed source completion requests. These are meant to be used in the context of solidity contracts, and allow a standardized interface for interacting with different closed source completion providers.
These utilities are used in the css_inference_service
service.
CSSEndpoint
CSSProvider
decode_css_completion_request(request)
Decode a closed source completion request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request |
bytes
|
The encoded request. |
required |
Returns:
Type | Description |
---|---|
tuple[str, list[ConvoMessage]]
|
tuple[str, list[ConvoMessage]]: The model name and the conversation messages. |
Source code in src/infernet_ml/utils/codec/css.py
decode_css_request(request)
Decode a closed source completion request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request |
bytes
|
The encoded request. |
required |
Returns:
Type | Description |
---|---|
tuple[CSSProvider, CSSEndpoint]
|
tuple[CSSProvider, CSSEndpoint]: The provider and endpoint of the request. |
Source code in src/infernet_ml/utils/codec/css.py
encode_css_completion_request(provider, endpoint, model, messages)
Encode a closed source completion request, the interface for completion is unified across all providers and models.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
provider |
CSSProvider
|
The provider of the completion service. |
required |
endpoint |
CSSEndpoint
|
The endpoint of the completion service. |
required |
model |
str
|
The model name. |
required |
messages |
list[ConvoMessage]
|
The conversation messages. |
required |
Returns:
Name | Type | Description |
---|---|---|
bytes |
bytes
|
The encoded request. |