Class: ContextDev::Resources::AI
- Inherits:
-
Object
- Object
- ContextDev::Resources::AI
- Defined in:
- lib/context_dev/resources/ai.rb
Instance Method Summary collapse
-
#ai_query(data_to_extract:, domain:, specific_pages: nil, timeout_ms: nil, request_options: {}) ⇒ ContextDev::Models::AIAIQueryResponse
Some parameter documentations has been truncated, see Models::AIAIQueryParams for more details.
-
#extract_product(url:, 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
Beta feature: 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.
94 95 96 |
# File 'lib/context_dev/resources/ai.rb', line 94 def initialize(client:) @client = client end |
Instance Method Details
#ai_query(data_to_extract:, domain:, specific_pages: nil, timeout_ms: nil, request_options: {}) ⇒ ContextDev::Models::AIAIQueryResponse
Some parameter documentations has been truncated, see Models::AIAIQueryParams for more details.
Use AI to extract specific data points from a brand’s website. The AI will crawl the website and extract the requested information based on the provided data points.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/context_dev/resources/ai.rb', line 28 def ai_query(params) parsed, = ContextDev::AIAIQueryParams.dump_request(params) @client.request( method: :post, path: "brand/ai/query", body: parsed, model: ContextDev::Models::AIAIQueryResponse, options: ) end |
#extract_product(url:, timeout_ms: nil, request_options: {}) ⇒ ContextDev::Models::AIExtractProductResponse
Some parameter documentations has been truncated, see Models::AIExtractProductParams for more details.
Beta feature: Given a single URL, determines if it is a product detail page, classifies the platform/product type, and extracts the product information. Supports Amazon, TikTok Shop, Etsy, and generic ecommerce sites.
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/context_dev/resources/ai.rb', line 57 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
Beta feature: 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.
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/context_dev/resources/ai.rb', line 80 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 |