Simatwa / python-tgpt

AI Chat in Terminal + Package + REST-API

Home Page:https://python-tgpt.onrender.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Phind content error

sameedzahoor opened this issue · comments

Asking Phind realtime questions is giving the following error:
19:30:31 - ERROR : 'content'
For example prompting pytgpt with the prompt What was the stock price for Nvidia yesterday? gives the above error.

This seems to be working fine with tgpt-golang. For the same prompt above tgpt-golang gives the answer:
The closing price for Nvidia on January 31, 2024, was $615.27 [0][1].

I think it's an issue with links. Whenever Phind is citing links to the information (like [0][1] above) it is leading to an error. If on the other hand the question is simple like Who are you? where the answer does not cite any links, it is answering fine.

I have the same problem with Phind.

Seems to be giving the answer at the end, but there is a huge chunk of request data at the beginning of the answer.
Lot's of following in the output stream:
{"id": "chatcmpl-ul1r18ogfa5gqi31gacf", "object": "chat.completion.chunk", "created": 1706966873, "model": "trt-llm-phind-model-34b-8k-context", "choices": [{"index": 0, "delta": {}, "finish_reason": "stop"}]}
followed by links and all.

F*ck I forgot to comment out stdout chunks resulting to that matter. To be fixed in a moment

Now only the search results and the links remain. What would be better? One might want to see the links at times but not normally. tgpt-golang omits all links.
What are your thoughts? Does it warrant a flag?

Now only the search results and the links remain. What would be better? One might want to see the links at times but not normally. tgpt-golang omits all links. What are your thoughts? Does it warrant a flag?

If you ask that it not show links, the result is good.

image

You still get web search results. For the query What was the stock price of Nvidia yesterday? you get the following before the response:

SEARCH{"query": "Nvidia stock price yesterday"}web_results:
- description: 'Gold Yahoo Finance Chartbook: 31 charts explain markets and the economy
    right now NVIDIA Corporation (NVDA) NasdaqGS - NasdaqGS Real Time Price. Currency
    in USD Follow 2W 10W 9M 624.65 +14.34...'
  title: NVIDIA Corporation (NVDA) Stock Historical Prices & Data - Yahoo Finance
  url: https://finance.yahoo.com/quote/NVDA/history
- description: '2,023.50 +6.20(+0.31%) NVIDIA Corporation (NVDA) NasdaqGS - NasdaqGS
    Real Time Price. Currency in USD Follow 2W 10W 9M 610.31 -5.86 (-0.95%) At close:
    04:00PM EST 610.22 -0.09 (-0.01%) After...'
  title: NVIDIA Corporation (NVDA) Stock Price, News, Quote & History - Yahoo ...
  url: https://finance.yahoo.com/quote/NVDA/
- description: $15.00 RIVN2.22%
  title: NVIDIA Corp (NVDA) Stock Price & News - Google Finance
  url: https://www.google.com/finance/quote/NVDA:NASDAQ
- description: '$610.31 Advanced Charting Volume: 18.93M 65 Day Avg: 42.64M 44% vs
    Avg 609.07 Day Range 618.75 189.50 52 Week Range 628.49 Partner Center Your Watchlists
    Customize MarketWatch Have Watchlists?...'
  title: 'NVDA Stock Price | NVIDIA Corp. Stock Quote (U.S.: Nasdaq) | MarketWatch'
  url: https://www.marketwatch.com/investing/stock/nvda
- description: Discover real-time NVIDIA Corporation Common Stock (NVDA) stock prices,
    quotes, historical data, news, and Insights for informed trading and investment
    decisions. Stay ahead with Nasdaq.
  title: '(NVDA) - Nasdaq: Stock Market, Data Updates, Reports & News'
  url: https://www.nasdaq.com/market-activity/stocks/nvda
- description: Mid Term 6W - 9M Long Term 9M+ Fair Value is the appropriate price
    for the shares of a company, based on its earnings and growth rate also interpreted
    as when P/E Ratio = Growth Rate.
  title: NVIDIA Corporation (NVDA) Latest Stock News & Headlines - Yahoo Finance
  url: https://finance.yahoo.com/quote/NVDA/news/
- description: Nasdaq provides market information on after hours trading daily from
    4:15 p.m. ET to 3:30 p.m. ET on the following day. Trending Stocks NVDA NVIDIA
    Corporation Common Stock $541.90 +10.50...
  title: NVIDIA Corporation Common Stock (NVDA) After-Hours Quotes - Nasdaq
  url: https://www.nasdaq.com/market-activity/stocks/nvda/after-hours
- description: 'End of Day Stock Quote : Enter the code shown above. * Investor Contact.
    2788 San Tomas Expressway Santa Clara, CA 95051 ... We intend to use our @NVIDIA
    Twitter account, NVIDIA Facebook page, NVIDIA LinkedIn page and company blog as
    a means of disclosing information about our company, our services and other matters
    and for complying with our ...'
  title: NVIDIA Corporation - Stock Quote & Chart
  url: https://investor.nvidia.com/stock-info/stock-quote-and-chart/default.aspx
