RafalWilinski / telegram-chatgpt-concierge-bot

Interact with OpenAI's ChatGPT via Telegram and Voice.
https://chatwithcloud.ai
1.13k stars 110 forks source link

Not able to run project on Ubuntu with given instructions #6

Open dougmorato opened 1 year ago

dougmorato commented 1 year ago

Hello,

Thank you for creating and sharing this. I saw the entry on Hacker News and tried to run this code but I only get errors.

node version = v18.15.0 npm version = 9.5.0 repository version : d6312ee46f1a24637c2937a0c216250cd2c886df - Date: Tue Apr 11 11:29:18 2023 +0200

I entered the .env settings details as instructed, both without double quotes and including double quotes for the string values of the API keys. I also tried using GPT 3.5 turbo as instructed on the readme without success.

Any ideas on what I should do ?

Error trace:

root@bot:/opt/telegram-chatgpt-concierge-bot# npm run dev

telegram-gpt-bot@1.0.0 dev

nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts

[nodemon] 2.0.22
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): src/**/*.ts
[nodemon] watching extensions: ts,json
[nodemon] starting `ts-node src/index.ts`

Healthcheck server listening on port undefined
Bot started
Input:  who is elon musk?
Entering new agent_executor chain...
AxiosError: Request failed with status code 404
    at createError (/opt/telegram-chatgpt-concierge-bot/node_modules/langchain/dist/util/axios-fetch-adapter.cjs:313:16)
    at settle (/opt/telegram-chatgpt-concierge-bot/node_modules/langchain/src/util/axios-fetch-adapter.js:47:3)
    at /opt/telegram-chatgpt-concierge-bot/node_modules/langchain/dist/util/axios-fetch-adapter.cjs:181:19
    at new Promise (<anonymous>)
    at fetchAdapter (/opt/telegram-chatgpt-concierge-bot/node_modules/langchain/dist/util/axios-fetch-adapter.cjs:173:12)
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  config: {
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    adapter: [AsyncFunction: fetchAdapter],
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    validateStatus: [Function: validateStatus],
    headers: {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'application/json',
      'User-Agent': 'OpenAI/NodeJS/3.2.1',
      Authorization: 'Bearer sk-REMOVED-FOR-PRIVACY...........'
    },
    method: 'post',
    data: '{"model":"gpt-4","temperature":1,"top_p":1,"frequency_penalty":0,"presence_penalty":0,"max_tokens":4000,"n":1,"stop":["Observation:"],"stream":false,"messages":[{"role":"system","content":"Assistant is a large language model trained by OpenAI.\\n\\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\\n\\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\\n\\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist."},{"role":"user","content":"TOOLS\\n------\\nAssistant can ask the user to use tools to look up information that may be helpful in answering the users original question. The tools the human can use are:\\n\\nGoogle Search Tool: This is Google. Use this tool to search the internet. Input should be a string\\n\\nRESPONSE FORMAT INSTRUCTIONS\\n----------------------------\\n\\nWhen responding to me please, please output a response in one of two formats:\\n\\n**Option 1:**\\nUse this if you want the human to use a tool.\\nMarkdown code snippet formatted in the following schema:\\n\\n```json\\n{\\n    \\"action\\": string \\\\ The action to take. Must be one of Google Search Tool\\n    \\"action_input\\": string \\\\ The input to the action\\n}\\n```\\n\\n**Option #2:**\\nUse this if you want to respond directly to the human. Markdown code snippet formatted in the following schema:\\n\\n```json\\n{\\n    \\"action\\": \\"Final Answer\\",\\n    \\"action_input\\": str

  },
  request: Request {
    [Symbol(realm)]: { settingsObject: [Object] },
    [Symbol(state)]: {
      method: 'POST',
      localURLsOnly: false,
      unsafeRequest: false,
      body: [Object],
      client: [Object],
      reservedClient: null,
      replacesClientId: '',
      window: 'client',
      keepalive: false,
      serviceWorkers: 'all',
      initiator: '',
      destination: '',
      priority: null,
      origin: 'client',
      policyContainer: 'client',
      referrer: 'client',
      referrerPolicy: '',
      mode: 'cors',
      useCORSPreflightFlag: false,
      credentials: 'same-origin',
      useCredentials: false,
      cache: 'default',
      redirect: 'follow',
      integrity: '',
      cryptoGraphicsNonceMetadata: '',
      parserMetadata: '',
      reloadNavigation: false,
      historyNavigation: false,
      userActivation: false,
      taintedOrigin: false,
      redirectCount: 0,
      responseTainting: 'basic',
      preventNoCacheCacheControlHeaderModification: false,
      done: false,
      timingAllowFailed: false,
      headersList: [HeadersList],
      urlList: [Array],
      url: [URL]
    },
    [Symbol(signal)]: AbortSignal { aborted: false },
    [Symbol(headers)]: HeadersList {
      cookies: null,
      [Symbol(headers map)]: [Map],
      [Symbol(headers map sorted)]: null
    }
  },
  response: {
    ok: false,
    status: 404,
    statusText: 'Not Found',
    headers: HeadersList {
      cookies: null,
      [Symbol(headers map)]: [Map],
      [Symbol(headers map sorted)]: null
    },
    config: {
      transitional: [Object],
      adapter: [AsyncFunction: fetchAdapter],
      transformRequest: [Array],
      transformResponse: [Array],
      timeout: 0,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      validateStatus: [Function: validateStatus],
      headers: [Object],
      method: 'post',
      data: '{"model":"gpt-4","temperature":1,"top_p":1,"frequency_penalty":0,"presence_penalty":0,"max_tokens":4000,"n":1,"stop":["Observation:"],"stream":false,"messages":[{"role":"system","content":"Assistant is a large language model trained by OpenAI.\\n\\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\\n\\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\\n\\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist."},{"role":"user","content":"TOOLS\\n------\\nAssistant can ask the user to use tools to look up information that may be helpful in answering the users original question. The tools the human can use are:\\n\\nGoogle Search Tool: This is Google. Use this tool to search the internet. Input should be a string\\n\\nRESPONSE FORMAT INSTRUCTIONS\\n----------------------------\\n\\nWhen responding to me please, please output a response in one of two formats:\\n\\n**Option 1:**\\nUse this if you want the human to use a tool.\\nMarkdown code snippet formatted in the following schema:\\n\\n```json\\n{\\n    \\"action\\": string \\\\ The action to take. Must be one of Google Search Tool\\n    \\"action_input\\": string \\\\ The input to the action\\n}\\n```\\n\\n**Option #2:**\\nUse this if you want to respond directly to the human. Markdown code snippet formatted in the following schema:\\n\\n```json\\n{\\n    \\"action\\": \\"Final Answer\\",\\n    \\"action_input\\": string \\\\ You should put what you want to return to use here\\n}\\n```\\n\\nUSER\'S INPUT\\n--------------------\\nHere is the user\'s input (remember to respond with a markdown code snippet of a json blob with a single action, and NOTHING else):\\n\\nwho is elon musk?"}]}',
      url: 'https://api.openai.com/v1/chat/completions'
    },
    request: Request {
      [Symbol(realm)]: [Object],
      [Symbol(state)]: [Object],
      [Symbol(signal)]: [AbortSignal],
      [Symbol(headers)]: [HeadersList]
    },
    data: { error: [Object] }
  }
}
centuryrehab commented 1 year ago

