Introduce a new "AI Inference" item in the sidebar, linking to the "Inference Endpoints" index page. This page displays a list of all inference endpoints relevant to the user and project. Each model is presented in a visual card format, featuring key details: * Model name * Model type (e.g., Text Generation, Guard, Embedding) * Model URL * Pricing information * Usage example
18 lines
584 B
Ruby
18 lines
584 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Serializers::InferenceEndpoint < Serializers::Base
|
|
def self.serialize_internal(ie, options = {})
|
|
{
|
|
id: ie.ubid,
|
|
name: ie.name,
|
|
model_name: ie.model_name,
|
|
model_type: ie.model_type,
|
|
url: "#{ie.load_balancer.health_check_protocol}://#{ie.load_balancer.hostname}",
|
|
is_public: ie.is_public,
|
|
location: ie.display_location,
|
|
price_million_tokens: (BillingRate.from_resource_properties("InferenceTokens", ie.model_name, "global")["unit_price"] * 1000000).round(2),
|
|
path: ie.path
|
|
}
|
|
end
|
|
end
|