Class: ContextDev::Resources::AI
- Inherits:
-
Object
- Object
- ContextDev::Resources::AI
- Defined in:
- lib/context_dev/resources/ai.rb,
sig/context_dev/resources/ai.rbs
Instance Method Summary collapse
-
#extract_product(url:, max_age_ms: nil, timeout_ms: nil, request_options: {}) ⇒ ContextDev::Models::AIExtractProductResponse
Some parameter documentations has been truncated, see Models::AIExtractProductParams for more details.
-
#extract_products(body:, request_options: {}) ⇒ ContextDev::Models::AIExtractProductsResponse
Extract product information from a brand's website.
-
#initialize(client:) ⇒ AI
constructor
private
A new instance of AI.
Constructor Details
#initialize(client:) ⇒ AI
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of AI.
62 63 64 |
# File 'lib/context_dev/resources/ai.rb', line 62 def initialize(client:) @client = client end |
Instance Method Details
#extract_product(url:, max_age_ms: nil, timeout_ms: nil, request_options: {}) ⇒ ContextDev::Models::AIExtractProductResponse
Some parameter documentations has been truncated, see Models::AIExtractProductParams for more details.
Given a single URL, determines if it is a product page and extracts the product information.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/context_dev/resources/ai.rb', line 25 def extract_product(params) parsed, = ContextDev::AIExtractProductParams.dump_request(params) @client.request( method: :post, path: "brand/ai/product", body: parsed, model: ContextDev::Models::AIExtractProductResponse, options: ) end |
#extract_products(body:, request_options: {}) ⇒ ContextDev::Models::AIExtractProductsResponse
Extract product information from a brand's website. We will analyze the website and return a list of products with details such as name, description, image, pricing, features, and more.
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/context_dev/resources/ai.rb', line 48 def extract_products(params) parsed, = ContextDev::AIExtractProductsParams.dump_request(params) @client.request( method: :post, path: "brand/ai/products", body: parsed[:body], model: ContextDev::Models::AIExtractProductsResponse, options: ) end |