gptscript-ai / knowledge

Knowledge for GPTScript
https://gptscript-ai.github.io/knowledge/
Apache License 2.0
29 stars 14 forks source link

Certain texts (mostly numbers) in the retrieved text is not readable. #11

Closed sangee2004 closed 5 months ago

sangee2004 commented 6 months ago

Steps to reproduce the problem:

  1. Ingest this earnings pdf file - 2023q4-alphabet-earnings-release.pdf
  2. Try to get the revenue breakdown by geo Notice that the output has many unreadable characters most of which seem to be numbers
    % knowledge retrieve -d mytestgoogle "Provide the revenue breakdown by geo"  

    Retrieved the following 5 sources for the query "Provide the revenue breakdown by geo" from dataset "mytestgoogle": [{"content":"Segment ResultsThe following table presents our segment revenues and operating income (loss) (in millions� unaudited):Quarter Ended December 31,20222023Revenues:Google Services� ��,�3� � ��,311 Google Cloud �,31� �,1�2 Other Bets 22� ��� Hedging gains (losses) ��� 1�0 Total revenues� ��,04� � ��,310 Operating income (loss):Google Services� 20,222 � 2�,�30 Google Cloud (1��) ��4 Other Bets (1,23�) (��3) Alphabet-level activities (�3�) (3,034) Total income from operations� 1�,1�0 � 23,��� We report our segment results as Google Services, Google Cloud, and Other Bets:�Google Services includes products and services such as ads, Android, Chrome, devices, Google Maps, Google Play, Search, and YouTube. Google Services generates revenues primarily from advertising� fees received for consumer subscription-based products such as YouTube T�, YouTube Music and Premium, and NFL Sunday Ticket� the sale of apps and in-app purchases and devices.�Google Cloud includes infrastructure and platform services, collaboration tools, and other services for enterprise customers. Google Cloud generates revenues primarily from consumption-based fees and subscriptions received for Google Cloud Platform services, Google Workspace communication and collaboration tools, and other enterprise services.�Other Bets is a combination of multiple operating segments that are not individually material. Revenues from Other Bets are generated primarily from the sale of healthcare-related services and internet services.Certain costs are not allocated to our segments because they represent Alphabet-level activities. These costs primarily include AI-focused shared R�D activities, including development costs of our general AI models� corporate initiatives such as our philanthropic activities� corporate shared costs such as certain finance, human resource, and legal costs, including certain fines and settlements. Charges associated with reductions in our workforce and office space during 2023 were not allocated to our segments. Additionally, hedging gains (losses) related to revenue are not allocated to our segments.Other Income (Expense), NetThe following table presents our other income (expense), net (in millions� unaudited):Quarter Ended December 31,20222023Interest income� ��� � 1,110 Interest expense (�0) (��) Foreign currency exchange gain (loss), net (1��","metadata":{"filename":"2023q4-alphabet-earnings-release.pdf","page":"8","totalPages":"11"},"similarity_score":0.7955885},{"content":"Reconciliation from GAAP Revenues to Non-GAAP Constant Currency Revenues and GAAP Percentage Change in Revenues to Non-GAAP Percentage Change in Constant Currency Revenues (in millions, except percentages� unaudited):We provide non-GAAP constant currency revenues (�constant currency revenues�) and non-GAAP percentage change in constant currency revenues (�percentage change in constant currency revenues�), because they facilitate the comparison of current results to historic performance by excluding the effect of foreign exchange rate movements (�FX Effect�) as well as hedging activities, which are recogni�ed at the consolidated level, as they are not indicative of our core operating results.Non-GAAP constant currency revenues is defined as revenues excluding the effect of foreign exchange rate movements and hedging activities and is calculated by translating current period revenues using prior period exchange rates and excluding any hedging effect recogni�ed in the current period. We calculate the percentage change in constant currency revenues by comparing constant currency revenues to the prior year comparable period revenues, excluding any hedging effect recogni�ed in the prior period.Revenues by GeographyComparison from the Quarter Ended December 31, 2022 to the Quarter Ended December 31, 2023Quarter Ended December 31, 2023% Change from Prior PeriodQuarter Ended December 31,Less FX EffectConstant Currency RevenuesAs ReportedLess Hedging EffectLess FX EffectConstant Currency Revenues20222023�nited States� 3�,��2 � 41,��� � 0 � 41,��� 14 % 0 % 14 %EMEA 21,��2 2�,010 1,10� 23,�0� 1� % � % 10 %APAC 11,��� 13,��� (�0) 14,0�� 1� % 0 % 1� %Other Americas 4,��� �,1�� (��) �,2�1 11 % (2) % 13 %Revenues, excluding hedging effect ��,3�� ��,1�0 �40 ��,220 14 % 1 % 13 %Hedging gains (losses) ��� 1�0 Total revenues(1)� ��,04� � ��,310 � ��,220 13 % (1) % 1 % 13 %(","metadata":{"filename":"2023q4-alphabet-earnings-release.pdf","page":"10","totalPages":"11"},"similarity_score":0.78555864},{"content":"�1 11 % (2) % 13 %Revenues, excluding hedging effect ��,3�� ��,1�0 �40 ��,220 14 % 1 % 13 %Hedging gains (losses) ��� 1�0 Total revenues(1)� ��,04� � ��,310 � ��,220 13 % (1) % 1 % 13 %(1)Total constant currency revenues of ���.2 billion for the quarter ended December 31, 2023 increased ��.� billion compared to ���.4 billion in revenues, excluding hedging effect for the quarter ended December 31, 2022.Comparison from the Quarter Ended September 30, 2023 to the Quarter Ended December 31, 2023Quarter Ended December 31, 2023% Change from Prior PeriodQuarter EndedLess FX EffectConstant Currency RevenuesAs ReportedLess Hedging EffectLess FX EffectConstant Currency RevenuesSeptember 30, 2023December 31, 2023�nited States� 3�,3�4 � 41,��� � 0 � 41,��� 1� % 0 % 1� %EMEA 22,��1 2�,010 (�0�) 2�,�1� 10 % (3) % 13 %APAC 13,12� 13,��� (1��) 14,1�� � % (2) % � %Other Americas 4,��3 �,1�� (1�1) �,32� 14 % (3) % 1� %Revenues, excluding hedging effect ��,��4 ��,1�0 (���) ��,01� 12 % (1) % 13 %Hedging gains (losses) (1) 1�0 Total revenues(1)� ��,��3 � ��,310 � ��,01� 13 % 1 % (1) % 13 %(1)Total constant currency revenues of ���.0 billion for the quarter ended December 31, 2023 increased �10.3 billion compared to ���.� billion in revenues, excluding hedging effect for the quarter ended September 30, ","metadata":{"filename":"2023q4-alphabet-earnings-release.pdf","page":"10","totalPages":"11"},"similarity_score":0.78425527},{"content":"Severance and office space exit charges are included within our consolidated statements of income as follows (in millions):Quarter Ended December 31, 2023Year Ended December 31, 2023Severance and RelatedOffice SpaceTotalSeverance and RelatedOffice SpaceTotalCost of revenues$ 2 $ 235 $ 237 $ 479 $ 481 $ 960 Research and development 1 602 603 848 870 1,718 Sales and marketing 3 198 201 497 257 754 General and administrative 1 161 162 264 237 501 Total charges$ 7 $ 1,196 $ 1,203 $ 2,088 $ 1,845 $ 3,933 For segment reporting, the substantial majority of these charges are included within Alphabet-level activities in our segment results.Change in Useful Lives of Our Server and Network EquipmentIn January 2023, we completed an assessment of the useful lives of our servers and network equipment and adjusted the estimated useful life of our servers from four years to six years and the estimated useful life of certain network equipment from five years to six years. This change in accounting estimate was effective beginning in fiscal year 2023, and the effect was a reduction in depreciation expense of $983 million and $3.9 billion and an increase in net income of $765 million and $3.0 billion, or $0.06 and $0.24 per basic and $0.06 and $0.24 per diluted share for the three and twelve months ended December 31, 2023, respectively.Webcast and Conference Call InformationA live audio webcast of our fourth quarter 2023 earnings release call will be available on YouTube at https://www.youtube.com/watch?v=b4alwdVvn4Q. The call begins today at 1:30 PM (PT) / 4:30 PM (ET). This press release, including the reconciliations of certain non-GAAP measures to their nearest comparable GAAP measures, is also available at http://abc.xyz/investor.We also provide announcements regarding our financial performance, including SEC filings, investor events, press and earnings releases, and blogs, on our investor relations website (http://abc.xyz/investor).We also share Google news and product updates on Google’s Keyword blog at https://www.blog.google/, which may be of interest or material to our investors. Forward-Looking StatementsThis press release","metadata":{"filename":"2023q4-alphabet-earnings-release.pdf","page":"3","totalPages":"11"},"similarity_score":0.77670896},{"content":" gains (losses) (1) 1�0 Total revenues(1)� ��,��3 � ��,310 � ��,01� 13 % 1 % (1) % 13 %(1)Total constant currency revenues of ���.0 billion for the quarter ended December 31, 2023 increased �10.3 billion compared to ���.� billion in revenues, excluding hedging effect for the quarter ended September 30, 2023.10","metadata":{"filename":"2023q4-alphabet-earnings-release.pdf","page":"10","totalPages":"11"},"similarity_score":0.77060413}]

