prompt = """ Consideration proudct : 工厂现货PVC充气青蛙夜市地摊热卖充气玩具发光蛙儿童水上玩具 1. Compose human readale product title used on Amazon in english within 20 words. 2. Write 5 selling points for the products in Amazon. 3. Evaluate a price range for this product in U.S. Output the result in json format with three properties called title, selling_points and price_range """
NotFoundError: Error code: 404 - {'error': {'message': 'The model `text-davinci-003` has been deprecated, learn more here: https://platform.openai.com/docs/deprecations', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}}
{ "title": "Factory Stock PVC Inflatable Frog, Hot Selling Night Market Stall Toy with Light for Children's Water Play", "selling_points": [ "Made with high quality PVC material", "Inflatable and easy to store", "Attractive design with glowing feature", "Perfect for water play and night markets", "Available in stock for immediate purchase" ], "price_range": "$15 - $25" }
prompt = """ Consideration proudct : 工厂现货PVC充气青蛙夜市地摊热卖充气玩具发光蛙儿童水上玩具 1. Compose human readale product title used on Amazon in english within 20 words. 2. Write 5 selling points for the products in Amazon. 3. Evaluate a price range for this product in U.S. Output the result in json format with three properties called title, selling_points and price_range """
{ "title": "Factory Stock PVC Inflatable Frog Night Market Hot Selling Light-up Frog Children's Water Toy", "selling_points": [ "High-quality PVC material for durability", "Inflatable design for easy storage and transportation", "Glowing feature adds fun to nighttime play", "Suitable for both kids and adults", "Perfect for water play at the pool or beach" ], "price_range": "$10 - $20" }
可以看到,这个代码和我们使用 Completions API 的代码基本是一样的,我们只是做了三个小小的改动。
prompt = """ Hi, Could you write me a title, 5 selling points, and a price range for a product called "工厂现货PVC充气青蛙夜市地摊热卖充气玩具发光蛙儿童水上玩具" in English in json format? """
print(get_chat_response(prompt))
输出结果:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Certainly! Here's the information you requested in JSON format: ```json { "title": "Factory Stock PVC Inflatable Frog Night Market Bestseller Inflatable Toy with LED Lights for Children's Water Play", "sellingPoints": [ "High-quality PVC material", "Inflatable and portable design", "Attractive LED lights for night play", "Suitable for water activities", "Popular choice at night markets" ], "priceRange": "$10 - $20" } Please note that the translation provided is based on the given product name, and the price range is presented as an estimate.
prompt = """ Hi, Could you write me a title, 5 selling points, and a price range for a product called "工厂现货PVC充气青蛙夜市地摊热卖充气玩具发光蛙儿童水上玩具" in English in json format? The json format should be like this: { "title": "Blablabla", "selling_points": [ "Blablabla", "Blablabla", "Blablabla", "Blablabla", "Blablabla" ], "price_range": "$x.00 - $y.00" } """
print(get_json_response(prompt))
输出结果:
1 2 3 4 5 6 7 8 9 10 11
{ "title": "Factory Stock PVC Inflatable Frog Night Market Stall Hot Selling Light-Up Frog Children's Water Toy", "selling_points": [ "Inflatable frog toy for children", "Glow in the dark feature for added fun", "Perfect for water play activities", "Ideal for night markets and stalls", "High-quality PVC material for durability" ], "price_range": "$10.00 - $20.00" }
{ "title": "Factory Stock PVC Inflatable Frog Night Market Stall Hot Selling Inflatable Toy Glowing Frog Children's Water Toy", "selling_points": [ "Made of high-quality PVC material", "Unique design with glowing feature", "Perfect for children's water play", "Ideal for night market stalls", "Limited stock available" ], "price_range": "$15.00 - $25.00" }
注:如果再次运行代码,输出的JSON内容是不同的。
但是,在有些场景下,我们不仅希望输出的格式是稳定的,我们还希望在输入内容一样的情况下,输出的结果也不要发生变化。比如,我在撰写这个课程的例子的时候,我希望提供的示例代码,每次的输出结果都是一样的。这样,方便你验证自己实验的结果。你可能会说,那是不是把 temperature 这个参数设置成0就可以了? 因为我们之前就介绍过,这个参数决定了模型生成文本时的随机性。
fp_69829325d0 { "title": "Factory Stock PVC Inflatable Frog Night Market Stall Hot Selling Inflatable Toy Glowing Frog Children's Water Toy", "selling_points": [ "Made of high-quality PVC material", "Unique design with glowing feature", "Perfect for children to play with in the water", "Ideal for night markets and outdoor events", "Easy to inflate and deflate for storage" ], "price_range": "$10.00 - $20.00" }
fp_69829325d0 { "title": "Factory Stock PVC Inflatable Frog Night Market Stall Hot Selling Inflatable Toy Glowing Frog Children's Water Toy", "selling_points": [ "Made of high-quality PVC material", "Suitable for night markets and stalls", "Glowing feature adds fun for children", "Ideal for water play", "Popular and in-demand product" ], "price_range": "$10.00 - $20.00" }
fp_69829325d0 { "title": "Factory Stock PVC Inflatable Frog Night Market Stall Hot Selling Inflatable Toy Glowing Frog Children's Water Toy", "selling_points": [ "Made of high-quality PVC material", "Unique design with glowing feature", "Perfect for children to play with in the water", "Ideal for night markets and outdoor events", "Easy to inflate and deflate for storage" ], "price_range": "$10.00 - $20.00" }
fp_69829325d0 { "title": "Factory Stock PVC Inflatable Frog Night Market Stall Hot Selling Inflatable Toy Glowing Frog Children's Water Toy", "selling_points": [ "Made of high-quality PVC material", "Unique design with glowing feature", "Perfect for children to play with in the water", "Ideal for night markets and outdoor events", "Easy to inflate and deflate for storage" ], "price_range": "$10.00 - $20.00" }