mpav commited on
Commit
6321b30
1 Parent(s): c5f50f2
Files changed (4) hide show
  1. .env +1 -1
  2. __pycache__/app.cpython-311.pyc +0 -0
  3. airbnb-test.ipynb +67 -25
  4. app.py +16 -4
.env CHANGED
@@ -1 +1 @@
1
- OPENAI_API_KEY=sk-xxx
 
1
+ OPENAI_API_KEY=sk-xx
__pycache__/app.cpython-311.pyc CHANGED
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
 
airbnb-test.ipynb CHANGED
@@ -11,7 +11,7 @@
11
  },
12
  {
13
  "cell_type": "code",
14
- "execution_count": 2,
15
  "metadata": {},
16
  "outputs": [],
17
  "source": [
@@ -23,7 +23,7 @@
23
  },
24
  {
25
  "cell_type": "code",
26
- "execution_count": 3,
27
  "metadata": {},
28
  "outputs": [],
29
  "source": [
@@ -34,7 +34,7 @@
34
  },
35
  {
36
  "cell_type": "code",
37
- "execution_count": 4,
38
  "metadata": {},
39
  "outputs": [],
40
  "source": [
@@ -43,7 +43,7 @@
43
  },
44
  {
45
  "cell_type": "code",
46
- "execution_count": 5,
47
  "metadata": {},
48
  "outputs": [],
49
  "source": [
@@ -53,7 +53,7 @@
53
  },
54
  {
55
  "cell_type": "code",
56
- "execution_count": 6,
57
  "metadata": {},
58
  "outputs": [],
59
  "source": [
@@ -62,7 +62,7 @@
62
  },
63
  {
64
  "cell_type": "code",
65
- "execution_count": 7,
66
  "metadata": {},
67
  "outputs": [],
68
  "source": [
@@ -78,7 +78,7 @@
78
  },
79
  {
80
  "cell_type": "code",
81
- "execution_count": 8,
82
  "metadata": {},
83
  "outputs": [],
84
  "source": [
@@ -93,7 +93,7 @@
93
  },
94
  {
95
  "cell_type": "code",
96
- "execution_count": 9,
97
  "metadata": {},
98
  "outputs": [
99
  {
@@ -115,7 +115,7 @@
115
  },
116
  {
117
  "cell_type": "code",
118
- "execution_count": 10,
119
  "metadata": {},
120
  "outputs": [],
121
  "source": [
@@ -126,7 +126,7 @@
126
  },
127
  {
128
  "cell_type": "code",
129
- "execution_count": 11,
130
  "metadata": {},
131
  "outputs": [],
132
  "source": [
@@ -136,7 +136,7 @@
136
  },
137
  {
138
  "cell_type": "code",
139
- "execution_count": 12,
140
  "metadata": {},
141
  "outputs": [],
142
  "source": [
@@ -156,17 +156,17 @@
156
  },
157
  {
158
  "cell_type": "code",
159
- "execution_count": 13,
160
  "metadata": {},
161
  "outputs": [
162
  {
163
  "data": {
164
  "text/plain": [
165
- "(Document(page_content='Table of Contents\\nPART I - FINANCIAL INFORMATION\\nItem 1. Condensed Consolidated Financial Statements\\nAirbnb, Inc.\\nCondensed Consolidated Balance Sheets\\n(in millions, except par value)\\n(unaudited)\\nDecember 31,\\n2023\\nMarch 31,\\n2024\\nAssets\\nCurrent assets:\\nCash and cash equivalents\\n$\\n6,874\\xa0 $\\n7,829\\xa0\\nShort-term investments (including assets reported at fair value of $2,507 and $2,524, respectively)\\n3,197\\xa0\\n3,264\\xa0\\nFunds receivable and amounts held on behalf of customers\\n5,869\\xa0\\n8,737\\xa0\\nPrepaids and other current assets (including customer receivables of $249 and $212 and allowances of $44 and $37, respectively)\\n569\\xa0\\n563\\xa0\\nTotal current assets\\n16,509\\xa0\\n20,393\\xa0\\nDeferred tax assets, net\\n2,881\\xa0\\n2,886\\xa0\\nGoodwill and intangible assets, net\\n792\\xa0\\n786\\xa0\\nOther assets, noncurrent\\n463\\xa0\\n472\\xa0\\nTotal assets\\n$\\n20,645\\xa0 $\\n24,537\\xa0\\nLiabilities and Stockholders’ Equity\\nCurrent liabilities:\\nAccrued expenses, accounts payable, and other current liabilities\\n$\\n2,654\\xa0 $\\n2,968\\xa0\\nFunds payable and amounts payable to customers\\n5,869\\xa0\\n8,737\\xa0\\nUnearned fees\\n1,427\\xa0\\n2,434\\xa0\\nTotal current liabilities\\n9,950\\xa0\\n14,139\\xa0\\nLong-term debt\\n1,991\\xa0\\n1,992\\xa0\\nOther liabilities, noncurrent\\n539\\xa0\\n510\\xa0\\nTotal liabilities\\n12,480\\xa0\\n16,641\\xa0\\nCommitments and contingencies (Note 9)\\nStockholders’ equity:\\nCommon stock, $0.0001 par value:\\nClass A - authorized 2,000 shares; 438 and 443 shares issued & outstanding, respectively;\\nClass B - authorized 710 shares; 200 and 193 shares issued & outstanding, respectively;\\nClass C - authorized 2,000 shares; zero shares of Class C common stock issued & outstanding, respectively; and\\nClass H - authorized 26 shares; 9 shares issued and zero shares outstanding, respectively\\n—\\xa0\\n—', metadata={'source': 'data/airbnb_midterm.pdf', 'file_path': 'data/airbnb_midterm.pdf', 'page': 4, 'total_pages': 54, 'format': 'PDF 1.4', 'title': '0001559720-24-000017', 'author': 'EDGAR® Online LLC, a subsidiary of OTC Markets Group', 'subject': 'Form 10-Q filed on 2024-05-08 for the period ending 2024-03-31', 'keywords': '0001559720-24-000017; ; 10-Q', 'creator': 'EDGAR Filing HTML Converter', 'producer': 'EDGRpdf Service w/ EO.Pdf 22.0.40.0', 'creationDate': \"D:20240508161757-04'00'\", 'modDate': \"D:20240508161807-04'00'\", 'trapped': '', 'encryption': 'Standard V2 R3 128-bit RC4', '_id': '571604f40b7247ebbfe404a43d5120a6', '_collection_name': 'air bnb data'}),\n",
166
- " 0.34878594896405274)"
167
  ]
168
  },
169
- "execution_count": 13,
170
  "metadata": {},
171
  "output_type": "execute_result"
172
  }
@@ -177,7 +177,7 @@
177
  },
178
  {
179
  "cell_type": "code",
180
- "execution_count": 14,
181
  "metadata": {},
182
  "outputs": [],
183
  "source": [
@@ -198,7 +198,7 @@
198
  },
199
  {
200
  "cell_type": "code",
201
- "execution_count": 15,
202
  "metadata": {},
203
  "outputs": [],
204
  "source": [
@@ -223,7 +223,7 @@
223
  },
224
  {
225
  "cell_type": "code",
226
- "execution_count": 16,
227
  "metadata": {},
228
  "outputs": [],
229
  "source": [
@@ -232,24 +232,66 @@
232
  },
233
  {
234
  "cell_type": "code",
235
- "execution_count": 17,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  "metadata": {},
237
  "outputs": [
238
  {
239
  "data": {
240
  "text/plain": [
241
- "{'response': AIMessage(content=\"Airbnb, Inc. operates a global platform for unique stays and experiences. The company's marketplace model connects hosts and guests online or through mobile devices to book spaces and experiences around the world.\", response_metadata={'token_usage': {'completion_tokens': 38, 'prompt_tokens': 3074, 'total_tokens': 3112}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-5c0cac68-ea8d-4dee-bb33-7bca745171d5-0', usage_metadata={'input_tokens': 3074, 'output_tokens': 38, 'total_tokens': 3112}),\n",
242
- " 'context': [(Document(page_content='Table of Contents\\nAirbnb, Inc.\\nNotes to Condensed Consolidated Financial Statements (unaudited)\\nNote 1. Description of Business\\nAirbnb,\\xa0Inc. (the “Company” or “Airbnb”) was incorporated in Delaware in June\\xa02008 and is headquartered in San Francisco, California. The Company\\xa0operates\\xa0a global platform for\\nunique stays and experiences. The Company’s marketplace model connects hosts and guests (collectively referred to as “customers��) online or through mobile devices to book\\nspaces and experiences around the world.\\nNote 2. Summary of Significant Accounting Policies\\nBasis of Presentation\\nThe accompanying unaudited condensed consolidated financial statements have been prepared in conformity with generally accepted accounting principles in the United States of\\nAmerica (“U.S. GAAP”) and the applicable rules and regulations of the Securities and Exchange Commission (the “SEC”) regarding interim financial information. Certain information\\nand note disclosures normally included in the consolidated financial statements prepared in accordance with U.S. GAAP have been condensed or omitted pursuant to such rules and\\nregulations. As such, the information included in this Quarterly Report on Form 10-Q should be read in conjunction with the audited consolidated financial statements and the related\\nnotes thereto as of and for the year ended December\\xa031, 2023, included in the Company’s Annual Report on Form 10-K, filed with the SEC on February 16, 2024. The results for the\\ninterim periods are not necessarily indicative of results for the full year. Certain immaterial amounts in prior periods have been reclassified to conform with current period\\npresentation.\\nIn the opinion of management, these unaudited condensed consolidated financial statements reflect all adjustments, consisting only of normal recurring adjustments, which are\\nnecessary for the fair statement of the unaudited condensed consolidated financial position, results of operations and cash flows for these interim periods.\\nPrinciples of Consolidation\\nThe accompanying unaudited condensed consolidated financial statements include the accounts of the Company and its wholly-owned subsidiaries in accordance with consolidation\\naccounting guidance. All intercompany transactions have been eliminated in consolidation.\\nUse of Estimates\\nThe preparation of the Company’s unaudited condensed consolidated financial statements in conformity with U.S. GAAP requires management to make certain estimates and\\nassumptions that affect the amounts reported in the unaudited condensed consolidated financial statements and accompanying notes. The Company regularly evaluates its', metadata={'source': 'data/airbnb_midterm.pdf', 'file_path': 'data/airbnb_midterm.pdf', 'page': 9, 'total_pages': 54, 'format': 'PDF 1.4', 'title': '0001559720-24-000017', 'author': 'EDGAR® Online LLC, a subsidiary of OTC Markets Group', 'subject': 'Form 10-Q filed on 2024-05-08 for the period ending 2024-03-31', 'keywords': '0001559720-24-000017; ; 10-Q', 'creator': 'EDGAR Filing HTML Converter', 'producer': 'EDGRpdf Service w/ EO.Pdf 22.0.40.0', 'creationDate': \"D:20240508161757-04'00'\", 'modDate': \"D:20240508161807-04'00'\", 'trapped': '', 'encryption': 'Standard V2 R3 128-bit RC4', '_id': '7d51cb24dfb14858a5c28533096cdbe5', '_collection_name': 'air bnb data'}),\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  " 0.5068435691149277),\n",
244
- " (Document(page_content='Table of Contents\\nPART I - FINANCIAL INFORMATION\\nItem 1. Condensed Consolidated Financial Statements\\nAirbnb, Inc.\\nCondensed Consolidated Balance Sheets\\n(in millions, except par value)\\n(unaudited)\\nDecember 31,\\n2023\\nMarch 31,\\n2024\\nAssets\\nCurrent assets:\\nCash and cash equivalents\\n$\\n6,874\\xa0 $\\n7,829\\xa0\\nShort-term investments (including assets reported at fair value of $2,507 and $2,524, respectively)\\n3,197\\xa0\\n3,264\\xa0\\nFunds receivable and amounts held on behalf of customers\\n5,869\\xa0\\n8,737\\xa0\\nPrepaids and other current assets (including customer receivables of $249 and $212 and allowances of $44 and $37, respectively)\\n569\\xa0\\n563\\xa0\\nTotal current assets\\n16,509\\xa0\\n20,393\\xa0\\nDeferred tax assets, net\\n2,881\\xa0\\n2,886\\xa0\\nGoodwill and intangible assets, net\\n792\\xa0\\n786\\xa0\\nOther assets, noncurrent\\n463\\xa0\\n472\\xa0\\nTotal assets\\n$\\n20,645\\xa0 $\\n24,537\\xa0\\nLiabilities and Stockholders’ Equity\\nCurrent liabilities:\\nAccrued expenses, accounts payable, and other current liabilities\\n$\\n2,654\\xa0 $\\n2,968\\xa0\\nFunds payable and amounts payable to customers\\n5,869\\xa0\\n8,737\\xa0\\nUnearned fees\\n1,427\\xa0\\n2,434\\xa0\\nTotal current liabilities\\n9,950\\xa0\\n14,139\\xa0\\nLong-term debt\\n1,991\\xa0\\n1,992\\xa0\\nOther liabilities, noncurrent\\n539\\xa0\\n510\\xa0\\nTotal liabilities\\n12,480\\xa0\\n16,641\\xa0\\nCommitments and contingencies (Note 9)\\nStockholders’ equity:\\nCommon stock, $0.0001 par value:\\nClass A - authorized 2,000 shares; 438 and 443 shares issued & outstanding, respectively;\\nClass B - authorized 710 shares; 200 and 193 shares issued & outstanding, respectively;\\nClass C - authorized 2,000 shares; zero shares of Class C common stock issued & outstanding, respectively; and\\nClass H - authorized 26 shares; 9 shares issued and zero shares outstanding, respectively\\n—\\xa0\\n—', metadata={'source': 'data/airbnb_midterm.pdf', 'file_path': 'data/airbnb_midterm.pdf', 'page': 4, 'total_pages': 54, 'format': 'PDF 1.4', 'title': '0001559720-24-000017', 'author': 'EDGAR® Online LLC, a subsidiary of OTC Markets Group', 'subject': 'Form 10-Q filed on 2024-05-08 for the period ending 2024-03-31', 'keywords': '0001559720-24-000017; ; 10-Q', 'creator': 'EDGAR Filing HTML Converter', 'producer': 'EDGRpdf Service w/ EO.Pdf 22.0.40.0', 'creationDate': \"D:20240508161757-04'00'\", 'modDate': \"D:20240508161807-04'00'\", 'trapped': '', 'encryption': 'Standard V2 R3 128-bit RC4', '_id': '571604f40b7247ebbfe404a43d5120a6', '_collection_name': 'air bnb data'}),\n",
245
  " 0.47142537803546586),\n",
246
- " (Document(page_content='Table of Contents\\nAirbnb, Inc.\\nCondensed Consolidated Statements of Operations\\n(in millions, except per share amounts)\\n(unaudited)\\nThree Months Ended\\nMarch 31,\\n2023\\n2024\\nRevenue\\n$\\n1,818\\xa0 $\\n2,142\\xa0\\nCosts and expenses:\\nCost of revenue\\n428\\xa0\\n480\\xa0\\nOperations and support\\n282\\xa0\\n285\\xa0\\nProduct development\\n420\\xa0\\n475\\xa0\\nSales and marketing\\n450\\xa0\\n514\\xa0\\nGeneral and administrative\\n243\\xa0\\n287\\xa0\\nTotal costs and expenses\\n1,823\\xa0\\n2,041\\xa0\\nIncome (loss) from operations\\n(5)\\n101\\xa0\\nInterest income\\n146\\xa0\\n202\\xa0\\nOther expense, net\\n(11)\\n(10)\\nIncome before income taxes\\n130\\xa0\\n293\\xa0\\nProvision for income taxes\\n13\\xa0\\n29\\xa0\\nNet income\\n$\\n117\\xa0 $\\n264\\xa0\\nNet income per share attributable to Class\\xa0A and Class\\xa0B common stockholders:\\nBasic\\n$\\n0.18\\xa0 $\\n0.41\\xa0\\nDiluted\\n$\\n0.18\\xa0 $\\n0.41\\xa0\\nWeighted-average shares used in computing net income per share attributable to Class\\xa0A and Class\\xa0B common stockholders:\\nBasic\\n634\\xa0\\n638\\xa0\\nDiluted\\n670\\xa0\\n654\\xa0\\nThe accompanying notes are an integral part of these condensed consolidated financial statements.\\n4', metadata={'source': 'data/airbnb_midterm.pdf', 'file_path': 'data/airbnb_midterm.pdf', 'page': 5, 'total_pages': 54, 'format': 'PDF 1.4', 'title': '0001559720-24-000017', 'author': 'EDGAR® Online LLC, a subsidiary of OTC Markets Group', 'subject': 'Form 10-Q filed on 2024-05-08 for the period ending 2024-03-31', 'keywords': '0001559720-24-000017; ; 10-Q', 'creator': 'EDGAR Filing HTML Converter', 'producer': 'EDGRpdf Service w/ EO.Pdf 22.0.40.0', 'creationDate': \"D:20240508161757-04'00'\", 'modDate': \"D:20240508161807-04'00'\", 'trapped': '', 'encryption': 'Standard V2 R3 128-bit RC4', '_id': 'ed7f1ec272af484e9ebc8f10e43f8d7c', '_collection_name': 'air bnb data'}),\n",
247
  " 0.4527725805360773),\n",
248
- " (Document(page_content='Table of Contents\\nAirbnb, Inc.\\nNotes to Condensed Consolidated Financial Statements (unaudited)\\nStock Option and Restricted Stock Unit Activity\\nA summary of stock option and restricted stock unit (“RSU”) activity under the Company’s equity incentive plans was as follows (in millions, except per share amounts):\\nOutstanding\\nStock Options\\nOutstanding\\nRSUs\\n\\xa0\\nShares\\nAvailable\\xa0for\\nGrant\\nNumber\\xa0of\\nShares\\nWeighted-\\nAverage\\nExercise\\nPrice\\nNumber\\xa0of\\nShares\\nWeighted-\\nAverage\\nGrant\\nDate Fair\\nValue\\nAs of December 31, 2023\\n134\\xa0\\n7\\xa0 $\\n71.76\\xa0\\n30\\xa0 $\\n85.35\\xa0\\nGranted\\n(7)\\n—\\xa0\\n—\\xa0\\n7\\xa0\\n166.17\\xa0\\nIncrease in shares available for grant\\n13\\xa0\\n—\\xa0\\n—\\xa0\\n—\\xa0\\n—\\xa0\\nOptions exercised/RSUs vested\\n1\\xa0\\n(1)\\n42.12\\xa0\\n(2)\\n109.14\\xa0\\nAs of March 31, 2024\\n141\\xa0\\n6\\xa0 $\\n80.12\\xa0\\n35\\xa0 $\\n100.12\\xa0\\n(1)\\nRSUs vested are net of shares withheld for taxes.\\nNumber of\\nShares\\nWeighted-\\nAverage\\nExercise\\nPrice\\nWeighted-\\nAverage\\nRemaining\\nContractual\\nLife (Years)\\nAggregate\\nIntrinsic\\nValue\\nOptions outstanding as of March 31, 2024\\n6\\xa0 $\\n80.12\\xa0\\n5.87 $\\n541\\xa0\\nOptions exercisable as of March 31, 2024\\n5\\xa0 $\\n66.85\\xa0\\n5.12 $\\n484\\xa0\\nNote 9. Commitments and Contingencies\\nCommitments\\nThe Company has commitments including purchase obligations for web-hosting services and other commitments for brand marketing. As of March\\xa031, 2024, there were no material\\nchanges outside the ordinary course of business to the Company’s commitments, as disclosed in its Annual Report on Form 10-K for the year ended December\\xa031, 2023.\\nLodging Tax Obligations and Other Non-Income Tax Matters\\nPlatform Related Taxes and Collection Obligations\\nSome states and localities in the United States and elsewhere in the world impose transient occupancy or lodging accommodations taxes (“Lodging Taxes”) on the use or occupancy', metadata={'source': 'data/airbnb_midterm.pdf', 'file_path': 'data/airbnb_midterm.pdf', 'page': 16, 'total_pages': 54, 'format': 'PDF 1.4', 'title': '0001559720-24-000017', 'author': 'EDGAR® Online LLC, a subsidiary of OTC Markets Group', 'subject': 'Form 10-Q filed on 2024-05-08 for the period ending 2024-03-31', 'keywords': '0001559720-24-000017; ; 10-Q', 'creator': 'EDGAR Filing HTML Converter', 'producer': 'EDGRpdf Service w/ EO.Pdf 22.0.40.0', 'creationDate': \"D:20240508161757-04'00'\", 'modDate': \"D:20240508161807-04'00'\", 'trapped': '', 'encryption': 'Standard V2 R3 128-bit RC4', '_id': '7ea4cac25d8d48e2a38a69d7c9c245e9', '_collection_name': 'air bnb data'}),\n",
249
  " 0.45249992651669707)]}"
250
  ]
251
  },
252
- "execution_count": 17,
253
  "metadata": {},
254
  "output_type": "execute_result"
255
  }
 
11
  },
12
  {
13
  "cell_type": "code",
14
+ "execution_count": 3,
15
  "metadata": {},
16
  "outputs": [],
17
  "source": [
 
23
  },
24
  {
25
  "cell_type": "code",
26
+ "execution_count": 4,
27
  "metadata": {},
28
  "outputs": [],
29
  "source": [
 
34
  },
35
  {
36
  "cell_type": "code",
37
+ "execution_count": 5,
38
  "metadata": {},
39
  "outputs": [],
40
  "source": [
 
43
  },
44
  {
45
  "cell_type": "code",
46
+ "execution_count": 6,
47
  "metadata": {},
48
  "outputs": [],
49
  "source": [
 
53
  },
54
  {
55
  "cell_type": "code",
56
+ "execution_count": 7,
57
  "metadata": {},
58
  "outputs": [],
59
  "source": [
 
62
  },
63
  {
64
  "cell_type": "code",
65
+ "execution_count": 8,
66
  "metadata": {},
67
  "outputs": [],
68
  "source": [
 
78
  },
79
  {
80
  "cell_type": "code",
81
+ "execution_count": 9,
82
  "metadata": {},
83
  "outputs": [],
84
  "source": [
 
93
  },
94
  {
95
  "cell_type": "code",
96
+ "execution_count": 10,
97
  "metadata": {},
98
  "outputs": [
99
  {
 
115
  },
116
  {
117
  "cell_type": "code",
118
+ "execution_count": 11,
119
  "metadata": {},
120
  "outputs": [],
121
  "source": [
 
126
  },
127
  {
128
  "cell_type": "code",
129
+ "execution_count": 12,
130
  "metadata": {},
131
  "outputs": [],
132
  "source": [
 
136
  },
137
  {
138
  "cell_type": "code",
139
+ "execution_count": 13,
140
  "metadata": {},
141
  "outputs": [],
142
  "source": [
 
156
  },
157
  {
158
  "cell_type": "code",
159
+ "execution_count": 14,
160
  "metadata": {},
161
  "outputs": [
162
  {
163
  "data": {
164
  "text/plain": [
165
+ "(Document(page_content='Table of Contents\\nPART I - FINANCIAL INFORMATION\\nItem 1. Condensed Consolidated Financial Statements\\nAirbnb, Inc.\\nCondensed Consolidated Balance Sheets\\n(in millions, except par value)\\n(unaudited)\\nDecember 31,\\n2023\\nMarch 31,\\n2024\\nAssets\\nCurrent assets:\\nCash and cash equivalents\\n$\\n6,874\\xa0 $\\n7,829\\xa0\\nShort-term investments (including assets reported at fair value of $2,507 and $2,524, respectively)\\n3,197\\xa0\\n3,264\\xa0\\nFunds receivable and amounts held on behalf of customers\\n5,869\\xa0\\n8,737\\xa0\\nPrepaids and other current assets (including customer receivables of $249 and $212 and allowances of $44 and $37, respectively)\\n569\\xa0\\n563\\xa0\\nTotal current assets\\n16,509\\xa0\\n20,393\\xa0\\nDeferred tax assets, net\\n2,881\\xa0\\n2,886\\xa0\\nGoodwill and intangible assets, net\\n792\\xa0\\n786\\xa0\\nOther assets, noncurrent\\n463\\xa0\\n472\\xa0\\nTotal assets\\n$\\n20,645\\xa0 $\\n24,537\\xa0\\nLiabilities and Stockholders’ Equity\\nCurrent liabilities:\\nAccrued expenses, accounts payable, and other current liabilities\\n$\\n2,654\\xa0 $\\n2,968\\xa0\\nFunds payable and amounts payable to customers\\n5,869\\xa0\\n8,737\\xa0\\nUnearned fees\\n1,427\\xa0\\n2,434\\xa0\\nTotal current liabilities\\n9,950\\xa0\\n14,139\\xa0\\nLong-term debt\\n1,991\\xa0\\n1,992\\xa0\\nOther liabilities, noncurrent\\n539\\xa0\\n510\\xa0\\nTotal liabilities\\n12,480\\xa0\\n16,641\\xa0\\nCommitments and contingencies (Note 9)\\nStockholders’ equity:\\nCommon stock, $0.0001 par value:\\nClass A - authorized 2,000 shares; 438 and 443 shares issued & outstanding, respectively;\\nClass B - authorized 710 shares; 200 and 193 shares issued & outstanding, respectively;\\nClass C - authorized 2,000 shares; zero shares of Class C common stock issued & outstanding, respectively; and\\nClass H - authorized 26 shares; 9 shares issued and zero shares outstanding, respectively\\n—\\xa0\\n—', metadata={'source': 'data/airbnb_midterm.pdf', 'file_path': 'data/airbnb_midterm.pdf', 'page': 4, 'total_pages': 54, 'format': 'PDF 1.4', 'title': '0001559720-24-000017', 'author': 'EDGAR® Online LLC, a subsidiary of OTC Markets Group', 'subject': 'Form 10-Q filed on 2024-05-08 for the period ending 2024-03-31', 'keywords': '0001559720-24-000017; ; 10-Q', 'creator': 'EDGAR Filing HTML Converter', 'producer': 'EDGRpdf Service w/ EO.Pdf 22.0.40.0', 'creationDate': \"D:20240508161757-04'00'\", 'modDate': \"D:20240508161807-04'00'\", 'trapped': '', 'encryption': 'Standard V2 R3 128-bit RC4', '_id': 'cd3a5f5a79b8454e8185ade4b614e309', '_collection_name': 'air bnb data'}),\n",
166
+ " 0.3487656607179074)"
167
  ]
168
  },
169
+ "execution_count": 14,
170
  "metadata": {},
171
  "output_type": "execute_result"
172
  }
 
177
  },
178
  {
179
  "cell_type": "code",
180
+ "execution_count": 15,
181
  "metadata": {},
182
  "outputs": [],
183
  "source": [
 
198
  },
199
  {
200
  "cell_type": "code",
201
+ "execution_count": 16,
202
  "metadata": {},
203
  "outputs": [],
204
  "source": [
 
223
  },
224
  {
225
  "cell_type": "code",
226
+ "execution_count": 17,
227
  "metadata": {},
228
  "outputs": [],
229
  "source": [
 
232
  },
233
  {
234
  "cell_type": "code",
235
+ "execution_count": 33,
236
+ "metadata": {},
237
+ "outputs": [
238
+ {
239
+ "name": "stdout",
240
+ "output_type": "stream",
241
+ "text": [
242
+ "|Air|bnb|,| Inc|.| was| incorporated| in| Delaware| in| June| |200|8| and| is| headquartered| in| San| Francisco|,| California|.| The| company| operates| a| global| platform| for| unique| stays| and| experiences|.| Its| marketplace| model| connects| hosts| and| guests| online| or| through| mobile| devices| to| book| spaces| and| experiences| around| the| world|.||"
243
+ ]
244
+ }
245
+ ],
246
+ "source": [
247
+ "chunks = []\n",
248
+ "\n",
249
+ "async for chunk in retrieval_augmented_qa_chain.astream({\"question\" : \"What is Airbnb's 'Description of Business'?\"}):\n",
250
+ " chunks.append(chunk)\n",
251
+ " if \"context\" not in chunk.keys():\n",
252
+ " print(chunk[\"response\"].content, end=\"|\", flush=True)"
253
+ ]
254
+ },
255
+ {
256
+ "cell_type": "code",
257
+ "execution_count": 32,
258
  "metadata": {},
259
  "outputs": [
260
  {
261
  "data": {
262
  "text/plain": [
263
+ "''"
264
+ ]
265
+ },
266
+ "execution_count": 32,
267
+ "metadata": {},
268
+ "output_type": "execute_result"
269
+ }
270
+ ],
271
+ "source": [
272
+ "chunks[1][\"response\"].content"
273
+ ]
274
+ },
275
+ {
276
+ "cell_type": "code",
277
+ "execution_count": 18,
278
+ "metadata": {},
279
+ "outputs": [
280
+ {
281
+ "data": {
282
+ "text/plain": [
283
+ "{'response': AIMessage(content=\"Airbnb, Inc. operates a global platform for unique stays and experiences. The Company's marketplace model connects hosts and guests online or through mobile devices to book spaces and experiences around the world.\", response_metadata={'token_usage': {'completion_tokens': 38, 'prompt_tokens': 3067, 'total_tokens': 3105}, 'model_name': 'gpt-3.5-turbo', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None}, id='run-4b846bb5-6910-4379-a3e3-e6728cca4788-0', usage_metadata={'input_tokens': 3067, 'output_tokens': 38, 'total_tokens': 3105}),\n",
284
+ " 'context': [(Document(page_content='Table of Contents\\nAirbnb, Inc.\\nNotes to Condensed Consolidated Financial Statements (unaudited)\\nNote 1. Description of Business\\nAirbnb,\\xa0Inc. (the “Company” or “Airbnb”) was incorporated in Delaware in June\\xa02008 and is headquartered in San Francisco, California. The Company\\xa0operates\\xa0a global platform for\\nunique stays and experiences. The Company’s marketplace model connects hosts and guests (collectively referred to as “customers”) online or through mobile devices to book\\nspaces and experiences around the world.\\nNote 2. Summary of Significant Accounting Policies\\nBasis of Presentation\\nThe accompanying unaudited condensed consolidated financial statements have been prepared in conformity with generally accepted accounting principles in the United States of\\nAmerica (“U.S. GAAP”) and the applicable rules and regulations of the Securities and Exchange Commission (the “SEC”) regarding interim financial information. Certain information\\nand note disclosures normally included in the consolidated financial statements prepared in accordance with U.S. GAAP have been condensed or omitted pursuant to such rules and\\nregulations. As such, the information included in this Quarterly Report on Form 10-Q should be read in conjunction with the audited consolidated financial statements and the related\\nnotes thereto as of and for the year ended December\\xa031, 2023, included in the Company’s Annual Report on Form 10-K, filed with the SEC on February 16, 2024. The results for the\\ninterim periods are not necessarily indicative of results for the full year. Certain immaterial amounts in prior periods have been reclassified to conform with current period\\npresentation.\\nIn the opinion of management, these unaudited condensed consolidated financial statements reflect all adjustments, consisting only of normal recurring adjustments, which are\\nnecessary for the fair statement of the unaudited condensed consolidated financial position, results of operations and cash flows for these interim periods.\\nPrinciples of Consolidation\\nThe accompanying unaudited condensed consolidated financial statements include the accounts of the Company and its wholly-owned subsidiaries in accordance with consolidation\\naccounting guidance. All intercompany transactions have been eliminated in consolidation.\\nUse of Estimates\\nThe preparation of the Company’s unaudited condensed consolidated financial statements in conformity with U.S. GAAP requires management to make certain estimates and\\nassumptions that affect the amounts reported in the unaudited condensed consolidated financial statements and accompanying notes. The Company regularly evaluates its', metadata={'source': 'data/airbnb_midterm.pdf', 'file_path': 'data/airbnb_midterm.pdf', 'page': 9, 'total_pages': 54, 'format': 'PDF 1.4', 'title': '0001559720-24-000017', 'author': 'EDGAR® Online LLC, a subsidiary of OTC Markets Group', 'subject': 'Form 10-Q filed on 2024-05-08 for the period ending 2024-03-31', 'keywords': '0001559720-24-000017; ; 10-Q', 'creator': 'EDGAR Filing HTML Converter', 'producer': 'EDGRpdf Service w/ EO.Pdf 22.0.40.0', 'creationDate': \"D:20240508161757-04'00'\", 'modDate': \"D:20240508161807-04'00'\", 'trapped': '', 'encryption': 'Standard V2 R3 128-bit RC4', '_id': '580457275865420ab26bff61797fa6ee', '_collection_name': 'air bnb data'}),\n",
285
  " 0.5068435691149277),\n",
286
+ " (Document(page_content='Table of Contents\\nPART I - FINANCIAL INFORMATION\\nItem 1. Condensed Consolidated Financial Statements\\nAirbnb, Inc.\\nCondensed Consolidated Balance Sheets\\n(in millions, except par value)\\n(unaudited)\\nDecember 31,\\n2023\\nMarch 31,\\n2024\\nAssets\\nCurrent assets:\\nCash and cash equivalents\\n$\\n6,874\\xa0 $\\n7,829\\xa0\\nShort-term investments (including assets reported at fair value of $2,507 and $2,524, respectively)\\n3,197\\xa0\\n3,264\\xa0\\nFunds receivable and amounts held on behalf of customers\\n5,869\\xa0\\n8,737\\xa0\\nPrepaids and other current assets (including customer receivables of $249 and $212 and allowances of $44 and $37, respectively)\\n569\\xa0\\n563\\xa0\\nTotal current assets\\n16,509\\xa0\\n20,393\\xa0\\nDeferred tax assets, net\\n2,881\\xa0\\n2,886\\xa0\\nGoodwill and intangible assets, net\\n792\\xa0\\n786\\xa0\\nOther assets, noncurrent\\n463\\xa0\\n472\\xa0\\nTotal assets\\n$\\n20,645\\xa0 $\\n24,537\\xa0\\nLiabilities and Stockholders’ Equity\\nCurrent liabilities:\\nAccrued expenses, accounts payable, and other current liabilities\\n$\\n2,654\\xa0 $\\n2,968\\xa0\\nFunds payable and amounts payable to customers\\n5,869\\xa0\\n8,737\\xa0\\nUnearned fees\\n1,427\\xa0\\n2,434\\xa0\\nTotal current liabilities\\n9,950\\xa0\\n14,139\\xa0\\nLong-term debt\\n1,991\\xa0\\n1,992\\xa0\\nOther liabilities, noncurrent\\n539\\xa0\\n510\\xa0\\nTotal liabilities\\n12,480\\xa0\\n16,641\\xa0\\nCommitments and contingencies (Note 9)\\nStockholders’ equity:\\nCommon stock, $0.0001 par value:\\nClass A - authorized 2,000 shares; 438 and 443 shares issued & outstanding, respectively;\\nClass B - authorized 710 shares; 200 and 193 shares issued & outstanding, respectively;\\nClass C - authorized 2,000 shares; zero shares of Class C common stock issued & outstanding, respectively; and\\nClass H - authorized 26 shares; 9 shares issued and zero shares outstanding, respectively\\n—\\xa0\\n—', metadata={'source': 'data/airbnb_midterm.pdf', 'file_path': 'data/airbnb_midterm.pdf', 'page': 4, 'total_pages': 54, 'format': 'PDF 1.4', 'title': '0001559720-24-000017', 'author': 'EDGAR® Online LLC, a subsidiary of OTC Markets Group', 'subject': 'Form 10-Q filed on 2024-05-08 for the period ending 2024-03-31', 'keywords': '0001559720-24-000017; ; 10-Q', 'creator': 'EDGAR Filing HTML Converter', 'producer': 'EDGRpdf Service w/ EO.Pdf 22.0.40.0', 'creationDate': \"D:20240508161757-04'00'\", 'modDate': \"D:20240508161807-04'00'\", 'trapped': '', 'encryption': 'Standard V2 R3 128-bit RC4', '_id': 'cd3a5f5a79b8454e8185ade4b614e309', '_collection_name': 'air bnb data'}),\n",
287
  " 0.47142537803546586),\n",
288
+ " (Document(page_content='Table of Contents\\nAirbnb, Inc.\\nCondensed Consolidated Statements of Operations\\n(in millions, except per share amounts)\\n(unaudited)\\nThree Months Ended\\nMarch 31,\\n2023\\n2024\\nRevenue\\n$\\n1,818\\xa0 $\\n2,142\\xa0\\nCosts and expenses:\\nCost of revenue\\n428\\xa0\\n480\\xa0\\nOperations and support\\n282\\xa0\\n285\\xa0\\nProduct development\\n420\\xa0\\n475\\xa0\\nSales and marketing\\n450\\xa0\\n514\\xa0\\nGeneral and administrative\\n243\\xa0\\n287\\xa0\\nTotal costs and expenses\\n1,823\\xa0\\n2,041\\xa0\\nIncome (loss) from operations\\n(5)\\n101\\xa0\\nInterest income\\n146\\xa0\\n202\\xa0\\nOther expense, net\\n(11)\\n(10)\\nIncome before income taxes\\n130\\xa0\\n293\\xa0\\nProvision for income taxes\\n13\\xa0\\n29\\xa0\\nNet income\\n$\\n117\\xa0 $\\n264\\xa0\\nNet income per share attributable to Class\\xa0A and Class\\xa0B common stockholders:\\nBasic\\n$\\n0.18\\xa0 $\\n0.41\\xa0\\nDiluted\\n$\\n0.18\\xa0 $\\n0.41\\xa0\\nWeighted-average shares used in computing net income per share attributable to Class\\xa0A and Class\\xa0B common stockholders:\\nBasic\\n634\\xa0\\n638\\xa0\\nDiluted\\n670\\xa0\\n654\\xa0\\nThe accompanying notes are an integral part of these condensed consolidated financial statements.\\n4', metadata={'source': 'data/airbnb_midterm.pdf', 'file_path': 'data/airbnb_midterm.pdf', 'page': 5, 'total_pages': 54, 'format': 'PDF 1.4', 'title': '0001559720-24-000017', 'author': 'EDGAR® Online LLC, a subsidiary of OTC Markets Group', 'subject': 'Form 10-Q filed on 2024-05-08 for the period ending 2024-03-31', 'keywords': '0001559720-24-000017; ; 10-Q', 'creator': 'EDGAR Filing HTML Converter', 'producer': 'EDGRpdf Service w/ EO.Pdf 22.0.40.0', 'creationDate': \"D:20240508161757-04'00'\", 'modDate': \"D:20240508161807-04'00'\", 'trapped': '', 'encryption': 'Standard V2 R3 128-bit RC4', '_id': '6f4f6bd908d14bf59b9f9f69592453b4', '_collection_name': 'air bnb data'}),\n",
289
  " 0.4527725805360773),\n",
290
+ " (Document(page_content='Table of Contents\\nAirbnb, Inc.\\nNotes to Condensed Consolidated Financial Statements (unaudited)\\nStock Option and Restricted Stock Unit Activity\\nA summary of stock option and restricted stock unit (“RSU”) activity under the Company’s equity incentive plans was as follows (in millions, except per share amounts):\\nOutstanding\\nStock Options\\nOutstanding\\nRSUs\\n\\xa0\\nShares\\nAvailable\\xa0for\\nGrant\\nNumber\\xa0of\\nShares\\nWeighted-\\nAverage\\nExercise\\nPrice\\nNumber\\xa0of\\nShares\\nWeighted-\\nAverage\\nGrant\\nDate Fair\\nValue\\nAs of December 31, 2023\\n134\\xa0\\n7\\xa0 $\\n71.76\\xa0\\n30\\xa0 $\\n85.35\\xa0\\nGranted\\n(7)\\n—\\xa0\\n—\\xa0\\n7\\xa0\\n166.17\\xa0\\nIncrease in shares available for grant\\n13\\xa0\\n—\\xa0\\n—\\xa0\\n—\\xa0\\n—\\xa0\\nOptions exercised/RSUs vested\\n1\\xa0\\n(1)\\n42.12\\xa0\\n(2)\\n109.14\\xa0\\nAs of March 31, 2024\\n141\\xa0\\n6\\xa0 $\\n80.12\\xa0\\n35\\xa0 $\\n100.12\\xa0\\n(1)\\nRSUs vested are net of shares withheld for taxes.\\nNumber of\\nShares\\nWeighted-\\nAverage\\nExercise\\nPrice\\nWeighted-\\nAverage\\nRemaining\\nContractual\\nLife (Years)\\nAggregate\\nIntrinsic\\nValue\\nOptions outstanding as of March 31, 2024\\n6\\xa0 $\\n80.12\\xa0\\n5.87 $\\n541\\xa0\\nOptions exercisable as of March 31, 2024\\n5\\xa0 $\\n66.85\\xa0\\n5.12 $\\n484\\xa0\\nNote 9. Commitments and Contingencies\\nCommitments\\nThe Company has commitments including purchase obligations for web-hosting services and other commitments for brand marketing. As of March\\xa031, 2024, there were no material\\nchanges outside the ordinary course of business to the Company’s commitments, as disclosed in its Annual Report on Form 10-K for the year ended December\\xa031, 2023.\\nLodging Tax Obligations and Other Non-Income Tax Matters\\nPlatform Related Taxes and Collection Obligations\\nSome states and localities in the United States and elsewhere in the world impose transient occupancy or lodging accommodations taxes (“Lodging Taxes”) on the use or occupancy', metadata={'source': 'data/airbnb_midterm.pdf', 'file_path': 'data/airbnb_midterm.pdf', 'page': 16, 'total_pages': 54, 'format': 'PDF 1.4', 'title': '0001559720-24-000017', 'author': 'EDGAR® Online LLC, a subsidiary of OTC Markets Group', 'subject': 'Form 10-Q filed on 2024-05-08 for the period ending 2024-03-31', 'keywords': '0001559720-24-000017; ; 10-Q', 'creator': 'EDGAR Filing HTML Converter', 'producer': 'EDGRpdf Service w/ EO.Pdf 22.0.40.0', 'creationDate': \"D:20240508161757-04'00'\", 'modDate': \"D:20240508161807-04'00'\", 'trapped': '', 'encryption': 'Standard V2 R3 128-bit RC4', '_id': '144217b2ce0a4380a6eb7081cdff49b0', '_collection_name': 'air bnb data'}),\n",
291
  " 0.45249992651669707)]}"
292
  ]
293
  },
294
+ "execution_count": 18,
295
  "metadata": {},
296
  "output_type": "execute_result"
297
  }
app.py CHANGED
@@ -34,7 +34,7 @@ Also add CONTEXT vs PRIOR tag: break answer to what you find in provided context
34
 
35
  data_path = "data/airbnb_midterm.pdf"
36
  docs = PyPDFLoader(data_path).load()
37
- openai_chat_model = ChatOpenAI(model="gpt-4o") #gpt-4o
38
 
39
  def tiktoken_len(text):
40
  tokens = tiktoken.encoding_for_model("gpt-4o").encode(
@@ -85,10 +85,10 @@ retrieval_augmented_qa_chain = (
85
  )
86
 
87
 
88
- @cl.author_rename
89
- def rename(orig_author: str):
90
  rename_dict = {"User": "You", "Chatbot": "Airbnb"}
91
- return rename_dict.get(orig_author, orig_author)
92
 
93
 
94
 
@@ -131,4 +131,16 @@ async def main(message: cl.Message):
131
 
132
  msg = cl.Message(content=resp_msg, elements=text_elements)
133
 
 
134
  await msg.send()
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  data_path = "data/airbnb_midterm.pdf"
36
  docs = PyPDFLoader(data_path).load()
37
+ openai_chat_model = ChatOpenAI(model="gpt-4o", streaming=True) #gpt-4o
38
 
39
  def tiktoken_len(text):
40
  tokens = tiktoken.encoding_for_model("gpt-4o").encode(
 
85
  )
86
 
87
 
88
+ """@cl.author_rename
89
+ async def rename(orig_author: str):
90
  rename_dict = {"User": "You", "Chatbot": "Airbnb"}
91
+ return rename_dict.get(orig_author, orig_author)"""
92
 
93
 
94
 
 
131
 
132
  msg = cl.Message(content=resp_msg, elements=text_elements)
133
 
134
+ print(msg.content)
135
  await msg.send()
136
+
137
+
138
+ """async for chunk in msg.content:
139
+
140
+ if token := chunk.choices[0].delta.content or "":
141
+ await msg.stream_token(token)
142
+
143
+ await msg.update()"""
144
+
145
+ #async for chunk in chain:
146
+ # if token:=