Use an OpenInference Service
Invoke the deployed endpoint with a request body that matches the function's input tensor schema.
payload = {
"inputs": [
{
"name": "input-0",
"shape": [-1],
"datatype": "BYTES",
"data": ["hello world"],
}
]
}
response = run.invoke(json=payload)
The response follows the output tensor schema declared by the function.
invoke
Invoke run service endpoint. It uses the service URL from the run status if no URL is specified. The method defaults to "POST" if data or json is provided in kwargs, otherwise it defaults to "GET". The function returns a requests.Response object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
str
|
Method of the request (e.g., "GET", "POST"). |
'POST'
|
url
|
str
|
URL to invoke. If specified, it must start with the service URL (http:// or https:// prefixes are required and stripped before comparison). |
None
|
**kwargs
|
dict
|
Keyword arguments to pass to the request. |
{}
|
Returns:
| Type | Description |
|---|---|
Response
|
Response from service. |