- description: At Yahoo Finance, you get free stock quotes, up-to-date news, portfolio
    management resources, international market data, social interaction and mortgage
    rates that help you manage your financial life.
  title: NVDA Interactive Stock Chart | NVIDIA Corporation Stock - Yahoo Finance
  url: https://finance.yahoo.com/chart/NVDA
- description: Nvidia Corporation's stock price gain of +45% since August makes a
    steep sell-off in 2024 more likely, not less. ... the share price rose from $423
    to $615 yesterday, good for a +45% jump in value ...
  title: 'Nvidia: Was My Late-Summer Crash Call Wrong Or Early?'
  url: https://seekingalpha.com/article/4666890-nvidia-was-my-late-summer-crash-call-wrong-or-early
- description: "\uFEFF intraday 1w 1m 6m ytd 1y 3y 5y max Mountain-Chart Compare with\
    \ Compare with up to 5 Stocks On Monday morning 01/29/2024 the NVIDIA Corp. share\
    \ started trading at the price of $612.09...."
  title: NVIDIA Stock Price | NVDA Stock Quote, News, and History - Markets Insider
  url: https://markets.businessinsider.com/stocks/nvda-stock
- description: Real-time Price Updates for Nvidia Corp (NVDA-Q), along with buy or
    sell indicators, analysis, charts, historical performance, news and more
  title: Nvidia Corp (NVDA-Q) Stock Price and News - The Globe and Mail
  url: https://www.theglobeandmail.com/investing/markets/stocks/NVDA/
- description: "January 19, 2024 at 1:33 PM \xB7 3 min read Nvidia ( NVDA) stocks\
    \ hit an all-time high on Friday, as the AI craze continues to roll on in early\
    \ 2024. Nvidia\u2019s share price jumped more than 2% to..."
  title: Nvidia stock hits all-time high as AI craze rolls on - Yahoo Finance
  url:
https://finance.yahoo.com/news/nvidia-stock-hits-all-time-high-as-ai-craze-rolls-on-183354730.html
The stock price of Nvidia (NVDA) yesterday was $661.60 [2].

I am implementing this in szl. Looking up links will be optional. I will omit the links to stdout normally but users will have the option to look up the info in links and references of the last search if they want.

Now only the search results and the links remain. What would be better? One might want to see the links at times but not normally. tgpt-golang omits all links. What are your thoughts? Does it warrant a flag?

I don't think it will be cool to implement a feature that's specific to only one provider. However, it's possible to completely ignore the web search results and just target the final response, on the other hand, one can just use regex to retrieve the urls among other web search results metadata and such. Your preference will be highly considered.

I

I am implementing this in szl. Looking up links will be optional. I will omit the links to stdout normally but users will have the option to look up the info in links and references of the last search if they want.

This is really amazing, though the script is not working on my side. Perhaps I will raise a concern over there.

You still get web search results. For the query What was the stock price of Nvidia yesterday? you get the following before the response:

SEARCH{"query": "Nvidia stock price yesterday"}web_results:
- description: 'Gold Yahoo Finance Chartbook: 31 charts explain markets and the economy
    right now NVIDIA Corporation (NVDA) NasdaqGS - NasdaqGS Real Time Price. Currency
    in USD Follow 2W 10W 9M 624.65 +14.34...'
  title: NVIDIA Corporation (NVDA) Stock Historical Prices & Data - Yahoo Finance
  url: https://finance.yahoo.com/quote/NVDA/history
- description: '2,023.50 +6.20(+0.31%) NVIDIA Corporation (NVDA) NasdaqGS - NasdaqGS
    Real Time Price. Currency in USD Follow 2W 10W 9M 610.31 -5.86 (-0.95%) At close:
    04:00PM EST 610.22 -0.09 (-0.01%) After...'
  title: NVIDIA Corporation (NVDA) Stock Price, News, Quote & History - Yahoo ...
  url: https://finance.yahoo.com/quote/NVDA/
- description: $15.00 RIVN2.22%
  title: NVIDIA Corp (NVDA) Stock Price & News - Google Finance
  url: https://www.google.com/finance/quote/NVDA:NASDAQ
- description: '$610.31 Advanced Charting Volume: 18.93M 65 Day Avg: 42.64M 44% vs
    Avg 609.07 Day Range 618.75 189.50 52 Week Range 628.49 Partner Center Your Watchlists
    Customize MarketWatch Have Watchlists?...'
  title: 'NVDA Stock Price | NVIDIA Corp. Stock Quote (U.S.: Nasdaq) | MarketWatch'
  url: https://www.marketwatch.com/investing/stock/nvda
