diff --git a/dev.toml b/dev.toml index 33fdc70..dbcd81e 100644 --- a/dev.toml +++ b/dev.toml @@ -6,12 +6,12 @@ build-backend = "setuptools.build_meta" [project] name = "re_edge_gpt_dev" -version = "0.0.31" +version = "0.0.33" authors = [ { name = "JE-Chen", email = "jechenmailman@gmail.com" }, ] dependencies = [ - "aiohttp", "certifi", "httpx", "prompt_toolkit", "requests", "rich", "regex" + "aiohttp", "certifi", "httpx", "prompt_toolkit", "requests", "rich", "regex", "Brotli" ] description = "Microsoft's Bing Chat AI" requires-python = ">=3.9" diff --git a/pyproject.toml b/pyproject.toml index 427e5c7..46a3284 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,12 +6,12 @@ build-backend = "setuptools.build_meta" [project] name = "re_edge_gpt" -version = "0.0.28" +version = "0.0.30" authors = [ { name = "JE-Chen", email = "jechenmailman@gmail.com" }, ] dependencies = [ - "aiohttp", "certifi", "httpx", "prompt_toolkit", "requests", "rich", "regex" + "aiohttp", "certifi", "httpx", "prompt_toolkit", "requests", "rich", "regex", "Brotli" ] description = "Microsoft's Bing Chat AI" requires-python = ">=3.9" diff --git a/re_edge_gpt/chat/chathub.py b/re_edge_gpt/chat/chathub.py index 7357afe..a184ecc 100644 --- a/re_edge_gpt/chat/chathub.py +++ b/re_edge_gpt/chat/chathub.py @@ -80,7 +80,8 @@ async def ask_stream( locale: str = guess_locale(), # Use for attachment attachment: dict = None, - autosave: bool = True + remove_options: list = None, + add_options: list = None ) -> Generator[bool, Union[dict, str], None]: """ """ if self.encrypted_conversation_signature is not None: @@ -107,14 +108,21 @@ async def ask_stream( image_url = None if attachment is not None: if attachment.get("image_url") is not None: - response = await upload_image_url(**attachment, conversation_id=self.conversation_id) + response = await upload_image_url( + **attachment, conversation_id=self.conversation_id, cookies=cookies) else: - response = await upload_image(**attachment) + response = await upload_image( + **attachment, conversation_id=self.conversation_id, cookies=cookies) if response: image_url = f"https://www.bing.com/images/blob?bcid={response}" # Construct a ChatHub request - if autosave is False and "autosave" in conversation_style.value: - conversation_style.value.remove("autosave") + if remove_options is not None: + for option in remove_options: + if option in remove_options: + conversation_style.value.remove(option) + if add_options is not None: + for option in add_options: + conversation_style.value.append(option) self.request.update( prompt=prompt, conversation_style=conversation_style, diff --git a/re_edge_gpt/chat/re_edge_gpt.py b/re_edge_gpt/chat/re_edge_gpt.py index 16758fd..c48ea20 100644 --- a/re_edge_gpt/chat/re_edge_gpt.py +++ b/re_edge_gpt/chat/re_edge_gpt.py @@ -6,7 +6,6 @@ from .chathub import * from .conversation import * from .request import * -from re_edge_gpt.utils.utilities import * class Chatbot: @@ -53,7 +52,8 @@ async def ask( locale: str = guess_locale(), simplify_response: bool = False, attachment: dict[str, str] = None, - autosave: bool = True + remove_options: list = None, + add_options: list = None ): """ Ask a question to the bot @@ -72,7 +72,8 @@ async def ask( attachment={"filename": r""}) For base64 image using attachment={"base64_image": r""}) - :param autosave: add autosave on request + :param remove_options remove options from Style + :param add_options add options to Style """ async for final, response in self.chat_hub.ask_stream( prompt=prompt, @@ -82,47 +83,56 @@ async def ask( search_result=search_result, locale=locale, attachment=attachment, - autosave=autosave + remove_options=remove_options, + add_options=add_options ): if final: if not simplify_response: return response - messages_left = response["item"]["throttling"][ - "maxNumUserMessagesInConversation" - ] - response["item"]["throttling"].get( + messages_left = (response.get("item").get("throttling").get("maxNumUserMessagesInConversation") + - response.get("item").get("throttling").get( "numUserMessagesInConversation", 0, - ) + )) if messages_left == 0: raise Exception("Max messages reached") - message = "" - for msg in reversed(response["item"]["messages"]): - if msg.get("adaptiveCards") and msg["adaptiveCards"][0]["body"][ - 0 - ].get("text"): - message = msg - break + message = {} + for msg in reversed(response.get("item").get("messages")): + if msg.get("author") == "bot": + old_message = message.get("text") + if old_message: + old_message = old_message + " \n " + else: + old_message = "" + message.update({ + "author": "bot", + "text": old_message + msg.get("text") + }) if not message: raise Exception("No message found") - suggestions = [ - suggestion["text"] - for suggestion in message.get("suggestedResponses", []) - ] - adaptive_cards = message.get("adaptiveCards", []) - sources = ( - adaptive_cards[0]["body"][0].get("text") if adaptive_cards else None - ) - sources_link = ( - adaptive_cards[0]["body"][-1].get("text") - if adaptive_cards - else None - ) + image_create_text = "" + suggestions = [] + source_texts = [] + source_links = [] + for detail in reversed(response.get("item").get("messages")): + suggestion_responses = detail.get("suggestedResponses", {}) + source_attr = detail.get("sourceAttributions", {}) + if suggestion_responses: + for suggestion in suggestion_responses: + suggestions.append(suggestion.get("text")) + if source_attr: + for source in source_attr: + source_texts.append(source.get("providerDisplayName")) + source_links.append(source.get("seeMoreUrl")) + if detail.get("contentType") == "IMAGE" and detail.get("messageType") == "GenerateContentQuery": + image_create_text = detail.get("text") return { "text": message["text"], "author": message["author"], - "sources": sources, - "sources_link": sources_link, + "source_texts": source_texts, + "source_links": source_links, "suggestions": suggestions, + "image_create_text": image_create_text, "messages_left": messages_left, "max_messages": response["item"]["throttling"][ "maxNumUserMessagesInConversation" @@ -139,7 +149,8 @@ async def ask_stream( webpage_context: str | None = None, search_result: bool = False, locale: str = guess_locale(), - autosave: bool = True + remove_options: list = None, + add_options: list = None ) -> Generator[bool, dict | str, None]: """ Ask a question to the bot @@ -152,7 +163,8 @@ async def ask_stream( webpage_context=webpage_context, search_result=search_result, locale=locale, - autosave=autosave + remove_options=remove_options, + add_options=add_options ): yield response diff --git a/re_edge_gpt/chat/request.py b/re_edge_gpt/chat/request.py index 0dc1440..4708d5c 100644 --- a/re_edge_gpt/chat/request.py +++ b/re_edge_gpt/chat/request.py @@ -63,15 +63,14 @@ def update( "allowedMessageTypes": [ "ActionRequest", "Chat", - "ConfirmationCard", "Context", - "Disengaged", + "InternalSearchQuery", + "InternalSearchResult", + "InternalLoaderMessage", "Progress", - "RenderContentRequest", - "AdsQuery", - "SemanticSerp", "GenerateContentQuery", - "SearchQuery" + "SearchQuery", + "GeneratedCode", ], "sliceIds": [ "schurmsg", diff --git a/re_edge_gpt/image/upload_image.py b/re_edge_gpt/image/upload_image.py index 67254a3..3386872 100644 --- a/re_edge_gpt/image/upload_image.py +++ b/re_edge_gpt/image/upload_image.py @@ -3,6 +3,8 @@ import aiohttp +from re_edge_gpt.utils.constants import IMAGE_HEADER + payload = { "imageInfo": {}, "knowledgeRequest": { @@ -17,9 +19,10 @@ } -async def upload_image_url(image_url: str, conversation_id: str, proxy: str = None, face_blur: bool = True): +async def upload_image_url(image_url: str, conversation_id: str, cookies: dict, + proxy: str = None, face_blur: bool = True): async with aiohttp.ClientSession( - headers={"Referer": "https://www.bing.com/search?q=Bing+AI&showconv=1&FORM=hpcodx"}, + headers=IMAGE_HEADER, cookies=cookies ) as session: url = "https://www.bing.com/images/kblob" @@ -31,17 +34,22 @@ async def upload_image_url(image_url: str, conversation_id: str, proxy: str = No data = aiohttp.FormData() data.add_field('knowledgeRequest', json.dumps(new_payload), content_type="application/json") async with session.post(url, data=data, proxy=proxy) as resp: + if not resp.status == 200: + raise Exception("Upload image failed") return (await resp.json())["blobId"] -async def upload_image(filename: str = None, base64_image: str = None, proxy: str = None, face_blur: bool = True): +async def upload_image(conversation_id: str, cookies: dict, filename: str = None, + base64_image: str = None, proxy: str = None, face_blur: bool = True): async with aiohttp.ClientSession( - headers={"Referer": "https://www.bing.com/search?q=Bing+AI&showconv=1&FORM=hpcodx"}, + headers=IMAGE_HEADER, cookies=cookies ) as session: url = "https://www.bing.com/images/kblob" - new_payload = payload.get("knowledgeRequest").update( + new_payload = payload + new_payload.get("knowledgeRequest").update( {"invokedSkillsRequestData": {"enableFaceBlur": face_blur}}) + new_payload.get("knowledgeRequest").get("convoData").update({"convoid": conversation_id}) if filename is not None: with open(filename, 'rb') as f: @@ -55,6 +63,7 @@ async def upload_image(filename: str = None, base64_image: str = None, proxy: st data = aiohttp.FormData() data.add_field('knowledgeRequest', json.dumps(new_payload), content_type="application/json") data.add_field('imageBase64', image_base64, content_type="application/octet-stream") - async with session.post(url, data=data, proxy=proxy) as resp: + if not resp.status == 200: + raise Exception("Upload image failed") return (await resp.json())["blobId"] diff --git a/re_edge_gpt/utils/constants.py b/re_edge_gpt/utils/constants.py index 4d7434b..622e1a1 100644 --- a/re_edge_gpt/utils/constants.py +++ b/re_edge_gpt/utils/constants.py @@ -11,15 +11,15 @@ "accept-language": "en;q=0.9,en-US;q=0.8", "accept-encoding": "gzip, deflate, br, zsdch", "content-type": "application/json", - "sec-ch-ua": '"Microsoft Edge";v="120", ' - '"Chromium";v="120", ' - '"Not?A_Brand";v="8"', + "sec-ch-ua": '"Not A(Brand";v="99", ' + '"Microsoft Edge";v="121", ' + '"Chromium";v="121"', "sec-ch-ua-arch": '"x86"', "sec-ch-ua-bitness": '"64"', - "sec-ch-ua-full-version": '"1-120.0.2210.133"', - "sec-ch-ua-full-version-list": '"Not_A Brand";v="8.0.0.0", ' - '"Chromium";v="120.0.6099.217", ' - '"Microsoft Edge";v="120.0.2210.133', + "sec-ch-ua-full-version": '"121.0.2277.83"', + "sec-ch-ua-full-version-list": '"Not A(Brand";v="99.0.0.0", ' + '"Microsoft Edge";v="121.0.2277.83", ' + '"Chromium";v="121.0.6167.85"', "sec-ch-ua-mobile": "?0", "sec-ch-ua-model": "", "sec-ch-ua-platform": '"Windows"', @@ -39,13 +39,15 @@ "accept": "application/json", "accept-language": "en;q=0.9,en-US;q=0.8", "cache-control": "max-age=0", - "sec-ch-ua": '"Not_A Brand";v="8.0.0.0", "Chromium";v="120.0.6099.217", "Microsoft Edge";v="120.0.2210.133', + "sec-ch-ua": '"Not A(Brand";v="99", ' + '"Microsoft Edge";v="121", ' + '"Chromium";v="121"', "sec-ch-ua-arch": '"x86"', "sec-ch-ua-bitness": '"64"', - "sec-ch-ua-full-version": '"1-120.0.2210.133"', - "sec-ch-ua-full-version-list": '"Not_A Brand";v="8.0.0.0", ' - '"Chromium";v="120.0.6099.217", ' - '"Microsoft Edge";v="120.0.2210.133', + "sec-ch-ua-full-version": '"121.0.2277.83"', + "sec-ch-ua-full-version-list": '"Not A(Brand";v="99.0.0.0", ' + '"Microsoft Edge";v="121.0.2277.83", ' + '"Chromium";v="121.0.6167.85"', "sec-ch-ua-mobile": "?0", "sec-ch-ua-model": '""', "sec-ch-ua-platform": '"Windows"', @@ -61,6 +63,32 @@ "x-forwarded-for": FORWARDED_IP, } +IMAGE_HEADER = { + "Accept": "*/*", + "Accept-Encoding": "gzip, deflate, br", + "Content-Type": "multipart/form-data", + "Referer": "https://www.bing.com/search?q=Bing+AI&showconv=1&FORM=hpcodx", + "sec-ch-ua": '"Not A(Brand";v="99", ' + '"Microsoft Edge";v="121", ' + '"Chromium";v="121"', + "sec-ch-ua-arch": '"x86"', + "sec-ch-ua-bitness": '"64"', + "sec-ch-ua-full-version": '"121.0.2277.83"', + "sec-ch-ua-full-version-list": '"Not A(Brand";v="99.0.0.0", ' + '"Microsoft Edge";v="121.0.2277.83", ' + '"Chromium";v="121.0.6167.85"', + "Sec-Ch-Ua-Mobile": "?0", + "Sec-Ch-Ua-Platform": "Windows", + "Sec-Fetch-Dest": "empty", + "Sec-Fetch-Mode": "cors", + "Sec-Fetch-Site": "same-origin", + "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " + "AppleWebKit/537.36 (KHTML, like Gecko) " + "Chrome/120.0.0.0 " + "Safari/537.36 " + "Edg/120.0.0.0", +} + BUNDLE_VERSION = "1.1498.1" SYDNEY_INIT_HEADER = HEADERS_INIT_CONVER.update( diff --git a/re_edge_gpt/utils/conversation_style.py b/re_edge_gpt/utils/conversation_style.py index a5c54d1..f8848c6 100644 --- a/re_edge_gpt/utils/conversation_style.py +++ b/re_edge_gpt/utils/conversation_style.py @@ -9,45 +9,60 @@ class ConversationStyle(Enum): creative = [ - "nlu_direct_response_filter", - "deepleo", - "disable_emoji_spoken_text", - "responsible_ai_policy_235", - "enablemm", - "h3imaginative", - "objopinion", - "dsblhlthcrd", - "dv3sugg", - "autosave", - "clgalileo", - "gencontentv3", + "fluxcopilot", + "nojbf", + "iyxapbing", + "iycapbing", + "dgencontentv3", + "nointernalsugg", + "disable_telemetry", + "machine_affinity", + "streamf", + "codeint", + "langdtwb", + "fdwtlst", + "fluxprod", + "eredirecturl", + "deuct3" ] balanced = [ - "nlu_direct_response_filter", - "deepleo", - "disable_emoji_spoken_text", - "responsible_ai_policy_235", - "enablemm", + "fluxcopilot", + "nojbf", + "iyxapbing", + "iycapbing", + "dgencontentv3", + "nointernalsugg", + "disable_telemetry", + "machine_affinity", + "streamf", + "codeint", + "langdtwb", + "fdwtlst", + "fluxprod", + "eredirecturl", + "deuct3", + # Balance "galileo", - "saharagenconv5", - "objopinion", - "dsblhlthcrd", - "dv3sugg", - "autosave", + "gldcl1p" ] precise = [ - "nlu_direct_response_filter", - "deepleo", - "disable_emoji_spoken_text", - "responsible_ai_policy_235", - "enablemm", - "h3precise", - "objopinion", - "dsblhlthcrd", - "dv3sugg", - "autosave", - "clgalileo", - "gencontentv3", + "fluxcopilot", + "nojbf", + "iyxapbing", + "iycapbing", + "dgencontentv3", + "nointernalsugg", + "disable_telemetry", + "machine_affinity", + "streamf", + "codeint", + "langdtwb", + "fdwtlst", + "fluxprod", + "eredirecturl", + "deuct3", + # Precise + "h3precise" ] diff --git a/requirements.txt b/requirements.txt index b1f9e9d..2253ec8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ requests rich regex re-edge-gpt +Brotli diff --git a/test/source/example_reponse.json b/test/source/example_reponse.json new file mode 100644 index 0000000..93e3649 --- /dev/null +++ b/test/source/example_reponse.json @@ -0,0 +1,573 @@ +{ + "type": 2, + "invocationId": "3", + "item": { + "messages": [ + { + "text": "Cake recipe", + "author": "user", + "from": { + "id": "914798280546316", + "name": null, + "partnerId": null + }, + "createdAt": "2024-02-05T07:59:47.4652542+00:00", + "timestamp": "2024-02-05T15:59:46+08:00", + "locale": "en-us", + "market": "en-us", + "region": "us", + "locationInfo": { + "country": "Australia", + "state": "South Australia", + "city": "Adelaide", + "sourceType": 1, + "isImplicitLocationIntent": false + }, + "locationHints": [ + { + "country": "United States", + "countryConfidence": 8, + "state": "California", + "city": "Los Angeles", + "timeZoneOffset": 8, + "sourceType": 1, + "center": { + "latitude": 34.05369, + "longitude": -118.24277, + "height": null + }, + "regionType": 2 + } + ], + "messageId": "6d94fedd-f7b5-42e3-bb5d-380b66528949", + "requestId": "6d94fedd-f7b5-42e3-bb5d-380b66528949", + "nlu": { + "scoredClassification": { + "classification": "CHAT_GPT", + "score": null + }, + "classificationRanking": [ + { + "classification": "CHAT_GPT", + "score": null + } + ], + "qualifyingClassifications": null, + "ood": null, + "metaData": null, + "entities": null + }, + "offense": "None", + "feedback": { + "tag": null, + "updatedOn": null, + "type": "None" + }, + "contentOrigin": "cib", + "scores": [ + { + "component": "UserOffense", + "score": 0.0006932423 + }, + { + "component": "suicide_help", + "score": 0.01836964 + } + ], + "inputMethod": "Keyboard" + }, + { + "text": "Searching the web for: `Cake recipe`", + "hiddenText": "Cake recipe", + "author": "bot", + "createdAt": "2024-02-05T07:59:48.7661115+00:00", + "timestamp": "2024-02-05T07:59:48.7661115+00:00", + "messageId": "2c226a6a-8dbe-4835-8d14-33b26402364f", + "requestId": "6d94fedd-f7b5-42e3-bb5d-380b66528949", + "messageType": "InternalSearchQuery", + "offense": "None", + "adaptiveCards": [ + { + "type": "AdaptiveCard", + "version": "1.0", + "body": [ + { + "type": "RichTextBlock", + "inlines": [ + { + "type": "TextRun", + "isSubtle": true, + "italic": true, + "text": "Searching the web for: `Cake recipe`" + } + ] + } + ] + } + ], + "feedback": { + "tag": null, + "updatedOn": null, + "type": "None" + }, + "contentOrigin": "DeepLeo", + "invocation": "search_web(query=\"Cake recipe\")", + "toolResultPublishPreference": "Never" + }, + { + "text": "{\"recipe_search_results\":[{\"title\":\"The Perfect Chocolate Cake\",\"snippets\":[\"Perfectly moist and delicious, every time!\"],\"data\":{\"recipe_rating\":\"4.87/5\",\"recipe_time\":\"55 min\",\"ingredients_info\":\"1 ¾ cups - All-Purpose Flour,2 cups - Granulated Sugar,¾ cup - Unsweetened Cocoa Powder,1 teaspoon - Baking Powder,1 teaspoon - Kosher Salt,1 cup - Buttermilk (room temperature),2 - Large Eggs (at room temperature),2 teaspoons - Vanilla Extract,½ cup - Vegetable Oil,2 teaspoons - Baking Soda,1 cup - Freshly Brewed Coffee\"},\"url\":\"https://iambaker.net/cake-recipes/\"},{\"title\":\"The BEST Vanilla Cake Recipe\",\"snippets\":[\"This Classic Vanilla Cake pairs fluffy vanilla cake layers with a silky vanilla buttercream. The perfect cake for birthdays, weddings, or any occasion!\"],\"data\":{\"recipe_rating\":\"4.79/5\",\"recipe_reviewcount\":\"871\",\"recipe_time\":\"2 hr 35 min\",\"serving_info\":\"12\",\"calorie_info\":\"699\",\"ingredients_info\":\"2 ¼ cups - All-Purpose Flour,2 ¼ teaspoons - Baking Powder,¾ teaspoon - Salt,2 ¾ cups - Unsalted Butter (room temperature),3 cups - Granulated Sugar,3 - Large Eggs (room temperature),3 ½ teaspoons - Vanilla Extract,1 cup - Buttermilk (or whole milk, room temperature),6 - Large Egg Whites,add - Confetti Sprinkles,add - Nonpareils\"},\"url\":\"https://livforcake.com/vanilla-cake/\"},{\"title\":\"Vanilla Cake Recipe\",\"snippets\":[\"This delicious Vanilla Cake Recipe is so easy to make from scratch. With only a handful of ingredients, you can have this light and fluffy cake in no time.\"],\"data\":{\"recipe_rating\":\"5/5\",\"recipe_reviewcount\":\"1775\",\"recipe_time\":\"2 hr 45 min\",\"calorie_info\":\"1129\",\"ingredients_info\":\"2 ½ cups - All-Purpose Flour (280g),2 ¼ teaspoons - Baking Powder,1 teaspoon - Salt,1 ⅔ cups - Granulated Sugar (333g),¾ cup - Unsalted Butter (room temperature, 170g),3 - Large Eggs (room temperature),1 tablespoon - Vanilla (15mL),1 cup - Buttermilk (240mL),1 ½ cups - Unsalted Butter (room temperature),5 cups - Powdered Sugar,¼ cup - Milk (or cream, plus more as needed),2 teaspoons - Vanilla (10mL, plus more to taste if desired)\"},\"url\":\"https://preppykitchen.com/1448-2/\"}],\"web_search_results\":[{\"title\":\"Cake Recipes\",\"snippets\":[\"Cake Recipes Skip to content Allrecipes Search the site Search Please fill out this field. Log In My Account Log Out My Profile Saved Items & Collections Add a Recipe Help Magazine Subscribe Manage Your Subscription Give a Gift Subscription Get Help Newsletter Sweepstakes GET THE MAGAZINE Allrecipes Search Search Please fill out this field. Dinners Dinners 5-Ingredient Dinners One-Pot Meals Quick & Easy 30-Minute Meals Soups, Stews & Chili Comfort Food Main Dishes Sheet Pan Dinners View All Meals Meals Breakfast & Brunch Lunch Healthy Appetizers & Snacks Salads Side Dishes Soups Bread Drinks Desserts View All Ingredients Ingredients Chicken Beef Pork Seafood Pasta Fruits Vegetables View All Occasions Occasions Lunar New Year Recipes for the Super Bowl® Mardi Gras Valentine's Day View All Cuisines Cuisines Mexican Italian Chinese Indian German Greek Filipino Japanese View All Kitchen Tips Kitchen Tips Instant Pot Air Fryer Slow Cooker Product Reviews BBQ & Grilling Cookware & Equipment Ingredient Substitutions View All News News Recalls We Tried It Grocery Trends Celebrity & Entertainment View All Features Features Dinner Fix Sweet Spot In the Kitchen About Us About Us About Allrecipes Allstars How to Add a Recipe GET THE MAGAZINE Log In My Account My Account Log Out My Profile Saved Items & Collections Add a Recipe Help Magazine Magazine Subscribe Manage Your Subscription Give a Gift Subscription Get Help Newsletter Sweepstakes Follow Us Dinners 5-Ingredient Dinners One-Pot Meals Quick & Easy 30-Minute Meals Soups, Stews & Chili Comfort Food Main Dishes Sheet Pan Dinners View All Meals Breakfast & Brunch Lunch Healthy Appetizers & Snacks Salads Side Dishes Soups Bread Drinks Desserts View All Ingredients Chicken Beef Pork Seafood Pasta Fruits Vegetables View All Occasions Lunar New Year Recipes for the Super Bowl® Mardi Gras Valentine's Day View All Cuisines Mexican Italian Chinese Indian German Greek Filipino Japanese View All Kitchen Tips Instant Pot Air Fryer Slow Cooker Product Reviews BBQ & Grilling Cookware & Equipment Ingredient Substitutions View All News Recalls We Tried It Grocery Trends Celebrity & Entertainment View All Features Dinner Fix Sweet Spot In the Kitchen About Us Allstars How to Add a Recipe GET THE MAGAZINE Desserts Cake Recipes See the best cake recipes. Trusted recipes for chocolate cake, white cake, banana cakes, and carrot cakes with photos and tips from home cooks. Coconut Cake Wedding Cakes Red Velvet Cake Banana Cake Apple Cake Peach Cake Pumpkin Cake Zucchini Cake Sheet Cake Pineapple Cake Strawberry Cake Sponge Cake Blueberry Cake Poke Cake Cake Pop Recipes Mug Cake Cake Roll Recipes Bundt Cake Cupcakes Holiday Cakes Lemon Cake Angel Food Cake Cake Mix Cakes Cheesecake Coffee Cake Fruitcake Pound Cake Spice Cake Tortes White Cake Yellow Cake Chocolate Cake Carrot Cake Pumpkin Rolls Frosting and Icing Recipes Our 15 Favorite Fall Cakes Will Make Your Home Smell Amazing Sweet and Spicy Pumpkin Cakes 12 Different Ways Cream Cheese Frosting Apple Cheesecake 15 Coffee Cake Recipes to Try if You Love Streusel Explore Cake Recipes Chocolate Stout Cake Gooey Butter Cake What would you like to cook? Search the site Search Pancakes Meatloaf Cookies Poppy Seed and Walnut Roll\",\"See the best cake recipes. Trusted recipes for chocolate cake, white cake, banana cakes, and carrot cakes with photos and tips from home cooks.\"],\"url\":\"https://www.allrecipes.com/recipes/276/desserts/cakes/\"},{\"title\":\"Cake recipes - BBC Food\",\"snippets\":[\"Browse our easy cake recipes: from birthday cakes, chocolate cakes and lemon drizzle cakes to the perfect Victoria sponge - not forgetting plenty of gluten-free options.\"],\"url\":\"https://www.bbc.co.uk/food/cake\"}]}", + "hiddenText": "search_web('Cake recipe') was invoked and returned:\n```json\n{\"recipe_search_results\":[{\"title\":\"The Perfect Chocolate Cake\",\"snippets\":[\"Perfectly moist and delicious, every time!\"],\"data\":{\"recipe_rating\":\"4.87/5\",\"recipe_time\":\"55 min\",\"ingredients_info\":\"1 ¾ cups - All-Purpose Flour,2 cups - Granulated Sugar,¾ cup - Unsweetened Cocoa Powder,1 teaspoon - Baking Powder,1 teaspoon - Kosher Salt,1 cup - Buttermilk (room temperature),2 - Large Eggs (at room temperature),2 teaspoons - Vanilla Extract,½ cup - Vegetable Oil,2 teaspoons - Baking Soda,1 cup - Freshly Brewed Coffee\"},\"url\":\"https://iambaker.net/cake-recipes/\"},{\"title\":\"The BEST Vanilla Cake Recipe\",\"snippets\":[\"This Classic Vanilla Cake pairs fluffy vanilla cake layers with a silky vanilla buttercream. The perfect cake for birthdays, weddings, or any occasion!\"],\"data\":{\"recipe_rating\":\"4.79/5\",\"recipe_reviewcount\":\"871\",\"recipe_time\":\"2 hr 35 min\",\"serving_info\":\"12\",\"calorie_info\":\"699\",\"ingredients_info\":\"2 ¼ cups - All-Purpose Flour,2 ¼ teaspoons - Baking Powder,¾ teaspoon - Salt,2 ¾ cups - Unsalted Butter (room temperature),3 cups - Granulated Sugar,3 - Large Eggs (room temperature),3 ½ teaspoons - Vanilla Extract,1 cup - Buttermilk (or whole milk, room temperature),6 - Large Egg Whites,add - Confetti Sprinkles,add - Nonpareils\"},\"url\":\"https://livforcake.com/vanilla-cake/\"},{\"title\":\"Vanilla Cake Recipe\",\"snippets\":[\"This delicious Vanilla Cake Recipe is so easy to make from scratch. With only a handful of ingredients, you can have this light and fluffy cake in no time.\"],\"data\":{\"recipe_rating\":\"5/5\",\"recipe_reviewcount\":\"1775\",\"recipe_time\":\"2 hr 45 min\",\"calorie_info\":\"1129\",\"ingredients_info\":\"2 ½ cups - All-Purpose Flour (280g),2 ¼ teaspoons - Baking Powder,1 teaspoon - Salt,1 ⅔ cups - Granulated Sugar (333g),¾ cup - Unsalted Butter (room temperature, 170g),3 - Large Eggs (room temperature),1 tablespoon - Vanilla (15mL),1 cup - Buttermilk (240mL),1 ½ cups - Unsalted Butter (room temperature),5 cups - Powdered Sugar,¼ cup - Milk (or cream, plus more as needed),2 teaspoons - Vanilla (10mL, plus more to taste if desired)\"},\"url\":\"https://preppykitchen.com/1448-2/\"}],\"web_search_results\":[{\"title\":\"Cake Recipes\",\"snippets\":[\"Cake Recipes Skip to content Allrecipes Search the site Search Please fill out this field. Log In My Account Log Out My Profile Saved Items & Collections Add a Recipe Help Magazine Subscribe Manage Your Subscription Give a Gift Subscription Get Help Newsletter Sweepstakes GET THE MAGAZINE Allrecipes Search Search Please fill out this field. Dinners Dinners 5-Ingredient Dinners One-Pot Meals Quick & Easy 30-Minute Meals Soups, Stews & Chili Comfort Food Main Dishes Sheet Pan Dinners View All Meals Meals Breakfast & Brunch Lunch Healthy Appetizers & Snacks Salads Side Dishes Soups Bread Drinks Desserts View All Ingredients Ingredients Chicken Beef Pork Seafood Pasta Fruits Vegetables View All Occasions Occasions Lunar New Year Recipes for the Super Bowl® Mardi Gras Valentine's Day View All Cuisines Cuisines Mexican Italian Chinese Indian German Greek Filipino Japanese View All Kitchen Tips Kitchen Tips Instant Pot Air Fryer Slow Cooker Product Reviews BBQ & Grilling Cookware & Equipment Ingredient Substitutions View All News News Recalls We Tried It Grocery Trends Celebrity & Entertainment View All Features Features Dinner Fix Sweet Spot In the Kitchen About Us About Us About Allrecipes Allstars How to Add a Recipe GET THE MAGAZINE Log In My Account My Account Log Out My Profile Saved Items & Collections Add a Recipe Help Magazine Magazine Subscribe Manage Your Subscription Give a Gift Subscription Get Help Newsletter Sweepstakes Follow Us Dinners 5-Ingredient Dinners One-Pot Meals Quick & Easy 30-Minute Meals Soups, Stews & Chili Comfort Food Main Dishes Sheet Pan Dinners View All Meals Breakfast & Brunch Lunch Healthy Appetizers & Snacks Salads Side Dishes Soups Bread Drinks Desserts View All Ingredients Chicken Beef Pork Seafood Pasta Fruits Vegetables View All Occasions Lunar New Year Recipes for the Super Bowl® Mardi Gras Valentine's Day View All Cuisines Mexican Italian Chinese Indian German Greek Filipino Japanese View All Kitchen Tips Instant Pot Air Fryer Slow Cooker Product Reviews BBQ & Grilling Cookware & Equipment Ingredient Substitutions View All News Recalls We Tried It Grocery Trends Celebrity & Entertainment View All Features Dinner Fix Sweet Spot In the Kitchen About Us Allstars How to Add a Recipe GET THE MAGAZINE Desserts Cake Recipes See the best cake recipes. Trusted recipes for chocolate cake, white cake, banana cakes, and carrot cakes with photos and tips from home cooks. Coconut Cake Wedding Cakes Red Velvet Cake Banana Cake Apple Cake Peach Cake Pumpkin Cake Zucchini Cake Sheet Cake Pineapple Cake Strawberry Cake Sponge Cake Blueberry Cake Poke Cake Cake Pop Recipes Mug Cake Cake Roll Recipes Bundt Cake Cupcakes Holiday Cakes Lemon Cake Angel Food Cake Cake Mix Cakes Cheesecake Coffee Cake Fruitcake Pound Cake Spice Cake Tortes White Cake Yellow Cake Chocolate Cake Carrot Cake Pumpkin Rolls Frosting and Icing Recipes Our 15 Favorite Fall Cakes Will Make Your Home Smell Amazing Sweet and Spicy Pumpkin Cakes 12 Different Ways Cream Cheese Frosting Apple Cheesecake 15 Coffee Cake Recipes to Try if You Love Streusel Explore Cake Recipes Chocolate Stout Cake Gooey Butter Cake What would you like to cook? Search the site Search Pancakes Meatloaf Cookies Poppy Seed and Walnut Roll\",\"See the best cake recipes. Trusted recipes for chocolate cake, white cake, banana cakes, and carrot cakes with photos and tips from home cooks.\"],\"url\":\"https://www.allrecipes.com/recipes/276/desserts/cakes/\"},{\"title\":\"Cake recipes - BBC Food\",\"snippets\":[\"Browse our easy cake recipes: from birthday cakes, chocolate cakes and lemon drizzle cakes to the perfect Victoria sponge - not forgetting plenty of gluten-free options.\"],\"url\":\"https://www.bbc.co.uk/food/cake\"}]}\n```", + "author": "bot", + "createdAt": "2024-02-05T07:59:49.7013412+00:00", + "timestamp": "2024-02-05T07:59:49.7013412+00:00", + "messageId": "a1b7a553-3195-4175-8431-9ab1a7ad6755", + "requestId": "6d94fedd-f7b5-42e3-bb5d-380b66528949", + "messageType": "InternalSearchResult", + "offense": "None", + "adaptiveCards": [ + { + "type": "AdaptiveCard", + "version": "1.0", + "body": [ + { + "type": "RichTextBlock", + "inlines": [ + { + "type": "TextRun", + "isSubtle": true, + "italic": true, + "text": "{\"recipe_search_results\":[{\"title\":\"The Perfect Chocolate Cake\",\"snippets\":[\"Perfectly moist and delicious, every time!\"],\"data\":{\"recipe_rating\":\"4.87/5\",\"recipe_time\":\"55 min\",\"ingredients_info\":\"1 ¾ cups - All-Purpose Flour,2 cups - Granulated Sugar,¾ cup - Unsweetened Cocoa Powder,1 teaspoon - Baking Powder,1 teaspoon - Kosher Salt,1 cup - Buttermilk (room temperature),2 - Large Eggs (at room temperature),2 teaspoons - Vanilla Extract,½ cup - Vegetable Oil,2 teaspoons - Baking Soda,1 cup - Freshly Brewed Coffee\"},\"url\":\"https://iambaker.net/cake-recipes/\"},{\"title\":\"The BEST Vanilla Cake Recipe\",\"snippets\":[\"This Classic Vanilla Cake pairs fluffy vanilla cake layers with a silky vanilla buttercream. The perfect cake for birthdays, weddings, or any occasion!\"],\"data\":{\"recipe_rating\":\"4.79/5\",\"recipe_reviewcount\":\"871\",\"recipe_time\":\"2 hr 35 min\",\"serving_info\":\"12\",\"calorie_info\":\"699\",\"ingredients_info\":\"2 ¼ cups - All-Purpose Flour,2 ¼ teaspoons - Baking Powder,¾ teaspoon - Salt,2 ¾ cups - Unsalted Butter (room temperature),3 cups - Granulated Sugar,3 - Large Eggs (room temperature),3 ½ teaspoons - Vanilla Extract,1 cup - Buttermilk (or whole milk, room temperature),6 - Large Egg Whites,add - Confetti Sprinkles,add - Nonpareils\"},\"url\":\"https://livforcake.com/vanilla-cake/\"},{\"title\":\"Vanilla Cake Recipe\",\"snippets\":[\"This delicious Vanilla Cake Recipe is so easy to make from scratch. With only a handful of ingredients, you can have this light and fluffy cake in no time.\"],\"data\":{\"recipe_rating\":\"5/5\",\"recipe_reviewcount\":\"1775\",\"recipe_time\":\"2 hr 45 min\",\"calorie_info\":\"1129\",\"ingredients_info\":\"2 ½ cups - All-Purpose Flour (280g),2 ¼ teaspoons - Baking Powder,1 teaspoon - Salt,1 ⅔ cups - Granulated Sugar (333g),¾ cup - Unsalted Butter (room temperature, 170g),3 - Large Eggs (room temperature),1 tablespoon - Vanilla (15mL),1 cup - Buttermilk (240mL),1 ½ cups - Unsalted Butter (room temperature),5 cups - Powdered Sugar,¼ cup - Milk (or cream, plus more as needed),2 teaspoons - Vanilla (10mL, plus more to taste if desired)\"},\"url\":\"https://preppykitchen.com/1448-2/\"}],\"web_search_results\":[{\"title\":\"Cake Recipes\",\"snippets\":[\"Cake Recipes Skip to content Allrecipes Search the site Search Please fill out this field. Log In My Account Log Out My Profile Saved Items & Collections Add a Recipe Help Magazine Subscribe Manage Your Subscription Give a Gift Subscription Get Help Newsletter Sweepstakes GET THE MAGAZINE Allrecipes Search Search Please fill out this field. Dinners Dinners 5-Ingredient Dinners One-Pot Meals Quick & Easy 30-Minute Meals Soups, Stews & Chili Comfort Food Main Dishes Sheet Pan Dinners View All Meals Meals Breakfast & Brunch Lunch Healthy Appetizers & Snacks Salads Side Dishes Soups Bread Drinks Desserts View All Ingredients Ingredients Chicken Beef Pork Seafood Pasta Fruits Vegetables View All Occasions Occasions Lunar New Year Recipes for the Super Bowl® Mardi Gras Valentine's Day View All Cuisines Cuisines Mexican Italian Chinese Indian German Greek Filipino Japanese View All Kitchen Tips Kitchen Tips Instant Pot Air Fryer Slow Cooker Product Reviews BBQ & Grilling Cookware & Equipment Ingredient Substitutions View All News News Recalls We Tried It Grocery Trends Celebrity & Entertainment View All Features Features Dinner Fix Sweet Spot In the Kitchen About Us About Us About Allrecipes Allstars How to Add a Recipe GET THE MAGAZINE Log In My Account My Account Log Out My Profile Saved Items & Collections Add a Recipe Help Magazine Magazine Subscribe Manage Your Subscription Give a Gift Subscription Get Help Newsletter Sweepstakes Follow Us Dinners 5-Ingredient Dinners One-Pot Meals Quick & Easy 30-Minute Meals Soups, Stews & Chili Comfort Food Main Dishes Sheet Pan Dinners View All Meals Breakfast & Brunch Lunch Healthy Appetizers & Snacks Salads Side Dishes Soups Bread Drinks Desserts View All Ingredients Chicken Beef Pork Seafood Pasta Fruits Vegetables View All Occasions Lunar New Year Recipes for the Super Bowl® Mardi Gras Valentine's Day View All Cuisines Mexican Italian Chinese Indian German Greek Filipino Japanese View All Kitchen Tips Instant Pot Air Fryer Slow Cooker Product Reviews BBQ & Grilling Cookware & Equipment Ingredient Substitutions View All News Recalls We Tried It Grocery Trends Celebrity & Entertainment View All Features Dinner Fix Sweet Spot In the Kitchen About Us Allstars How to Add a Recipe GET THE MAGAZINE Desserts Cake Recipes See the best cake recipes. Trusted recipes for chocolate cake, white cake, banana cakes, and carrot cakes with photos and tips from home cooks. Coconut Cake Wedding Cakes Red Velvet Cake Banana Cake Apple Cake Peach Cake Pumpkin Cake Zucchini Cake Sheet Cake Pineapple Cake Strawberry Cake Sponge Cake Blueberry Cake Poke Cake Cake Pop Recipes Mug Cake Cake Roll Recipes Bundt Cake Cupcakes Holiday Cakes Lemon Cake Angel Food Cake Cake Mix Cakes Cheesecake Coffee Cake Fruitcake Pound Cake Spice Cake Tortes White Cake Yellow Cake Chocolate Cake Carrot Cake Pumpkin Rolls Frosting and Icing Recipes Our 15 Favorite Fall Cakes Will Make Your Home Smell Amazing Sweet and Spicy Pumpkin Cakes 12 Different Ways Cream Cheese Frosting Apple Cheesecake 15 Coffee Cake Recipes to Try if You Love Streusel Explore Cake Recipes Chocolate Stout Cake Gooey Butter Cake What would you like to cook? Search the site Search Pancakes Meatloaf Cookies Poppy Seed and Walnut Roll\",\"See the best cake recipes. Trusted recipes for chocolate cake, white cake, banana cakes, and carrot cakes with photos and tips from home cooks.\"],\"url\":\"https://www.allrecipes.com/recipes/276/desserts/cakes/\"},{\"title\":\"Cake recipes - BBC Food\",\"snippets\":[\"Browse our easy cake recipes: from birthday cakes, chocolate cakes and lemon drizzle cakes to the perfect Victoria sponge - not forgetting plenty of gluten-free options.\"],\"url\":\"https://www.bbc.co.uk/food/cake\"}]}" + } + ] + } + ] + } + ], + "feedback": { + "tag": null, + "updatedOn": null, + "type": "None" + }, + "contentOrigin": "DeepLeo", + "invocation": "search_web(query=\"Cake recipe\")", + "groundingInfo": { + "recipe_search_results": [ + { + "index": null, + "title": "The Perfect Chocolate Cake", + "snippets": [ + "Perfectly moist and delicious, every time!" + ], + "data": { + "recipe_rating": "4.87/5", + "recipe_time": "55 min", + "ingredients_info": "1 ¾ cups - All-Purpose Flour,2 cups - Granulated Sugar,¾ cup - Unsweetened Cocoa Powder,1 teaspoon - Baking Powder,1 teaspoon - Kosher Salt,1 cup - Buttermilk (room temperature),2 - Large Eggs (at room temperature),2 teaspoons - Vanilla Extract,½ cup - Vegetable Oil,2 teaspoons - Baking Soda,1 cup - Freshly Brewed Coffee" + }, + "context": null, + "url": "https://iambaker.net/cake-recipes/", + "lastUpdatedDate": null + }, + { + "index": null, + "title": "The BEST Vanilla Cake Recipe", + "snippets": [ + "This Classic Vanilla Cake pairs fluffy vanilla cake layers with a silky vanilla buttercream. The perfect cake for birthdays, weddings, or any occasion!" + ], + "data": { + "recipe_rating": "4.79/5", + "recipe_reviewcount": "871", + "recipe_time": "2 hr 35 min", + "serving_info": "12", + "calorie_info": "699", + "ingredients_info": "2 ¼ cups - All-Purpose Flour,2 ¼ teaspoons - Baking Powder,¾ teaspoon - Salt,2 ¾ cups - Unsalted Butter (room temperature),3 cups - Granulated Sugar,3 - Large Eggs (room temperature),3 ½ teaspoons - Vanilla Extract,1 cup - Buttermilk (or whole milk, room temperature),6 - Large Egg Whites,add - Confetti Sprinkles,add - Nonpareils" + }, + "context": null, + "url": "https://livforcake.com/vanilla-cake/", + "lastUpdatedDate": null + }, + { + "index": null, + "title": "Vanilla Cake Recipe", + "snippets": [ + "This delicious Vanilla Cake Recipe is so easy to make from scratch. With only a handful of ingredients, you can have this light and fluffy cake in no time." + ], + "data": { + "recipe_rating": "5/5", + "recipe_reviewcount": "1775", + "recipe_time": "2 hr 45 min", + "calorie_info": "1129", + "ingredients_info": "2 ½ cups - All-Purpose Flour (280g),2 ¼ teaspoons - Baking Powder,1 teaspoon - Salt,1 ⅔ cups - Granulated Sugar (333g),¾ cup - Unsalted Butter (room temperature, 170g),3 - Large Eggs (room temperature),1 tablespoon - Vanilla (15mL),1 cup - Buttermilk (240mL),1 ½ cups - Unsalted Butter (room temperature),5 cups - Powdered Sugar,¼ cup - Milk (or cream, plus more as needed),2 teaspoons - Vanilla (10mL, plus more to taste if desired)" + }, + "context": null, + "url": "https://preppykitchen.com/1448-2/", + "lastUpdatedDate": null + } + ], + "web_search_results": [ + { + "index": null, + "title": "Cake Recipes", + "snippets": [ + "Cake Recipes Skip to content Allrecipes Search the site Search Please fill out this field. Log In My Account Log Out My Profile Saved Items & Collections Add a Recipe Help Magazine Subscribe Manage Your Subscription Give a Gift Subscription Get Help Newsletter Sweepstakes GET THE MAGAZINE Allrecipes Search Search Please fill out this field. Dinners Dinners 5-Ingredient Dinners One-Pot Meals Quick & Easy 30-Minute Meals Soups, Stews & Chili Comfort Food Main Dishes Sheet Pan Dinners View All Meals Meals Breakfast & Brunch Lunch Healthy Appetizers & Snacks Salads Side Dishes Soups Bread Drinks Desserts View All Ingredients Ingredients Chicken Beef Pork Seafood Pasta Fruits Vegetables View All Occasions Occasions Lunar New Year Recipes for the Super Bowl® Mardi Gras Valentine's Day View All Cuisines Cuisines Mexican Italian Chinese Indian German Greek Filipino Japanese View All Kitchen Tips Kitchen Tips Instant Pot Air Fryer Slow Cooker Product Reviews BBQ & Grilling Cookware & Equipment Ingredient Substitutions View All News News Recalls We Tried It Grocery Trends Celebrity & Entertainment View All Features Features Dinner Fix Sweet Spot In the Kitchen About Us About Us About Allrecipes Allstars How to Add a Recipe GET THE MAGAZINE Log In My Account My Account Log Out My Profile Saved Items & Collections Add a Recipe Help Magazine Magazine Subscribe Manage Your Subscription Give a Gift Subscription Get Help Newsletter Sweepstakes Follow Us Dinners 5-Ingredient Dinners One-Pot Meals Quick & Easy 30-Minute Meals Soups, Stews & Chili Comfort Food Main Dishes Sheet Pan Dinners View All Meals Breakfast & Brunch Lunch Healthy Appetizers & Snacks Salads Side Dishes Soups Bread Drinks Desserts View All Ingredients Chicken Beef Pork Seafood Pasta Fruits Vegetables View All Occasions Lunar New Year Recipes for the Super Bowl® Mardi Gras Valentine's Day View All Cuisines Mexican Italian Chinese Indian German Greek Filipino Japanese View All Kitchen Tips Instant Pot Air Fryer Slow Cooker Product Reviews BBQ & Grilling Cookware & Equipment Ingredient Substitutions View All News Recalls We Tried It Grocery Trends Celebrity & Entertainment View All Features Dinner Fix Sweet Spot In the Kitchen About Us Allstars How to Add a Recipe GET THE MAGAZINE Desserts Cake Recipes See the best cake recipes. Trusted recipes for chocolate cake, white cake, banana cakes, and carrot cakes with photos and tips from home cooks. Coconut Cake Wedding Cakes Red Velvet Cake Banana Cake Apple Cake Peach Cake Pumpkin Cake Zucchini Cake Sheet Cake Pineapple Cake Strawberry Cake Sponge Cake Blueberry Cake Poke Cake Cake Pop Recipes Mug Cake Cake Roll Recipes Bundt Cake Cupcakes Holiday Cakes Lemon Cake Angel Food Cake Cake Mix Cakes Cheesecake Coffee Cake Fruitcake Pound Cake Spice Cake Tortes White Cake Yellow Cake Chocolate Cake Carrot Cake Pumpkin Rolls Frosting and Icing Recipes Our 15 Favorite Fall Cakes Will Make Your Home Smell Amazing Sweet and Spicy Pumpkin Cakes 12 Different Ways Cream Cheese Frosting Apple Cheesecake 15 Coffee Cake Recipes to Try if You Love Streusel Explore Cake Recipes Chocolate Stout Cake Gooey Butter Cake What would you like to cook? Search the site Search Pancakes Meatloaf Cookies Poppy Seed and Walnut Roll", + "See the best cake recipes. Trusted recipes for chocolate cake, white cake, banana cakes, and carrot cakes with photos and tips from home cooks." + ], + "data": null, + "context": null, + "url": "https://www.allrecipes.com/recipes/276/desserts/cakes/", + "lastUpdatedDate": null + }, + { + "index": null, + "title": "Cake recipes - BBC Food", + "snippets": [ + "Browse our easy cake recipes: from birthday cakes, chocolate cakes and lemon drizzle cakes to the perfect Victoria sponge - not forgetting plenty of gluten-free options." + ], + "data": null, + "context": null, + "url": "https://www.bbc.co.uk/food/cake", + "lastUpdatedDate": null + } + ] + } + }, + { + "text": "Generating answers for you...", + "hiddenText": "Generating answers for you...", + "author": "bot", + "createdAt": "2024-02-05T07:59:51.6305039+00:00", + "timestamp": "2024-02-05T07:59:51.6305039+00:00", + "messageId": "ed2bc5df-7b21-48cd-9131-7b962abed56e", + "requestId": "6d94fedd-f7b5-42e3-bb5d-380b66528949", + "messageType": "InternalLoaderMessage", + "offense": "None", + "adaptiveCards": [ + { + "type": "AdaptiveCard", + "version": "1.0", + "body": [ + { + "type": "RichTextBlock", + "inlines": [ + { + "type": "TextRun", + "isSubtle": true, + "italic": true, + "text": "Generating answers for you..." + } + ] + } + ] + } + ], + "feedback": { + "tag": null, + "updatedOn": null, + "type": "None" + }, + "contentOrigin": "DeepLeo" + }, + { + "text": "Certainly! Here are **two delightful cake recipes** for you to choose from:\n\n1. **The Perfect Chocolate Cake**:\n - **Ingredients**:\n - 1 ¾ cups all-purpose flour\n - 2 cups granulated sugar\n - ¾ cup unsweetened cocoa powder\n - 1 teaspoon baking powder\n - 1 teaspoon kosher salt\n - 1 cup buttermilk (room temperature)\n - 2 large eggs (at room temperature)\n - 2 teaspoons vanilla extract\n - ½ cup vegetable oil\n - 2 teaspoons baking soda\n - 1 cup freshly brewed coffee\n - **Instructions**:\n 1. Preheat the oven to 350°F (175°C).\n 2. Grease and flour two 9-inch round cake pans.\n 3. In a large mixing bowl, combine flour, sugar, cocoa powder, baking powder, and salt.\n 4. Add buttermilk, eggs, vanilla extract, vegetable oil, and coffee. Mix until well combined.\n 5. Divide the batter evenly between the pans.\n 6. Bake for 30-35 minutes or until a toothpick inserted comes out clean.\n 7. Let the cakes cool in the pans for 10 minutes, then transfer to wire racks to cool completely.\n 8. Frost with your favorite frosting and enjoy! 🍰\n - **Source**: [^1^]\n\n2. **The BEST Vanilla Cake Recipe**:\n - **Ingredients**:\n - 2 ¼ cups all-purpose flour\n - 2 ¼ teaspoons baking powder\n - ¾ teaspoon salt\n - 2 ¾ cups unsalted butter (room temperature)\n - 3 cups granulated sugar\n - 3 large eggs (room temperature)\n - 3 ½ teaspoons vanilla extract\n - 1 cup buttermilk (or whole milk, room temperature)\n - 6 large egg whites\n - Confetti sprinkles and nonpareils (optional)\n - **Instructions**:\n 1. Preheat the oven to 350°F (175°C).\n 2. Grease and line three 8-inch round cake pans.\n 3. In a medium bowl, whisk together flour, baking powder, and salt.\n 4. In a separate large mixing bowl, cream butter and sugar until light and fluffy.\n 5. Add eggs one at a time, beating well after each addition.\n 6. Mix in vanilla extract.\n 7. Alternate adding flour mixture and buttermilk, beginning and ending with flour.\n 8. Fold in egg whites.\n 9. Divide batter evenly among the pans.\n 10. Bake for 25-30 minutes or until a toothpick inserted comes out clean.\n 11. Let the cakes cool in the pans for 10 minutes, then transfer to wire racks to cool completely.\n 12. Frost with vanilla buttercream and decorate as desired! 🎂\n - **Source**: [^2^]\n\nFeel free to choose the one that tempts your taste buds! Happy baking! 🍰🎉.", + "author": "bot", + "createdAt": "2024-02-05T08:00:05.1812669+00:00", + "timestamp": "2024-02-05T08:00:05.1812669+00:00", + "messageId": "1c1f80a2-ccfe-46a1-8691-43025f2f54b5", + "requestId": "6d94fedd-f7b5-42e3-bb5d-380b66528949", + "offense": "None", + "adaptiveCards": [ + { + "type": "AdaptiveCard", + "version": "1.0", + "id": "entity-image-top", + "body": [ + { + "type": "Image", + "url": "https://www.bing.com/th?id=OSK.HEROSsXAx44IgpGMgI8IAQTiq6spBC8E_VyEV4qsN8YZi0A&pid=cdx&w=320&h=189&c=7", + "altText": "Cake", + "width": "320px", + "height": "189px", + "knowledgeImageMetadata": { + "entityUrl": "https://www.bing.com/lite/auw?q=~aa0ce00a-8785-0f92-fd9d-99e106cc8e79&o=t%3A1%3Bb%3Afff%3Bs%3AUtilityAnswer_lite%2CEntityCardHtml&filters=convmode%3A%221%22&&cc=us&setlang=en", + "overlayImageUrl": null, + "enableShowerGlass": false + } + }, + { + "type": "TextBlock", + "text": "[1]: https://iambaker.net/cake-recipes/ \"\"\n[2]: https://livforcake.com/vanilla-cake/ \"\"\n[3]: https://preppykitchen.com/1448-2/ \"\"\n[4]: https://www.allrecipes.com/recipes/276/desserts/cakes/ \"\"\n[5]: https://www.bbc.co.uk/food/cake \"\"\n\nCertainly! Here are **two delightful cake recipes** for you to choose from:\n\n1. **The Perfect Chocolate Cake**:\n - **Ingredients**:\n - 1 ¾ cups all-purpose flour\n - 2 cups granulated sugar\n - ¾ cup unsweetened cocoa powder\n - 1 teaspoon baking powder\n - 1 teaspoon kosher salt\n - 1 cup buttermilk (room temperature)\n - 2 large eggs (at room temperature)\n - 2 teaspoons vanilla extract\n - ½ cup vegetable oil\n - 2 teaspoons baking soda\n - 1 cup freshly brewed coffee\n - **Instructions**:\n 1. Preheat the oven to 350°F (175°C).\n 2. Grease and flour two 9-inch round cake pans.\n 3. In a large mixing bowl, combine flour, sugar, cocoa powder, baking powder, and salt.\n 4. Add buttermilk, eggs, vanilla extract, vegetable oil, and coffee. Mix until well combined.\n 5. Divide the batter evenly between the pans.\n 6. Bake for 30-35 minutes or until a toothpick inserted comes out clean.\n 7. Let the cakes cool in the pans for 10 minutes, then transfer to wire racks to cool completely.\n 8. Frost with your favorite frosting and enjoy! 🍰\n - **Source**: [^1^][1]\n\n2. **The BEST Vanilla Cake Recipe**:\n - **Ingredients**:\n - 2 ¼ cups all-purpose flour\n - 2 ¼ teaspoons baking powder\n - ¾ teaspoon salt\n - 2 ¾ cups unsalted butter (room temperature)\n - 3 cups granulated sugar\n - 3 large eggs (room temperature)\n - 3 ½ teaspoons vanilla extract\n - 1 cup buttermilk (or whole milk, room temperature)\n - 6 large egg whites\n - Confetti sprinkles and nonpareils (optional)\n - **Instructions**:\n 1. Preheat the oven to 350°F (175°C).\n 2. Grease and line three 8-inch round cake pans.\n 3. In a medium bowl, whisk together flour, baking powder, and salt.\n 4. In a separate large mixing bowl, cream butter and sugar until light and fluffy.\n 5. Add eggs one at a time, beating well after each addition.\n 6. Mix in vanilla extract.\n 7. Alternate adding flour mixture and buttermilk, beginning and ending with flour.\n 8. Fold in egg whites.\n 9. Divide batter evenly among the pans.\n 10. Bake for 25-30 minutes or until a toothpick inserted comes out clean.\n 11. Let the cakes cool in the pans for 10 minutes, then transfer to wire racks to cool completely.\n 12. Frost with vanilla buttercream and decorate as desired! 🎂\n - **Source**: [^2^][2]\n\nFeel free to choose the one that tempts your taste buds! Happy baking! 🍰🎉\n", + "wrap": true + }, + { + "type": "TextBlock", + "id": "AttributionsTextBlockID", + "size": "small", + "text": "Learn more: [1. iambaker.net](https://iambaker.net/cake-recipes/) [2. livforcake.com](https://livforcake.com/vanilla-cake/) [3. preppykitchen.com](https://preppykitchen.com/1448-2/) [4. www.allrecipes.com](https://www.allrecipes.com/recipes/276/desserts/cakes/) [5. www.bbc.co.uk](https://www.bbc.co.uk/food/cake) [6. www.gettyimages.com](https://www.gettyimages.com/detail/news-photo/the-wedding-cake-by-claire-ptak-of-london-based-bakery-news-photo/960096678)", + "wrap": true + } + ] + } + ], + "sourceAttributions": [ + { + "providerDisplayName": "The Perfect Chocolate Cake", + "seeMoreUrl": "https://iambaker.net/cake-recipes/", + "urlSignature": "DUH+rwqSCGR0/uQgY3mcO7pRe7wz2dq+hHStSP5+qg8=", + "searchQuery": "Cake recipe", + "provider": "search_web" + }, + { + "providerDisplayName": "The BEST Vanilla Cake Recipe", + "seeMoreUrl": "https://livforcake.com/vanilla-cake/", + "urlSignature": "B1Li9XySUuWIW6L2bFvQNQ/DSwU4PJlg9gWjdyiV2IE=", + "searchQuery": "Cake recipe", + "provider": "search_web" + }, + { + "providerDisplayName": "Vanilla Cake Recipe", + "seeMoreUrl": "https://preppykitchen.com/1448-2/", + "urlSignature": "4i26vTUCGYn5xqttBRdZweqH0Any/CknWfGscrXWIw4=", + "searchQuery": "Cake recipe", + "provider": "search_web" + }, + { + "providerDisplayName": "Cake Recipes", + "seeMoreUrl": "https://www.allrecipes.com/recipes/276/desserts/cakes/", + "urlSignature": "kjk16pJXXHik07yJamhNE+EY++Vi0R8+BaY2ixRucaI=", + "searchQuery": "Cake recipe", + "provider": "search_web" + }, + { + "providerDisplayName": "Cake recipes - BBC Food", + "seeMoreUrl": "https://www.bbc.co.uk/food/cake", + "urlSignature": "uoZNHBdb9aMg9kXC8cgCFUFpyFFl3cqq7FeJ13n3prw=", + "searchQuery": "Cake recipe", + "provider": "search_web" + }, + { + "providerDisplayName": "Getty Images", + "seeMoreUrl": "https://www.gettyimages.com/detail/news-photo/the-wedding-cake-by-claire-ptak-of-london-based-bakery-news-photo/960096678" + } + ], + "feedback": { + "tag": null, + "updatedOn": null, + "type": "None" + }, + "contentOrigin": "DeepLeo", + "scores": [ + { + "component": "BotOffense", + "score": 0.001012286 + }, + { + "component": "BotOffense", + "score": 0.0010859444 + }, + { + "component": "BotOffense", + "score": 0.0012113064 + }, + { + "component": "BotOffense", + "score": 0.0010649627 + }, + { + "component": "BotOffense", + "score": 0.0009927262 + }, + { + "component": "BotOffense", + "score": 0.0006932423 + }, + { + "component": "BotOffense", + "score": 0.0006825019 + }, + { + "component": "BotOffense", + "score": 0.0007041516 + }, + { + "component": "BotOffense", + "score": 0.00080095365 + }, + { + "component": "BotOffense", + "score": 0.0007947255 + }, + { + "component": "BotOffense", + "score": 0.0008559007 + }, + { + "component": "BotOffense", + "score": 0.00081038737 + }, + { + "component": "BotOffense", + "score": 0.001044386 + }, + { + "component": "BotOffense", + "score": 0.00109019 + }, + { + "component": "BotOffense", + "score": 0.0011695103 + }, + { + "component": "BotOffense", + "score": 0.0011160142 + }, + { + "component": "BotOffense", + "score": 0.0010566838 + }, + { + "component": "BotOffense", + "score": 0.0010691263 + }, + { + "component": "BotOffense", + "score": 0.0012255674 + }, + { + "component": "BotOffense", + "score": 0.0012113064 + }, + { + "component": "BotOffense", + "score": 0.0017546144 + }, + { + "component": "BotOffense", + "score": 0.0017207355 + }, + { + "component": "BotOffense", + "score": 0.0018102111 + }, + { + "component": "BotOffense", + "score": 0.0016613906 + }, + { + "component": "BotOffense", + "score": 0.0014895174 + }, + { + "component": "BotOffense", + "score": 0.0013777326 + }, + { + "component": "BotOffense", + "score": 0.0066153924 + } + ], + "suggestedResponses": [ + { + "text": "What is the difference between baking powder and baking soda?", + "author": "user", + "createdAt": "2024-02-05T08:00:07.1591424+00:00", + "timestamp": "2024-02-05T08:00:07.1591424+00:00", + "messageId": "05ce9e2c-7401-45cc-b96f-930bdf1cf4db", + "messageType": "Suggestion", + "offense": "Unknown", + "feedback": { + "tag": null, + "updatedOn": null, + "type": "None" + }, + "contentOrigin": "SuggestionChipsFalconService" + }, + { + "text": "Can I use milk instead of buttermilk in these recipes?", + "author": "user", + "createdAt": "2024-02-05T08:00:07.1591435+00:00", + "timestamp": "2024-02-05T08:00:07.1591435+00:00", + "messageId": "a9629ada-9bb1-4a76-9358-46ba485f514b", + "messageType": "Suggestion", + "offense": "Unknown", + "feedback": { + "tag": null, + "updatedOn": null, + "type": "None" + }, + "contentOrigin": "SuggestionChipsFalconService" + }, + { + "text": "Do you have any gluten-free cake recipe?", + "author": "user", + "createdAt": "2024-02-05T08:00:07.1591439+00:00", + "timestamp": "2024-02-05T08:00:07.1591439+00:00", + "messageId": "b50c594b-f67b-49dc-a330-1f7930f1dbc0", + "messageType": "Suggestion", + "offense": "Unknown", + "feedback": { + "tag": null, + "updatedOn": null, + "type": "None" + }, + "contentOrigin": "SuggestionChipsFalconService" + } + ] + }, + { + "text": "Cake recipe", + "hiddenText": "```json\n{\"recipe_search_results\":[{\"index\":\"1\",\"context\":\"{\\\"recipe_id\\\":\\\"6240a2ae181d403ba0d9720b378d7be3\\\"}\",\"url\":\"https://iambaker.net/cake-recipes/\"},{\"index\":\"2\",\"context\":\"{\\\"recipe_id\\\":\\\"c4d3dba8bfd4c4475d739e3f8828d179\\\"}\",\"url\":\"https://livforcake.com/vanilla-cake/\"},{\"index\":\"3\",\"context\":\"{\\\"recipe_id\\\":\\\"b5c2c862ca0d7c771d717257c7cdf46c\\\"}\",\"url\":\"https://preppykitchen.com/1448-2/\"}]}\n```", + "author": "bot", + "createdAt": "2024-02-05T08:00:04.5509483+00:00", + "timestamp": "2024-02-05T08:00:04.5509483+00:00", + "messageId": "e7a9ee43-2760-40c4-be27-546bb6de2ddb", + "requestId": "6d94fedd-f7b5-42e3-bb5d-380b66528949", + "messageType": "RenderCardRequest", + "offense": "None", + "adaptiveCards": [ + { + "type": "AdaptiveCard", + "version": "1.0", + "body": [ + { + "type": "RichTextBlock", + "inlines": [ + { + "type": "TextRun", + "isSubtle": true, + "italic": true, + "text": "Cake recipe" + } + ] + } + ] + } + ], + "feedback": { + "tag": null, + "updatedOn": null, + "type": "None" + }, + "contentOrigin": "DeepLeo" + } + ], + "firstNewMessageIndex": 1, + "defaultChatName": null, + "conversationId": "51D|BingProd|98B347959B0B6FE2D5B23C56CC6F6C29CA387E879F46B630AB96918FE55D2B91", + "requestId": "6d94fedd-f7b5-42e3-bb5d-380b66528949", + "conversationExpiryTime": "2024-02-05T14:00:07.2264051Z", + "shouldInitiateConversation": true, + "telemetry": { + "startTime": "2024-02-05T07:59:47.4581744Z" + }, + "throttling": { + "maxNumUserMessagesInConversation": 30, + "numUserMessagesInConversation": 1, + "maxNumLongDocSummaryUserMessagesInConversation": 50, + "numLongDocSummaryUserMessagesInConversation": 0 + }, + "result": { + "value": "Success", + "message": "Cake recipe", + "serviceVersion": "20240203.103" + } + } +} \ No newline at end of file diff --git a/test/source/generate_image_response.json b/test/source/generate_image_response.json new file mode 100644 index 0000000..ac7dd56 --- /dev/null +++ b/test/source/generate_image_response.json @@ -0,0 +1,195 @@ +{ + "type": 2, + "invocationId": "3", + "item": { + "messages": [ + { + "text": "Can u generate some food image", + "author": "user", + "from": { + "id": "914798280546316", + "name": null, + "partnerId": null + }, + "createdAt": "2024-02-06T01:35:56.0009996+00:00", + "timestamp": "2024-02-06T09:35:54+08:00", + "locale": "en-us", + "market": "en-us", + "region": "us", + "locationInfo": { + "country": "Australia", + "state": "South Australia", + "city": "Adelaide", + "sourceType": 1, + "isImplicitLocationIntent": false + }, + "locationHints": [ + { + "country": "United States", + "countryConfidence": 8, + "state": "California", + "city": "Los Angeles", + "timeZoneOffset": 8, + "sourceType": 1, + "center": { + "latitude": 34.05369, + "longitude": -118.24277, + "height": null + }, + "regionType": 2 + } + ], + "messageId": "c5044fee-d168-45dd-b644-9c22c6fc0743", + "requestId": "c5044fee-d168-45dd-b644-9c22c6fc0743", + "nlu": { + "scoredClassification": { + "classification": "CHAT_GPT", + "score": null + }, + "classificationRanking": [ + { + "classification": "CHAT_GPT", + "score": null + } + ], + "qualifyingClassifications": null, + "ood": null, + "metaData": null, + "entities": null + }, + "offense": "None", + "feedback": { + "tag": null, + "updatedOn": null, + "type": "None" + }, + "contentOrigin": "cib", + "scores": [ + { + "component": "UserOffense", + "score": 0.0064882697 + }, + { + "component": "suicide_help", + "score": 0.01621503 + } + ], + "inputMethod": "Keyboard" + }, + { + "contentType": "IMAGE", + "text": "food", + "author": "bot", + "createdAt": "2024-02-06T01:35:57.4047391+00:00", + "timestamp": "2024-02-06T01:35:57.4047391+00:00", + "messageId": "06836583-aa88-43de-b1f7-8eaf9e527a95", + "requestId": "c5044fee-d168-45dd-b644-9c22c6fc0743", + "messageType": "GenerateContentQuery", + "offense": "None", + "feedback": { + "tag": null, + "updatedOn": null, + "type": "None" + }, + "contentOrigin": "DeepLeo", + "invocation": "graphic_art(prompt=\"food\")" + }, + { + "text": "I'll try to create that.", + "author": "bot", + "createdAt": "2024-02-06T01:35:58.0076269+00:00", + "timestamp": "2024-02-06T01:35:58.0076269+00:00", + "messageId": "ebe1e06f-e47d-470f-97ef-bda48a3d257c", + "requestId": "c5044fee-d168-45dd-b644-9c22c6fc0743", + "offense": "None", + "adaptiveCards": [ + { + "type": "AdaptiveCard", + "version": "1.0", + "body": [ + { + "type": "TextBlock", + "text": "I'll try to create that.\n", + "wrap": true + } + ] + } + ], + "sourceAttributions": [], + "feedback": { + "tag": null, + "updatedOn": null, + "type": "None" + }, + "contentOrigin": "DeepLeo", + "suggestedResponses": [ + { + "text": "Can you draw a picture of a pizza?", + "author": "user", + "createdAt": "2024-02-06T01:35:59.1695507+00:00", + "timestamp": "2024-02-06T01:35:59.1695507+00:00", + "messageId": "aa8d3cb2-92e7-43d2-981e-173380ec5eea", + "messageType": "Suggestion", + "offense": "Unknown", + "feedback": { + "tag": null, + "updatedOn": null, + "type": "None" + }, + "contentOrigin": "SuggestionChipsFalconService" + }, + { + "text": "How about drawing an image of sushi?", + "author": "user", + "createdAt": "2024-02-06T01:35:59.1695517+00:00", + "timestamp": "2024-02-06T01:35:59.1695517+00:00", + "messageId": "ae4581c4-b21a-418e-8964-60c37450b68d", + "messageType": "Suggestion", + "offense": "Unknown", + "feedback": { + "tag": null, + "updatedOn": null, + "type": "None" + }, + "contentOrigin": "SuggestionChipsFalconService" + }, + { + "text": "Draw me some fruits", + "author": "user", + "createdAt": "2024-02-06T01:35:59.169552+00:00", + "timestamp": "2024-02-06T01:35:59.169552+00:00", + "messageId": "16d9139c-922e-45d4-8234-40560f29ee0d", + "messageType": "Suggestion", + "offense": "Unknown", + "feedback": { + "tag": null, + "updatedOn": null, + "type": "None" + }, + "contentOrigin": "SuggestionChipsFalconService" + } + ] + } + ], + "firstNewMessageIndex": 1, + "defaultChatName": null, + "conversationId": "51D|BingProd|BD37D1DE4DBC113C0C68AB4439EDD367C4162BA398653EACD73368321C8D1D2F", + "requestId": "c5044fee-d168-45dd-b644-9c22c6fc0743", + "conversationExpiryTime": "2024-02-06T07:35:59.2109401Z", + "shouldInitiateConversation": true, + "telemetry": { + "startTime": "2024-02-06T01:35:55.9945813Z" + }, + "throttling": { + "maxNumUserMessagesInConversation": 30, + "numUserMessagesInConversation": 1, + "maxNumLongDocSummaryUserMessagesInConversation": 50, + "numLongDocSummaryUserMessagesInConversation": 0 + }, + "result": { + "value": "Success", + "message": "I'll try to create that.", + "serviceVersion": "20240203.114" + } + } +} \ No newline at end of file diff --git a/test/unit_test/back-end/manual_test/test.jpg b/test/unit_test/back-end/manual_test/test.jpg new file mode 100644 index 0000000..ff2d4eb Binary files /dev/null and b/test/unit_test/back-end/manual_test/test.jpg differ diff --git a/test/unit_test/back-end/manual_test/test_bot_manual.py b/test/unit_test/back-end/manual_test/test_bot_manual.py index 49bb820..4c9aafa 100644 --- a/test/unit_test/back-end/manual_test/test_bot_manual.py +++ b/test/unit_test/back-end/manual_test/test_bot_manual.py @@ -22,10 +22,10 @@ async def test_ask() -> None: str(Path(str(Path.cwd()) + "/copilot_cookies.json")), encoding="utf-8").read()) bot = await Chatbot.create(cookies=cookies, mode=mode) response = await bot.ask( - prompt="Beef noodle recipe", + prompt="Homemade toast recipe", conversation_style=ConversationStyle.balanced, - search_result=True, - autosave=False + simplify_response=True, + search_result=True ) # If you are using non ascii char you need set ensure_ascii=False print(json.dumps(response, indent=2, ensure_ascii=False)) diff --git a/test/unit_test/back-end/manual_test/test_bot_with_file.py b/test/unit_test/back-end/manual_test/test_bot_with_file.py index e822007..e356c65 100644 --- a/test/unit_test/back-end/manual_test/test_bot_with_file.py +++ b/test/unit_test/back-end/manual_test/test_bot_with_file.py @@ -20,7 +20,7 @@ async def test_ask() -> None: prompt="What does this image show?", conversation_style=ConversationStyle.balanced, simplify_response=True, - attachment={"image_url": r"https://images.yourstory.com/cs/2/96eabe90392211eb93f18319e8c07a74/Image54nh-1683225460858.jpg"}) + attachment={"filename": "test.jpg"}) # If you are using non ascii char you need set ensure_ascii=False print(json.dumps(response, indent=2, ensure_ascii=False)) # Raw response