help me I also want to make so the user can continue asking questions but to do that I…
- User
help me I also want to make so the user can continue asking questions but to do that I need to make sure the cleint also gets the data so it can store it in the current message group:
@app.post("/search1") async def predict(request: Request, user: str = Depends(get_current_user)): body = await request.body() create = requests.post("https://bing.github1s.tk/api/create") data = json.loads(create.text) message = body.decode() # convert bytes to string # logger.info(message) # Add this line message = f"""Could you please help me find the current used price for a {message}? Here are the steps to follow:
Conduct a search to determine the top 5 used prices for <{message}>.
If {message} is related to audio, you can also check https://www.hifishark.com/. Otherwise, you can skip this step.
Please provide only the top 5 used prices and exclude any retail prices.
Whenever possible, prioritize finding prices specific to the Swedish market (tradera/blocket/facebook) before looking internationally.
Please respond in Swedish. Thank you!""" header = {"Content-Type": "application/json"} request_message = { "conversationId": data["conversationId"], "encryptedconversationsignature": data["encryptedconversationsignature"], "clientId": data["clientId"], "invocationId": 0, "conversationStyle": "Balanced", "prompt": message, "allowSearch": True, "context": "", } # Serialize the dictionary to a JSON-formatted string request_message_json = json.dumps(request_message)
# Print the serialized request message print(request_message_json) # Make the POST request to the specified URL responded = requests.post( "https://bing.github1s.tk/api/sydney", data=request_message_json, headers=header ) # Check if the response has JSON content json_objects = responded.text.split("▲") json_objects = json_objects[0].split("\x1e") print(json_objects) texts = [] urls = [] for obj in json_objects: if obj: # Parse the JSON string json_data = json.loads(obj) print(json_data) if "arguments" in json_data and "messages" in json_data["arguments"][0]: for message in json_data["arguments"][0]["messages"]: texts = message["text"] # Look for adaptiveCards in the message if "adaptiveCards" in message: for adaptiveCard in message["adaptiveCards"]: # Continue only if 'body' is in the adaptiveCard if "body" in adaptiveCard: # Now extract texts with URLs where type is 'TextBlock' for item in adaptiveCard["body"]: if item["type"] == "TextBlock" and "text" in item: # Split text by whitespace and search for URLs urls = item["text"] # texts should now contain all extracted text fields from each message print(texts) pattern = r"\[(.*?)\]\((.*?)\)" urls = re.sub(pattern, r'<a href="\2" target="_blank">\1</a><br>', urls) urls = urls.replace("Learn more: ", "") texts += f"<br> {urls}" return StreamingResponse(text_generator(texts)) - Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.