- description: Discover real-time NVIDIA Corporation Common Stock (NVDA) stock prices,
    quotes, historical data, news, and Insights for informed trading and investment
    decisions. Stay ahead with Nasdaq.
  title: '(NVDA) - Nasdaq: Stock Market, Data Updates, Reports & News'
  url: https://www.nasdaq.com/market-activity/stocks/nvda
- description: Mid Term 6W - 9M Long Term 9M+ Fair Value is the appropriate price
    for the shares of a company, based on its earnings and growth rate also interpreted
    as when P/E Ratio = Growth Rate.
  title: NVIDIA Corporation (NVDA) Latest Stock News & Headlines - Yahoo Finance
  url: https://finance.yahoo.com/quote/NVDA/news/
- description: Nasdaq provides market information on after hours trading daily from
    4:15 p.m. ET to 3:30 p.m. ET on the following day. Trending Stocks NVDA NVIDIA
    Corporation Common Stock $541.90 +10.50...
  title: NVIDIA Corporation Common Stock (NVDA) After-Hours Quotes - Nasdaq
  url: https://www.nasdaq.com/market-activity/stocks/nvda/after-hours
- description: 'End of Day Stock Quote : Enter the code shown above. * Investor Contact.
    2788 San Tomas Expressway Santa Clara, CA 95051 ... We intend to use our @NVIDIA
    Twitter account, NVIDIA Facebook page, NVIDIA LinkedIn page and company blog as
    a means of disclosing information about our company, our services and other matters
    and for complying with our ...'
  title: NVIDIA Corporation - Stock Quote & Chart
  url: https://investor.nvidia.com/stock-info/stock-quote-and-chart/default.aspx
- description: At Yahoo Finance, you get free stock quotes, up-to-date news, portfolio
    management resources, international market data, social interaction and mortgage
    rates that help you manage your financial life.
  title: NVDA Interactive Stock Chart | NVIDIA Corporation Stock - Yahoo Finance
  url: https://finance.yahoo.com/chart/NVDA
- description: Nvidia Corporation's stock price gain of +45% since August makes a
    steep sell-off in 2024 more likely, not less. ... the share price rose from $423
    to $615 yesterday, good for a +45% jump in value ...
  title: 'Nvidia: Was My Late-Summer Crash Call Wrong Or Early?'
  url: https://seekingalpha.com/article/4666890-nvidia-was-my-late-summer-crash-call-wrong-or-early
- description: "\uFEFF intraday 1w 1m 6m ytd 1y 3y 5y max Mountain-Chart Compare with\
    \ Compare with up to 5 Stocks On Monday morning 01/29/2024 the NVIDIA Corp. share\
    \ started trading at the price of $612.09...."
  title: NVIDIA Stock Price | NVDA Stock Quote, News, and History - Markets Insider
  url: https://markets.businessinsider.com/stocks/nvda-stock
- description: Real-time Price Updates for Nvidia Corp (NVDA-Q), along with buy or
    sell indicators, analysis, charts, historical performance, news and more
  title: Nvidia Corp (NVDA-Q) Stock Price and News - The Globe and Mail
  url: https://www.theglobeandmail.com/investing/markets/stocks/NVDA/
- description: "January 19, 2024 at 1:33 PM \xB7 3 min read Nvidia ( NVDA) stocks\
    \ hit an all-time high on Friday, as the AI craze continues to roll on in early\
    \ 2024. Nvidia\u2019s share price jumped more than 2% to..."
  title: Nvidia stock hits all-time high as AI craze rolls on - Yahoo Finance
  url:
https://finance.yahoo.com/news/nvidia-stock-hits-all-time-high-as-ai-craze-rolls-on-183354730.html
The stock price of Nvidia (NVDA) yesterday was $661.60 [2].

Actually nothing is wrong here. All these were part of the desired output.

Done. https://github.com/sameedzahoor/szl
Added a separate search mode for phind. Use :f to enter the mode from the prompt and try it out.
Use :sres to check the recent search results (the whole output).

Done. https://github.com/sameedzahoor/szl Added a separate search mode for phind. Use :f to enter the mode from the prompt and try it out. Use :sres to check the recent search results (the whole output).

Awesome work you're doing folk. Keep on keeping.

What's your idea on yielding the final result only excluding the web search findings?

We could have web search excluded by default but you could add a flag --keep-search-results to display search results when needed. This will have to be done for phind only though so you should be willing to add a flag for a single provider only.

I also tried something else that works.
pytgpt generate --quiet --raw --provider phind --disable-conversation "What is the latest news from the Mediterranean?" | pytgpt generate --quiet --raw --provider opengpt --disable-conversation "Refine this text by omitting all the results of search queries from the response. Keep the rest of the text as is while formatting it properly. Number all the links (urls) mentioned in the search queries in order starting from 0 and write the corresponding urls next to the citation with the url number inside [] at the end of the text."

The latter looks cool. Better that way. No change.