When this output gets consumed by a LLM , the number reported are incorrect:

16:42:35 continue [main]
16:42:35 sent     [main]
         content  [1] content | Waiting for model response...
         content  [1] content | Revenue breakdown by geography for the quarter ended December 31, 2023:
         content  [1] content | 
         content  [1] content | - United States: $41,000 million
         content  [1] content | - EMEA (Europe, Middle East, and Africa): $23,010 million
         content  [1] content | - APAC (Asia-Pacific): $14,000 million
         content  [1] content | - Other Americas: $5,201 million
16:42:39 ended    [main] [output=Revenue breakdown by geography for the quarter ended December 31, 2023:

- United States: $41,000 million 
- EMEA (Europe, Middle East, and Africa): $23,010 million
- APAC (Asia-Pacific): $14,000 million
- Other Americas: $5,201 million]

From pdf file:

Screenshot 2024-05-03 at 5 00 41 PM
iwilltry42 commented 6 months ago

I suspect this is also related to the specific file encoding, see https://github.com/gptscript-ai/knowledge/issues/8#issuecomment-2097624239

StrongMonkey commented 5 months ago

Also seems to be fixed in main. Can be re-tested once new release is out.

sangee2004 commented 5 months ago

Tested with knowledge version - v0.1.6. This issue is not seen anymore. Able to retrieve information from this file successfully. All the numbers reported in the output match with the information present in the pdf.