I had the same issue doing the same thing. I tried to clean up the npm fund list with npm install. Managed to get further to:

Entering new agent_executor chain... (node:2133) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time (Use node --trace-warnings ... to show where the warning was created) AxiosError: Request failed with status code 429

It responds back to telegram now: Whoops! There was an error while talking to OpenAI. See logs for details.

zachsa999 commented 1 year ago

2

I got this error because I wasn't on the GPT-4 API access list.

centuryrehab commented 1 year ago

But I'm using OPENAI_MODEL=gpt-3.5-turbo ?

zachsa999 commented 1 year ago

Check #2

There's a bug with 3.5 that still accepts querys too long.

zachsa999 commented 1 year ago

Check #2

There's a bug with 3.5 that still accepts querys too long.

Sorry that reply wasn't too clear. See #2 for my solution to this problem. Note, the value should be lowr, something like 1000

centuryrehab commented 1 year ago

Check #2 There's a bug with 3.5 that still accepts querys too long.

Sorry that reply wasn't too clear. See #2 for my solution to this problem. Note, the value should be lowr, something like 1000

tried that still no luck. I wonder if port undefined is the issue. I bet I'm missing something from npm fund.

Healthcheck server listening on port undefined Bot started Input: what is 1 + 1? Entering new agent_executor chain... (node:3532) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time (Use node --trace-warnings ... to show where the warning was created) AxiosError: Request failed with status code 429 at createError (/root/telegram-chatgpt-concierge-bot/node_modules/langchain/dist/util/axios-fetch-adapter.cjs:313:16) at settle (/root/telegram-chatgpt-concierge-bot/node_modules/langchain/src/util/axios-fetch-adapter.js:47:3) at /root/telegram-chatgpt-concierge-bot/node_modules/langchain/dist/util/axios-fetch-adapter.cjs:181:19 at new Promise () at fetchAdapter (/root/telegram-chatgpt-concierge-bot/node_modules/langchain/dist/util/axios-fetch-adapter.cjs:173:12) at processTicksAndRejections (node:internal/process/task_queues:95:5)