huggingface / chat-ui

Open source codebase powering the HuggingChat app
https://huggingface.co/chat
Apache License 2.0
7.61k stars 1.12k forks source link

Web Search failed with "Invalid URL" #656

Closed gururise closed 10 months ago

gururise commented 11 months ago

image

Why is this happening? It seems to happen regardless of whether I have USE_LOCAL_WEBSEARCH set to true or false.

SERPAPI_KEY=<my key>
USE_LOCAL_WEBSEARCH=true

MODELS=`[
    {
      "name": "mistralai/Mixtral-8x7b-Instruct-v0.1",
      "displayName": "mistralai/Mixtral-8x7b-Instruct-v0.1",
      "description": "Mixtral-8x7b-Instruct-v0.1 is a state of the art language model, based on a mixture of experts, that outperforms ChatGPT.",
      "websiteUrl": "https://www.aaprintsupplyco.com",
      "preprompt": "",
      "chatPromptTemplate" : "<s>{{#each messages}}{{#ifUser}}[INST] {{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}}{{content}} [/INST]{{/ifUser}}{{#ifAssistant}}{{content}}</s>{{/ifAssistant}}{{/each}}",
      "parameters": {
        "temperature": 0.4,
        "top_p": 0.95,
        "top_k": 50,
        "truncate": 31768,
        "max_new_tokens": 2048,
        "stop": ["[INST]","</s>"]
      },
      "endpoints" : [{
        "type": "openai",
        "baseURL": "https://api.together.xyz/v1"
      }],
      "promptExamples": [
        {
          "title": "Write a blog post",
          "prompt": "Your goal is to help me create a compelling blog post about a topic.\nYou will follow the following process:\n\n1. Ask me for the topic of the blog post.\n2. After I provide my answer you will need to collect some additional information by going through the next steps:\na) Questions (ask any relevant questions pertaining to what additional information is needed from me to write a good blog post).\n\nOnce you have enough information, or once I say I am done, you will write the blog post."
        }, {
          "title": "Improve my English",
          "prompt": "I want you to act as an English grammar and spelling corrector and improver. I will speak to you and you will answer in the corrected and improved version of my text, in English. I want you to replace my simplified A0-level words and sentences with improved, higher level English words and sentences. Keep the meaning same, but make them sound better. I want you to only reply the correction, the improvements and nothing else, do not write explanations. If there is nothing to improve, just reply with the original text."
        }, {
          "title": "Assist in a task",
          "prompt": "I want you to be my Prompt engineer. Your goal is to help me craft the best possible instruction prompt for my needs. The prompt will be used by you, an AI model. You will follow the following process:\n\n1. Your first response will be to simply ask me what the task I want to accomplish. \n2. After I provide my answer and you will generate a first iteration of the prompt, but we will need to improve it through continual iterations by going through the next steps. You will generate two sections:\na) Revised prompt (provide your rewritten prompt, it should be clear, concise, and easily understood by you),\nb) Questions (ask any relevant questions pertaining to what additional information is needed from me to improve the prompt).\n3. We will continue this iterative process with me providing additional information to you and you updating the prompt in the Revised prompt section until I say we are done.\n\nOnly after I say I am done, will you provide a response to the revised prompt."
        }
      ]
    },
    {
      "name": "openchat/openchat-3.5-1210",
      "displayName": "openchat/openchat-3.5-1210",
      "description": "OpenChat 3.5 is the #1 model on MT-Bench, with only 7B parameters. Small and fast.",
      "websiteUrl": "https://www.aaprintsupplyco.com",
      "preprompt": "",
      "chatPromptTemplate" : "<s>{{#each messages}}{{#ifUser}}GPT4 Correct User: {{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}}{{content}}<|end_of_turn|>GPT4 Correct Assistant:{{/ifUser}}{{#ifAssistant}}{{content}}<|end_of_turn|>{{/ifAssistant}}{{/each}}",
      "parameters": {
        "temperature": 0.4,
        "top_p": 0.95,
        "top_k": 50,
        "truncate": 8192,
        "max_new_tokens": 1024,
        "stop": ["<|end_of_turn|>","</s>"]
      },
      "endpoints" : [{
        "type": "openai",
        "baseURL": "https://api.together.xyz/v1"
      }],
      "promptExamples": [
        {
          "title": "Write a blog post",
          "prompt": "Your goal is to help me create a compelling blog post about a topic.\nYou will follow the following process:\n\n1. Ask me for the topic of the blog post.\n2. After I provide my answer you will need to collect some additional information by going through the next steps:\na) Questions (ask any relevant questions pertaining to what additional information is needed from me to write a good blog post).\n\nOnce you have enough information, or once I say I am done, you will write the blog post."
        }, {
          "title": "Improve my English",
          "prompt": "I want you to act as an English grammar and spelling corrector and improver. I will speak to you and you will answer in the corrected and improved version of my text, in English. I want you to replace my simplified A0-level words and sentences with improved, higher level English words and sentences. Keep the meaning same, but make them sound better. I want you to only reply the correction, the improvements and nothing else, do not write explanations. If there is nothing to improve, just reply with the original text."
        }, {
          "title": "Assist in a task",
          "prompt": "I want you to be my Prompt engineer. Your goal is to help me craft the best possible instruction prompt for my needs. The prompt will be used by you, an AI model. You will follow the following process:\n\n1. Your first response will be to simply ask me what the task I want to accomplish. \n2. After I provide my answer and you will generate a first iteration of the prompt, but we will need to improve it through continual iterations by going through the next steps. You will generate two sections:\na) Revised prompt (provide your rewritten prompt, it should be clear, concise, and easily understood by you),\nb) Questions (ask any relevant questions pertaining to what additional information is needed from me to improve the prompt).\n3. We will continue this iterative process with me providing additional information to you and you updating the prompt in the Revised prompt section until I say we are done.\n\nOnly after I say I am done, will you provide a response to the revised prompt."
        }
      ]
    }
]`

TASK_MODEL=`{
      "name": "mistralai/Mistral-7B-Instruct-v0.2",
      "chatPromptTemplate" : "<s>{{#each messages}}{{#ifUser}}[INST] {{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}}{{content}} [/INST]{{/ifUser}}{{#ifAssistant}}{{content}}</s>{{/ifAssistant}}{{/each}}",
      "parameters": {
        "temperature": 0.1,
        "top_p": 0.95,
        "repetition_penalty": 1.2,
        "top_k": 50,
        "truncate": 3072,
        "max_new_tokens": 1024,
        "stop": ["</s>"]
      }
}`

LLM_SUMMERIZATION=true
gururise commented 10 months ago

Just an update: I was able to confirm this issue only happens when USE_LOCAL_WEBSEARCH=true.

Using SERP API, does not result in an "Invalid URL" error.

EDIT: Sometimes I get "Invalid URL" even when using SERP API.

aayushdgkd commented 10 months ago

I am running into the same issue.

image
geronimi73 commented 10 months ago

have the same with only USE_LOCAL_WEBSEARCH=true, no API.

No error on the console. How do I debug this, any way to display the URL chat-UI is trying to access?

Screenshot 2024-01-01 at 15 48 13
S0ly commented 10 months ago

na its not fixed I still have it

aayushdgkd commented 10 months ago

This is fixed now.