├── .gitignore ├── 10-distillation ├── itinerary.ipynb └── plane.ipynb ├── 11-recommendation ├── README.md ├── app.py ├── config.py ├── docker-compose.yaml ├── helper_functions.py ├── images.zip ├── pages │ ├── page_1_semantic_search.py │ └── page_2_explainable_recommendations.py ├── requirements.txt ├── upload-data │ └── fake_hardware_data.csv └── upload-to-qdrant.py ├── 12-agentic-tool-calling ├── 0_task.py ├── 1_agent.py ├── 2_tools.py ├── 3_simple_server.py ├── 4_queue_server.py ├── 5_todos.py ├── 6_delegation.py ├── mock_api.py ├── server.py ├── server_agents.py └── utils.py ├── 13-image-gen └── imagegen-demo │ ├── .gitignore │ ├── README.md │ ├── components.json │ ├── eslint.config.mjs │ ├── next.config.ts │ ├── package-lock.json │ ├── package.json │ ├── postcss.config.mjs │ ├── public │ ├── OpenAI-black-monoblossom.svg │ ├── OpenAI-black-wordmark.svg │ ├── OpenAI_Frontiers-2025.svg │ ├── file.svg │ ├── frontiers-2025.svg │ ├── globe.svg │ ├── next.svg │ ├── vercel.svg │ └── window.svg │ ├── src │ ├── app │ │ ├── api │ │ │ ├── edit │ │ │ │ └── route.ts │ │ │ ├── generate │ │ │ │ └── route.ts │ │ │ ├── process │ │ │ │ └── route.ts │ │ │ └── stream │ │ │ │ └── route.ts │ │ ├── favicon.ico │ │ ├── globals.css │ │ ├── layout.tsx │ │ └── page.tsx │ ├── components │ │ ├── error-message.tsx │ │ ├── image-remix-tool.tsx │ │ ├── image-uploader.tsx │ │ ├── loading-overlay.tsx │ │ ├── modifier-grid.tsx │ │ ├── option-card.tsx │ │ └── result-gallery.tsx │ └── lib │ │ ├── imageProcessing.ts │ │ └── utils.ts │ ├── tailwind.config.js │ └── tsconfig.json ├── 2-assistants ├── 0_setup.py ├── 1_routines.py ├── 2_tools.py ├── 3_tools.py ├── 4_tools.py ├── 5_escalation.py ├── 6_agents.py ├── 7_orchestration.py ├── README.md └── demo_util.py ├── 3-4o_mini_fine_tuning ├── 0_generate_eval_data.py ├── 1_eval_baseline.py ├── 2_fine_tuning.py ├── 3_eval_fine_tune.py ├── README.md ├── prompts │ ├── cot3.json │ └── verbatim_input.txt └── py │ └── assert_last_line_answer.py ├── 4-mmrag_tooluse ├── config.py ├── database.py ├── docker-compose.yaml ├── earnings.db ├── earnings_report_all │ ├── Webslides_Q120_4.28.20_Final.pdf │ ├── Webslides_Q121_Final.pdf │ ├── Webslides_Q122_Final.pdf │ ├── Webslides_Q123_Final.pdf │ ├── Webslides_Q124_Final.pdf │ ├── Webslides_Q220_Final.pdf │ ├── Webslides_Q221_Final.pdf │ ├── Webslides_Q222_Final.pdf │ ├── Webslides_Q223_Final.pdf │ ├── Webslides_Q224_Final.pdf │ ├── Webslides_Q320_Final.pdf │ ├── Webslides_Q321_Final.pdf │ ├── Webslides_Q322_Final.pdf │ ├── Webslides_Q420_Final.pdf │ ├── Webslides_Q421_Final.pdf │ ├── Webslides_Q422_Final.pdf │ └── Webslides_Q423_Final.pdf ├── earnings_reports_sample │ └── Webslides_Q323.pdf ├── ingest.py ├── mmrag_bh.py ├── schema_definitions.py └── table_json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q120.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q121.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q122.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q123.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q124.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q220.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q221.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q222.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q223.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q224.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q320.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q321.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q322.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q323.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q420.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q421.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q422.json │ ├── Free_Cash_Flow_Less_Equipment_Finance_Leases_Q423.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q120.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q121.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q122.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q123.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q124.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q220.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q221.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q222.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q223.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q224.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q320.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q321.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q322.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q323.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q420.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q421.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q422.json │ ├── Free_Cash_Flow_Less_Principal_Repayments_Q423.json │ ├── Free_Cash_Flow_Reconciliation_Q120.json │ ├── Free_Cash_Flow_Reconciliation_Q121.json │ ├── Free_Cash_Flow_Reconciliation_Q122.json │ ├── Free_Cash_Flow_Reconciliation_Q123.json │ ├── Free_Cash_Flow_Reconciliation_Q124.json │ ├── Free_Cash_Flow_Reconciliation_Q220.json │ ├── Free_Cash_Flow_Reconciliation_Q221.json │ ├── Free_Cash_Flow_Reconciliation_Q222.json │ ├── Free_Cash_Flow_Reconciliation_Q223.json │ ├── Free_Cash_Flow_Reconciliation_Q224.json │ ├── Free_Cash_Flow_Reconciliation_Q320.json │ ├── Free_Cash_Flow_Reconciliation_Q321.json │ ├── Free_Cash_Flow_Reconciliation_Q322.json │ ├── Free_Cash_Flow_Reconciliation_Q323.json │ ├── Free_Cash_Flow_Reconciliation_Q420.json │ ├── Free_Cash_Flow_Reconciliation_Q421.json │ ├── Free_Cash_Flow_Reconciliation_Q422.json │ └── Free_Cash_Flow_Reconciliation_Q423.json ├── 5-4o_fine_tuning ├── .gitignore ├── README.md ├── data_explorer.py ├── data_validator.py ├── eval.py ├── example.py ├── example_cot.py ├── logs │ ├── ft_gpt-3*5-turbo-0125_openai-gtm_vulnfixes0821_9ym18NbR-0-shot_20240823_0037.log │ ├── ft_gpt-4o-2024-08-06_openai-gtm_vulnfixes-cot-0822_9zGknzVV-0-shot_20240822_2220.log │ ├── ft_gpt-4o-2024-08-06_openai-gtm_vulnfixes-cot-0822_9zGknzVV-5-shot-sim_20240823_0000.log │ ├── ft_gpt-4o-2024-08-06_openai-gtm_vulnfixes0821-long_9ymKVX9n-0-shot_20240825_2220.log │ ├── ft_gpt-4o-mini-2024-07-18_openai-gtm_vulnfixes0822_9zILpnPW-0-shot_20240823_0027.log │ ├── gpt-4o-0-shot_20240823_0018.log │ ├── gpt-4o-5-shot_20240822_2310.log │ └── gpt-4o-mini-0-shot_20240822_2322.log ├── reasoning.py ├── requirements.txt ├── static-vuln-fixes-eval.jsonl ├── synth-vuln-fixes-train-coft-commments-0822.jsonl ├── synth-vuln-fixes-train.jsonl └── util.py ├── 6-structured_outputs ├── node-example │ ├── app.js │ ├── input.js │ ├── package-lock.json │ └── package.json ├── python-example │ ├── data │ │ ├── __init__.py │ │ └── input.py │ ├── main.py │ └── requirements.txt ├── structured-outputs-assistant-final │ ├── .eslintrc.json │ ├── .gitignore │ ├── README.md │ ├── app │ │ ├── api │ │ │ ├── assistant │ │ │ │ ├── get_products │ │ │ │ │ └── route.ts │ │ │ │ ├── search_products │ │ │ │ │ └── route.ts │ │ │ │ └── turn_response │ │ │ │ │ └── route.ts │ │ │ └── db │ │ │ │ ├── init │ │ │ │ └── route.ts │ │ │ │ └── route.ts │ │ ├── favicon.ico │ │ ├── globals.css │ │ ├── layout.tsx │ │ └── page.tsx │ ├── components.json │ ├── components │ │ ├── assistant.tsx │ │ ├── cart.tsx │ │ ├── chat.tsx │ │ ├── main-view.tsx │ │ ├── message.css │ │ ├── message.tsx │ │ ├── tool-results.tsx │ │ └── ui │ │ │ ├── badge.tsx │ │ │ ├── breadcrumb.tsx │ │ │ ├── button.tsx │ │ │ ├── card.tsx │ │ │ ├── chart.tsx │ │ │ ├── checkbox.tsx │ │ │ ├── drawer.tsx │ │ │ ├── dropdown-menu.tsx │ │ │ ├── input.tsx │ │ │ ├── label.tsx │ │ │ ├── select.tsx │ │ │ ├── sheet.tsx │ │ │ ├── spinner.css │ │ │ ├── spinner.tsx │ │ │ ├── table.tsx │ │ │ ├── textarea.tsx │ │ │ ├── toggle-group.tsx │ │ │ └── toggle.tsx │ ├── data │ │ ├── amazon_furniture_db.json │ │ └── database.sqlite │ ├── lib │ │ ├── assistant.ts │ │ ├── components-mapping.tsx │ │ ├── database.ts │ │ ├── tools.ts │ │ └── utils.ts │ ├── next.config.mjs │ ├── package-lock.json │ ├── package.json │ ├── pnpm-lock.yaml │ ├── postcss.config.mjs │ ├── prettier.config.cjs │ ├── public │ │ └── imgs │ │ │ └── user_profile.png │ ├── tailwind.config.ts │ └── tsconfig.json ├── structured-outputs-assistant-starting-point │ ├── .eslintrc.json │ ├── .gitignore │ ├── README.md │ ├── app │ │ ├── api │ │ │ ├── assistant │ │ │ │ ├── get_products │ │ │ │ │ └── route.ts │ │ │ │ ├── search_products │ │ │ │ │ └── route.ts │ │ │ │ └── turn_response │ │ │ │ │ └── route.ts │ │ │ └── db │ │ │ │ ├── init │ │ │ │ └── route.ts │ │ │ │ └── route.ts │ │ ├── favicon.ico │ │ ├── globals.css │ │ ├── layout.tsx │ │ └── page.tsx │ ├── components.json │ ├── components │ │ ├── assistant.tsx │ │ ├── cart.tsx │ │ ├── chat.tsx │ │ ├── main-view.tsx │ │ ├── message.css │ │ ├── message.tsx │ │ ├── tool-results.tsx │ │ └── ui │ │ │ ├── badge.tsx │ │ │ ├── breadcrumb.tsx │ │ │ ├── button.tsx │ │ │ ├── card.tsx │ │ │ ├── chart.tsx │ │ │ ├── checkbox.tsx │ │ │ ├── drawer.tsx │ │ │ ├── dropdown-menu.tsx │ │ │ ├── input.tsx │ │ │ ├── label.tsx │ │ │ ├── select.tsx │ │ │ ├── sheet.tsx │ │ │ ├── spinner.css │ │ │ ├── spinner.tsx │ │ │ ├── table.tsx │ │ │ ├── textarea.tsx │ │ │ ├── toggle-group.tsx │ │ │ └── toggle.tsx │ ├── data │ │ ├── amazon_furniture_db.json │ │ └── database.sqlite │ ├── lib │ │ ├── assistant.ts │ │ ├── components-mapping.tsx │ │ ├── database.ts │ │ ├── tools.ts │ │ └── utils.ts │ ├── next.config.mjs │ ├── package-lock.json │ ├── package.json │ ├── pnpm-lock.yaml │ ├── postcss.config.mjs │ ├── prettier.config.cjs │ ├── public │ │ └── imgs │ │ │ └── user_profile.png │ ├── tailwind.config.ts │ └── tsconfig.json ├── structured-outputs-math-tutor-final │ ├── .eslintrc.json │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── app │ │ ├── api │ │ │ └── math_responses │ │ │ │ └── route.ts │ │ ├── globals.css │ │ ├── layout.tsx │ │ └── page.tsx │ ├── components.json │ ├── components │ │ ├── problem-card.tsx │ │ ├── prompt-form.tsx │ │ ├── sidebar.tsx │ │ ├── solution.tsx │ │ ├── step.tsx │ │ ├── stepper.tsx │ │ └── ui │ │ │ ├── badge.tsx │ │ │ ├── confetti.tsx │ │ │ ├── icons.tsx │ │ │ ├── spinner.css │ │ │ ├── spinner.tsx │ │ │ └── warning.tsx │ ├── lib │ │ ├── actions.ts │ │ └── useSolution.ts │ ├── next-env.d.ts │ ├── next.config.js │ ├── package.json │ ├── pnpm-lock.yaml │ ├── postcss.config.js │ ├── prettier.config.cjs │ ├── public │ │ ├── apple-touch-icon.png │ │ ├── avatar.png │ │ ├── favicon-16x16.png │ │ ├── favicon.ico │ │ └── screenshot.png │ ├── tailwind.config.ts │ └── tsconfig.json └── structured-outputs-math-tutor-starting-point │ ├── .eslintrc.json │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── app │ ├── api │ │ └── math_responses │ │ │ └── route.ts │ ├── globals.css │ ├── layout.tsx │ └── page.tsx │ ├── components.json │ ├── components │ ├── problem-card.tsx │ ├── prompt-form.tsx │ ├── sidebar.tsx │ ├── solution.tsx │ ├── step.tsx │ ├── stepper.tsx │ └── ui │ │ ├── badge.tsx │ │ ├── confetti.tsx │ │ ├── icons.tsx │ │ ├── spinner.css │ │ ├── spinner.tsx │ │ └── warning.tsx │ ├── lib │ ├── actions.ts │ └── useSolution.ts │ ├── next-env.d.ts │ ├── next.config.js │ ├── package.json │ ├── pnpm-lock.yaml │ ├── postcss.config.js │ ├── prettier.config.cjs │ ├── public │ ├── apple-touch-icon.png │ ├── avatar.png │ ├── favicon-16x16.png │ ├── favicon.ico │ └── screenshot.png │ ├── tailwind.config.ts │ └── tsconfig.json ├── 7-reasoning ├── flightCancellationPolicy │ ├── evals │ │ └── functionCallingEval.csv │ ├── evalsAndPromptImprovements.ipynb │ ├── functionDefinitions.py │ └── originalPolicy │ │ └── flightCancellationsPolicy.md └── shipmentPlanning │ ├── ReadMe.md │ ├── backend │ ├── app.py │ ├── functionDefinitions.py │ └── requirements.txt │ └── frontend │ ├── .gitignore │ ├── README.md │ ├── package.json │ ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt │ └── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── ExecutionStream.js │ ├── PlanDisplay.js │ ├── ScenarioInput.js │ ├── assets │ └── logos │ │ └── shippingLogo.jpg │ ├── index.css │ ├── index.js │ ├── logo.svg │ ├── reportWebVitals.js │ ├── setupTests.js │ └── theme.js ├── 8-evals ├── 01_create_stanbot_draft_datasett.py ├── 02_stanbot_eval.py ├── 03_create_summary_grader_dataset.py ├── 04_summary_grader_eval.py ├── data │ ├── draft_stanbot_outputs_n=18.csv │ ├── draft_summary_grader_outputs_n=12.csv │ ├── pfoo_eval_stanbot.yaml │ ├── pfoo_eval_summary_grader.yaml │ ├── reviewed_stanbot_outputs_n=18.csv │ └── reviewed_summary_grader_outputs_n=12.csv └── utils │ └── constants.py ├── 9-realtime ├── .gitignore ├── README.md ├── openai-realtime-console-example │ ├── .eslintrc.json │ ├── .gitignore │ ├── .prettierrc │ ├── LICENSE │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── public │ │ ├── index.html │ │ ├── openai-logomark.svg │ │ └── robots.txt │ ├── readme │ │ └── realtime-console-demo.png │ ├── relay-server │ │ ├── index.js │ │ └── lib │ │ │ └── relay.js │ ├── src │ │ ├── App.scss │ │ ├── App.tsx │ │ ├── components │ │ │ ├── Map.scss │ │ │ ├── Map.tsx │ │ │ ├── button │ │ │ │ ├── Button.scss │ │ │ │ └── Button.tsx │ │ │ └── toggle │ │ │ │ ├── Toggle.scss │ │ │ │ └── Toggle.tsx │ │ ├── index.css │ │ ├── index.tsx │ │ ├── lib │ │ │ └── wavtools │ │ │ │ ├── dist │ │ │ │ ├── index.d.ts │ │ │ │ ├── index.d.ts.map │ │ │ │ └── lib │ │ │ │ │ ├── analysis │ │ │ │ │ ├── audio_analysis.d.ts │ │ │ │ │ ├── audio_analysis.d.ts.map │ │ │ │ │ ├── constants.d.ts │ │ │ │ │ └── constants.d.ts.map │ │ │ │ │ ├── wav_packer.d.ts │ │ │ │ │ ├── wav_packer.d.ts.map │ │ │ │ │ ├── wav_recorder.d.ts │ │ │ │ │ ├── wav_recorder.d.ts.map │ │ │ │ │ ├── wav_stream_player.d.ts │ │ │ │ │ ├── wav_stream_player.d.ts.map │ │ │ │ │ └── worklets │ │ │ │ │ ├── audio_processor.d.ts │ │ │ │ │ ├── audio_processor.d.ts.map │ │ │ │ │ ├── stream_processor.d.ts │ │ │ │ │ └── stream_processor.d.ts.map │ │ │ │ ├── index.js │ │ │ │ └── lib │ │ │ │ ├── analysis │ │ │ │ ├── audio_analysis.js │ │ │ │ └── constants.js │ │ │ │ ├── wav_packer.js │ │ │ │ ├── wav_recorder.js │ │ │ │ ├── wav_stream_player.js │ │ │ │ └── worklets │ │ │ │ ├── audio_processor.js │ │ │ │ └── stream_processor.js │ │ ├── logo.svg │ │ ├── pages │ │ │ ├── ConsolePage.scss │ │ │ └── ConsolePage.tsx │ │ ├── react-app-env.d.ts │ │ ├── reportWebVitals.ts │ │ ├── setupTests.ts │ │ └── utils │ │ │ ├── conversation_config.js │ │ │ └── wav_renderer.ts │ └── tsconfig.json └── realtime-from-scratch │ ├── .gitignore │ ├── README.md │ ├── app │ ├── favicon.ico │ ├── fonts │ │ ├── GeistMonoVF.woff │ │ └── GeistVF.woff │ ├── globals.css │ ├── hooks │ │ ├── useAudioPlayer.ts │ │ └── useMicrophone.ts │ ├── layout.tsx │ └── page.tsx │ ├── next.config.ts │ ├── package-lock.json │ ├── package.json │ ├── postcss.config.mjs │ ├── public │ ├── file.svg │ ├── globe.svg │ ├── next.svg │ ├── vercel.svg │ └── window.svg │ ├── tailwind.config.ts │ └── tsconfig.json ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | __pycache__/ 3 | .DS_Store 4 | __pycache__/ 5 | 6 | 3-4o_mini_fine_tuning/evals/* 7 | 3-4o_mini_fine_tuning/data/* 8 | 9 | 11-recommendation/images 10 | 11 | .venv/ 12 | -------------------------------------------------------------------------------- /11-recommendation/app.py: -------------------------------------------------------------------------------- 1 | # app.py 2 | import streamlit as st 3 | 4 | 5 | # Set the page configuration 6 | st.set_page_config( 7 | page_title="Recommendations with LLMs", 8 | page_icon=":rocket:", # You can use any emoji or a local image file 9 | layout="wide", # "centered" or "wide" 10 | initial_sidebar_state="expanded" # "auto", "expanded", "collapsed" 11 | ) 12 | 13 | # Main content of the home page 14 | st.title("Welcome to the Recommendation System App") 15 | st.write(""" 16 | This application leverages GPT-4o to provide personalized recommendations based on your past purchases and queries. 17 | Use the sidebar to navigate to different functionalities. 18 | """) 19 | -------------------------------------------------------------------------------- /11-recommendation/config.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | class Config: 4 | OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") 5 | QDRANT_HOST = 'localhost' 6 | QDRANT_PORT = 6333 7 | CSV_FILE_PATH = "upload-data/fake_hardware_data.csv" 8 | COLLECTION_NAME = "fake_hardware_data" 9 | EMBEDDING_MODEL = "text-embedding-3-small" 10 | VECTOR_SIZE = 1536 11 | MAX_WORKERS = 100 12 | BATCH_SIZE = 100 13 | -------------------------------------------------------------------------------- /11-recommendation/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | services: 3 | qdrant: 4 | image: qdrant/qdrant:v1.3.0 5 | restart: on-failure 6 | ports: 7 | - "6333:6333" 8 | volumes: 9 | - qdrant_storage:/qdrant/storage 10 | 11 | volumes: 12 | qdrant_storage: -------------------------------------------------------------------------------- /11-recommendation/images.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/11-recommendation/images.zip -------------------------------------------------------------------------------- /11-recommendation/requirements.txt: -------------------------------------------------------------------------------- 1 | altair==5.5.0 2 | annotated-types==0.7.0 3 | anyio==4.6.2.post1 4 | attrs==24.2.0 5 | blinker==1.9.0 6 | cachetools==5.5.0 7 | certifi==2024.8.30 8 | charset-normalizer==3.4.0 9 | click==8.1.7 10 | distro==1.9.0 11 | gitdb==4.0.11 12 | GitPython==3.1.43 13 | grpcio==1.68.0 14 | grpcio-tools==1.68.0 15 | h11==0.14.0 16 | h2==4.1.0 17 | hpack==4.0.0 18 | httpcore==1.0.7 19 | httpx==0.27.2 20 | hyperframe==6.0.1 21 | idna==3.10 22 | Jinja2==3.1.4 23 | jiter==0.7.1 24 | jsonschema==4.23.0 25 | jsonschema-specifications==2024.10.1 26 | markdown-it-py==3.0.0 27 | MarkupSafe==3.0.2 28 | mdurl==0.1.2 29 | narwhals==1.14.2 30 | numpy==2.1.3 31 | openai==1.55.0 32 | packaging==24.2 33 | pandas==2.2.3 34 | pillow==11.0.0 35 | portalocker==2.10.1 36 | protobuf==5.28.3 37 | pyarrow==18.0.0 38 | pydantic==2.10.1 39 | pydantic_core==2.27.1 40 | pydeck==0.9.1 41 | Pygments==2.18.0 42 | python-dateutil==2.9.0.post0 43 | pytz==2024.2 44 | qdrant-client==1.12.1 45 | referencing==0.35.1 46 | requests==2.32.3 47 | rich==13.9.4 48 | rpds-py==0.21.0 49 | six==1.16.0 50 | smmap==5.0.1 51 | sniffio==1.3.1 52 | streamlit==1.40.1 53 | tenacity==9.0.0 54 | toml==0.10.2 55 | tornado==6.4.2 56 | tqdm==4.67.1 57 | typing_extensions==4.12.2 58 | tzdata==2024.2 59 | urllib3==2.2.3 -------------------------------------------------------------------------------- /12-agentic-tool-calling/0_task.py: -------------------------------------------------------------------------------- 1 | from openai import OpenAI 2 | 3 | client = OpenAI() 4 | 5 | response = client.responses.create( 6 | input="Hello, world!", 7 | model="o3", 8 | background=True, 9 | ) 10 | 11 | print(response) 12 | -------------------------------------------------------------------------------- /12-agentic-tool-calling/1_agent.py: -------------------------------------------------------------------------------- 1 | from agents import Agent, function_tool 2 | from utils import run_demo_loop 3 | 4 | 5 | agent = Agent( 6 | name="Assistant", 7 | model="o3", 8 | ) 9 | 10 | run_demo_loop(agent) 11 | -------------------------------------------------------------------------------- /12-agentic-tool-calling/2_tools.py: -------------------------------------------------------------------------------- 1 | from agents import Agent, function_tool as tool 2 | from utils import run_demo_loop 3 | from mock_api import MockAPI 4 | from typing import Optional 5 | 6 | mock_api = MockAPI() 7 | 8 | 9 | @tool 10 | def search_policies(query: str): 11 | return mock_api.search_policies(query) 12 | 13 | 14 | @tool 15 | def get_emails(to: Optional[str] = None): 16 | return mock_api.get_emails(to) 17 | 18 | 19 | @tool 20 | def send_email(from_addr: str, to_addr: str, subject: str, body: str): 21 | return mock_api.send_email(from_addr, to_addr, subject, body) 22 | 23 | 24 | agent = Agent( 25 | name="Assistant", 26 | model="o3", 27 | tools=[search_policies, get_emails, send_email], 28 | ) 29 | 30 | run_demo_loop(agent) 31 | -------------------------------------------------------------------------------- /12-agentic-tool-calling/3_simple_server.py: -------------------------------------------------------------------------------- 1 | from fastapi import FastAPI, Request 2 | from fastapi.responses import StreamingResponse 3 | from utils import encode_sse, to_dict 4 | from agents import Runner 5 | import uvicorn 6 | from server_agents import agent 7 | 8 | app = FastAPI() 9 | 10 | 11 | @app.post("/") 12 | async def endpoint(request: Request): 13 | body = await request.json() 14 | 15 | async def event_stream(): 16 | run = Runner.run_streamed( 17 | agent, 18 | input=body.get("items", []), 19 | previous_response_id=body.get("previousResponseId"), 20 | ) 21 | async for ev in run.stream_events(): 22 | if ev.type == "raw_response_event": 23 | yield encode_sse(ev.type, to_dict(ev.data)) 24 | yield encode_sse("done", {}) 25 | 26 | return StreamingResponse(event_stream(), media_type="text/event-stream") 27 | 28 | 29 | if __name__ == "__main__": 30 | uvicorn.run("app:app", host="0.0.0.0", port=8000, reload=True) 31 | -------------------------------------------------------------------------------- /12-agentic-tool-calling/6_delegation.py: -------------------------------------------------------------------------------- 1 | from agents import Agent, function_tool 2 | from utils import run_demo_loop 3 | from openai import OpenAI 4 | 5 | 6 | client = OpenAI() 7 | 8 | 9 | @function_tool 10 | def search_web(query: str): 11 | return "This is a test" 12 | 13 | 14 | @function_tool 15 | def start_task(description: str): 16 | response = client.responses.create( 17 | input=description, 18 | model="o3", 19 | background=True, 20 | ) 21 | return response.id 22 | 23 | 24 | @function_tool 25 | def get_tasks(id: str): 26 | response = client.responses.retrieve(response_id=id) 27 | return response.output 28 | 29 | 30 | agent = Agent( 31 | name="Assistant", 32 | model="gpt-4.1-mini", 33 | tools=[search_web], 34 | ) 35 | 36 | run_demo_loop(agent) 37 | -------------------------------------------------------------------------------- /12-agentic-tool-calling/server.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/12-agentic-tool-calling/server.py -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.* 7 | .yarn/* 8 | !.yarn/patches 9 | !.yarn/plugins 10 | !.yarn/releases 11 | !.yarn/versions 12 | 13 | # testing 14 | /coverage 15 | 16 | # next.js 17 | /.next/ 18 | /out/ 19 | 20 | # production 21 | /build 22 | 23 | # misc 24 | .DS_Store 25 | *.pem 26 | 27 | # debug 28 | npm-debug.log* 29 | yarn-debug.log* 30 | yarn-error.log* 31 | .pnpm-debug.log* 32 | 33 | # env files (can opt-in for committing if needed) 34 | .env* 35 | 36 | # vercel 37 | .vercel 38 | 39 | # typescript 40 | *.tsbuildinfo 41 | next-env.d.ts 42 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.js", 8 | "css": "src/app/globals.css", 9 | "baseColor": "neutral", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils", 16 | "ui": "@/components/ui", 17 | "lib": "@/lib", 18 | "hooks": "@/hooks" 19 | }, 20 | "iconLibrary": "lucide" 21 | } -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import { dirname } from "path"; 2 | import { fileURLToPath } from "url"; 3 | import { FlatCompat } from "@eslint/eslintrc"; 4 | 5 | const __filename = fileURLToPath(import.meta.url); 6 | const __dirname = dirname(__filename); 7 | 8 | const compat = new FlatCompat({ 9 | baseDirectory: __dirname, 10 | }); 11 | 12 | const eslintConfig = [ 13 | ...compat.extends("next/core-web-vitals", "next/typescript"), 14 | ]; 15 | 16 | export default eslintConfig; 17 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/next.config.ts: -------------------------------------------------------------------------------- 1 | import type { NextConfig } from "next"; 2 | 3 | const nextConfig: NextConfig = { 4 | /* config options here */ 5 | }; 6 | 7 | export default nextConfig; 8 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "frontiers", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev --turbopack", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "@ai-sdk/openai": "^1.3.20", 13 | "ai": "^4.3.10", 14 | "class-variance-authority": "^0.7.1", 15 | "clsx": "^2.1.1", 16 | "lucide-react": "^0.503.0", 17 | "next": "15.3.1", 18 | "openai": "^4.96.0", 19 | "react": "^19.0.0", 20 | "react-dom": "^19.0.0", 21 | "react-dropzone": "^14.3.8", 22 | "sharp": "^0.32.0", 23 | "tailwind-merge": "^3.2.0", 24 | "zod": "^3.24.3" 25 | }, 26 | "devDependencies": { 27 | "@eslint/eslintrc": "^3", 28 | "@tailwindcss/postcss": "^4", 29 | "@types/node": "^20", 30 | "@types/react": "^19", 31 | "@types/react-dom": "^19", 32 | "autoprefixer": "^10.4.21", 33 | "eslint": "^9", 34 | "eslint-config-next": "15.3.1", 35 | "postcss": "^8.5.3", 36 | "tailwindcss": "^4.1.4", 37 | "tw-animate-css": "^1.2.8", 38 | "typescript": "^5" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | const config = { 2 | plugins: ["@tailwindcss/postcss"], 3 | }; 4 | 5 | export default config; 6 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/public/OpenAI_Frontiers-2025.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | OpenAI Image Gen Build Hour 4 | 5 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/public/file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/public/globe.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/public/next.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/public/window.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/13-image-gen/imagegen-demo/src/app/favicon.ico -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/src/app/globals.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | 3 | 4 | :root { 5 | --background: #ffffff; 6 | --foreground: #171717; 7 | } 8 | 9 | @theme inline { 10 | --color-background: var(--background); 11 | --color-foreground: var(--foreground); 12 | --font-sans: var(--font-geist-sans); 13 | --font-mono: var(--font-geist-mono); 14 | } 15 | 16 | @media (prefers-color-scheme: dark) { 17 | :root { 18 | --background: #0a0a0a; 19 | --foreground: #ededed; 20 | } 21 | } 22 | 23 | body { 24 | background: var(--background); 25 | color: var(--foreground); 26 | font-family: Arial, Helvetica, sans-serif; 27 | } 28 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/src/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from "next"; 2 | import { Geist, Geist_Mono } from "next/font/google"; 3 | import "./globals.css"; 4 | 5 | const geistSans = Geist({ 6 | variable: "--font-geist-sans", 7 | subsets: ["latin"], 8 | }); 9 | 10 | const geistMono = Geist_Mono({ 11 | variable: "--font-geist-mono", 12 | subsets: ["latin"], 13 | }); 14 | 15 | export const metadata: Metadata = { 16 | title: "Create Next App", 17 | description: "Generated by create next app", 18 | }; 19 | 20 | export default function RootLayout({ 21 | children, 22 | }: Readonly<{ 23 | children: React.ReactNode; 24 | }>) { 25 | return ( 26 | 27 | 30 | {children} 31 | 32 | 33 | ); 34 | } 35 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/src/app/page.tsx: -------------------------------------------------------------------------------- 1 | import { Suspense } from "react" 2 | import ImageRemixTool from "@/components/image-remix-tool" 3 | import LoadingOverlay from "@/components/loading-overlay" 4 | 5 | export default function Home() { 6 | return ( 7 |
8 |
9 |

10 | OpenAI Frontiers 2025 15 |

16 | 17 | }> 18 | 19 | 20 |
21 |
22 | ) 23 | } 24 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/src/components/error-message.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import { XCircle } from "lucide-react" 4 | 5 | interface ErrorMessageProps { 6 | message: string 7 | onDismiss?: () => void 8 | } 9 | 10 | export default function ErrorMessage({ message, onDismiss }: ErrorMessageProps) { 11 | return ( 12 |
13 |
14 |
15 | 16 |
17 |
18 |

{message}

19 |
20 | {onDismiss && ( 21 | 25 | )} 26 |
27 |
28 | ) 29 | } 30 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/src/components/loading-overlay.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | interface LoadingOverlayProps { 4 | message?: string 5 | } 6 | 7 | export default function LoadingOverlay({ message = "Loading..." }: LoadingOverlayProps) { 8 | return ( 9 |
10 |
11 |
12 |

{message}

13 |
14 |
15 | ) 16 | } 17 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/src/components/result-gallery.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | interface ResultGalleryProps { 4 | images: { url: string; id: string | null }[] 5 | selectedIndex: number | null 6 | onSelect: (index: number) => void 7 | onPreview: (index: number) => void 8 | } 9 | 10 | export default function ResultGallery({ images, selectedIndex, onSelect, onPreview }: ResultGalleryProps) { 11 | return ( 12 |
13 | {images.map((image, index) => ( 14 |
{ onPreview(index); }} 20 | > 21 | {image.url ? ( 22 | {`Result 23 | ) : ( 24 |
25 | Generating... 26 |
27 | )} 28 |
{ e.stopPropagation(); onSelect(index); }} 33 | > 34 | {selectedIndex === index && ( 35 |
36 |
37 |
38 | )} 39 |
40 |
41 | ))} 42 |
43 | ) 44 | } 45 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { clsx, type ClassValue } from "clsx" 2 | import { twMerge } from "tailwind-merge" 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)) 6 | } 7 | -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: [ 4 | "./app/**/*.{ts,tsx}", 5 | "./pages/**/*.{ts,tsx}", 6 | "./components/**/*.{ts,tsx}" 7 | ], 8 | theme: { 9 | extend: {}, 10 | }, 11 | plugins: [], 12 | } -------------------------------------------------------------------------------- /13-image-gen/imagegen-demo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2017", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "noEmit": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "bundler", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "jsx": "preserve", 15 | "incremental": true, 16 | "plugins": [ 17 | { 18 | "name": "next" 19 | } 20 | ], 21 | "paths": { 22 | "@/*": ["./src/*"] 23 | } 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "single_image.js"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /2-assistants/0_setup.py: -------------------------------------------------------------------------------- 1 | from openai import OpenAI 2 | from demo_util import color 3 | 4 | 5 | client = OpenAI() 6 | 7 | # === Demo Loop === 8 | 9 | model = "gpt-4o-mini" 10 | system_message = "You are a helpful Assistant." 11 | 12 | messages = [] 13 | while True: 14 | # get user input 15 | user = input(color("User: ", "blue") + "\033[90m") 16 | messages.append({"role": "user", "content": user}) 17 | 18 | # get model completion 19 | response = client.chat.completions.create( 20 | model=model, 21 | messages=[{"role": "system", "content": system_message}] + messages, 22 | ) 23 | message = response.choices[0].message 24 | print(color("Assistant:", "yellow"), message.content) 25 | 26 | # add message to history 27 | messages.append(message) 28 | -------------------------------------------------------------------------------- /2-assistants/1_routines.py: -------------------------------------------------------------------------------- 1 | from openai import OpenAI 2 | from demo_util import color 3 | 4 | 5 | client = OpenAI() 6 | 7 | # === Demo Loop === 8 | 9 | model = "gpt-4o-mini" 10 | system_message = ( 11 | "You are a customer support agent for ACME Inc." 12 | "Always answer in a sentence or less." 13 | "Follow the following routine with the user:" 14 | "1. First, ask probing questions and understand the user's problem deeper.\n" 15 | " - unless the user has already provided a reason.\n" 16 | "2. Propose a fix (make one up).\n" 17 | "3. ONLY if not satisfied, offer a refund.\n" 18 | "4. If accepted, search for the ID and then execute refund." 19 | "" 20 | ) 21 | 22 | 23 | messages = [] 24 | while True: 25 | user = input(color("User: ", "blue") + "\033[90m") 26 | messages.append({"role": "user", "content": user}) 27 | 28 | response = client.chat.completions.create( 29 | model=model, 30 | messages=[{"role": "system", "content": system_message}] + messages, 31 | ) 32 | message = response.choices[0].message 33 | print(color("Assistant:", "yellow"), message.content) 34 | 35 | messages.append(message) 36 | -------------------------------------------------------------------------------- /2-assistants/README.md: -------------------------------------------------------------------------------- 1 | # Assistants, Agents, and Orchestration 2 | 3 | Demo code used in the Assistants Build Hours. 4 | 5 | For an in-depth walkthrough, check out the [recording](https://vimeo.com/990334325/56b552bc7a). 6 | 7 | ## Setup 8 | 9 | 1. Set your OpenAI key. 10 | 11 | ```bash 12 | export OPENAI_API_KEY="sk_XXX..." 13 | ``` 14 | 15 | 2. Run. 16 | 17 | ```bash 18 | python 7_orchestration.py 19 | ``` 20 | -------------------------------------------------------------------------------- /3-4o_mini_fine_tuning/1_eval_baseline.py: -------------------------------------------------------------------------------- 1 | # %% 2 | import pandas as pd 3 | import os 4 | import yaml 5 | 6 | run_name = "customer_service_chat_triage_n=100" 7 | df = pd.read_csv("./data/{}.csv".format(run_name)) 8 | 9 | # Generate promptfoo eval file 10 | n_rows = len(df) 11 | 12 | output_dict = { 13 | "description": run_name, 14 | "prompts": ["../prompts/verbatim_input.txt", "../prompts/cot3.json"], 15 | "providers": [ 16 | "openai:chat:gpt-3.5-turbo", 17 | "openai:chat:gpt-4o-mini", 18 | "openai:chat:gpt-4o", 19 | ], 20 | "tests": [ 21 | { 22 | "vars": {"input": row["prompt"], "target": row["correct_output"]}, 23 | "assert": [ 24 | {"type": "python", "value": "file://../py/assert_last_line_answer.py"} 25 | ], 26 | } 27 | for _, row in df[:n_rows].iterrows() 28 | ], 29 | } 30 | 31 | os.makedirs("./evals", exist_ok=True) 32 | 33 | with open("./evals/{}.yaml".format(run_name), "w") as file: 34 | yaml.dump(output_dict, file, default_flow_style=False) 35 | print( 36 | "Generated {} promptfoo tests and saved to {}".format( 37 | n_rows, "{}.yaml".format(run_name) 38 | ) 39 | ) 40 | -------------------------------------------------------------------------------- /3-4o_mini_fine_tuning/README.md: -------------------------------------------------------------------------------- 1 | # GPT 4o-mini Build Hour Code 2 | 3 | Demo code used in the GPT-4o mini Fine Tuning Build Hours. 4 | 5 | Recording coming soon! 6 | 7 | ## Setup 8 | 9 | 1. Set your OpenAI API key ([docs](https://platform.openai.com/docs/quickstart)). 10 | 11 | ```bash 12 | export OPENAI_API_KEY="sk_XXX..." 13 | ``` 14 | 15 | 2. Run. 16 | 17 | ```bash 18 | python 0_generate_eval_data.py 19 | ``` 20 | -------------------------------------------------------------------------------- /3-4o_mini_fine_tuning/prompts/cot3.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "role": "system", 4 | "content": "You are an expert at developing logical, rigorous reasoning to classify the intent of a customer service ticket. Think step by step and analyze the task before providing your final answer. The final answer must be rendered on the last output line, with no additional quotes, xml tags, or empty newlines.\n\nIn your analysis, perform the following steps:\n1. Analyze the content of the chat to determine the primary issue\n2. Extract key phrases and concepts, and explain how they could help make the correct classification\n3. Consider each of the provided categories and identify the potential for each, with a confidence (1-10)\n4. Highlight ambiguity or limitations\n5. Synthesize your findings and create a final rationale\n6. Output the final answer in the final line. Do not output any empty newlines or markdown ` characters.\n" 5 | }, 6 | { 7 | "role": "user", 8 | "content": "{{input}}" 9 | } 10 | ] -------------------------------------------------------------------------------- /3-4o_mini_fine_tuning/prompts/verbatim_input.txt: -------------------------------------------------------------------------------- 1 | {{input}} -------------------------------------------------------------------------------- /3-4o_mini_fine_tuning/py/assert_last_line_answer.py: -------------------------------------------------------------------------------- 1 | from typing import Dict, Any 2 | 3 | 4 | def get_assert(output: str, context) -> Dict[str, Any]: 5 | try: 6 | ans = output.split("\n")[-1] 7 | if str(context["vars"]["target"]).lower() in ans.lower(): 8 | return {"pass": True, "score": 1.0, "reason": "passed"} 9 | 10 | return { 11 | "pass": False, 12 | "score": 0.0, 13 | "reason": "Not correct. Ans={}".format(ans), 14 | } 15 | except Exception as e: 16 | return { 17 | "pass": False, 18 | "score": 0.0, 19 | "reason": str(e), 20 | } 21 | -------------------------------------------------------------------------------- /4-mmrag_tooluse/database.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | def get_table_names(conn): 4 | """Return a list of table names.""" 5 | table_names = [] 6 | tables = conn.execute("SELECT name FROM sqlite_master WHERE type='table';") 7 | for table in tables.fetchall(): 8 | table_names.append(table[0]) 9 | return table_names 10 | 11 | 12 | def get_column_names(conn, table_name): 13 | """Return a list of column names.""" 14 | column_names = [] 15 | columns = conn.execute(f"PRAGMA table_info('{table_name}');").fetchall() 16 | for col in columns: 17 | column_names.append(col[1]) 18 | return column_names 19 | 20 | 21 | def get_database_info(conn): 22 | """Return a list of dicts containing the table name and columns for each table in the database.""" 23 | table_dicts = [] 24 | for table_name in get_table_names(conn): 25 | columns_names = get_column_names(conn, table_name) 26 | table_dicts.append( 27 | {"table_name": table_name, "column_names": columns_names}) 28 | return table_dicts 29 | -------------------------------------------------------------------------------- /4-mmrag_tooluse/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | services: 3 | qdrant: 4 | image: qdrant/qdrant:v1.3.0 5 | restart: on-failure 6 | ports: 7 | - "6335:6335" 8 | -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings.db -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q120_4.28.20_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q120_4.28.20_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q121_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q121_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q122_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q122_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q123_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q123_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q124_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q124_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q220_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q220_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q221_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q221_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q222_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q222_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q223_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q223_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q224_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q224_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q320_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q320_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q321_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q321_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q322_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q322_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q420_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q420_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q421_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q421_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q422_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q422_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_report_all/Webslides_Q423_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_report_all/Webslides_Q423_Final.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/earnings_reports_sample/Webslides_Q323.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/4-mmrag_tooluse/earnings_reports_sample/Webslides_Q323.pdf -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q120.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q120", 4 | "data": [ 5 | { 6 | "quarter": "Q1 2019", 7 | "operating_cash_flow": 34360, 8 | "purchases_of_property_and_equipment": -11316, 9 | "free_cash_flow": 23044 10 | }, 11 | { 12 | "quarter": "Q2 2019", 13 | "operating_cash_flow": 36029, 14 | "purchases_of_property_and_equipment": -11011, 15 | "free_cash_flow": 25018 16 | }, 17 | { 18 | "quarter": "Q3 2019", 19 | "operating_cash_flow": 35332, 20 | "purchases_of_property_and_equipment": -11868, 21 | "free_cash_flow": 23464 22 | }, 23 | { 24 | "quarter": "Q4 2019", 25 | "operating_cash_flow": 38514, 26 | "purchases_of_property_and_equipment": -12689, 27 | "free_cash_flow": 25825 28 | }, 29 | { 30 | "quarter": "Q1 2020", 31 | "operating_cash_flow": 39732, 32 | "purchases_of_property_and_equipment": -15395, 33 | "free_cash_flow": 24337 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q121.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q121", 4 | "data": [ 5 | { 6 | "quarter": "Q1 2020", 7 | "operating_cash_flow": 39732, 8 | "purchases_of_property_and_equipment": -15395, 9 | "free_cash_flow": 24337 10 | }, 11 | { 12 | "quarter": "Q2 2020", 13 | "operating_cash_flow": 51220, 14 | "purchases_of_property_and_equipment": -19368, 15 | "free_cash_flow": 31852 16 | }, 17 | { 18 | "quarter": "Q3 2020", 19 | "operating_cash_flow": 55292, 20 | "purchases_of_property_and_equipment": -25791, 21 | "free_cash_flow": 29501 22 | }, 23 | { 24 | "quarter": "Q4 2020", 25 | "operating_cash_flow": 66064, 26 | "purchases_of_property_and_equipment": -35044, 27 | "free_cash_flow": 31020 28 | }, 29 | { 30 | "quarter": "Q1 2021", 31 | "operating_cash_flow": 67213, 32 | "purchases_of_property_and_equipment": -40803, 33 | "free_cash_flow": 26410 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q122.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q122", 4 | "data": [ 5 | { 6 | "quarter": "Q1 2021", 7 | "operating_cash_flow": 67213, 8 | "purchases_of_property_and_equipment": -40803, 9 | "free_cash_flow": 26410 10 | }, 11 | { 12 | "quarter": "Q2 2021", 13 | "operating_cash_flow": 59322, 14 | "purchases_of_property_and_equipment": -47176, 15 | "free_cash_flow": 12146 16 | }, 17 | { 18 | "quarter": "Q3 2021", 19 | "operating_cash_flow": 54671, 20 | "purchases_of_property_and_equipment": -52119, 21 | "free_cash_flow": 2552 22 | }, 23 | { 24 | "quarter": "Q4 2021", 25 | "operating_cash_flow": 46327, 26 | "purchases_of_property_and_equipment": -55396, 27 | "free_cash_flow": -9069 28 | }, 29 | { 30 | "quarter": "Q1 2022", 31 | "operating_cash_flow": 39324, 32 | "purchases_of_property_and_equipment": -57951, 33 | "free_cash_flow": -18627 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q123.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q123", 4 | "data": [ 5 | { 6 | "quarter": "Q1 2022", 7 | "operating_cash_flow": 39324, 8 | "purchases_of_property_and_equipment": -57951, 9 | "free_cash_flow": -18627 10 | }, 11 | { 12 | "quarter": "Q2 2022", 13 | "operating_cash_flow": 35574, 14 | "purchases_of_property_and_equipment": -59061, 15 | "free_cash_flow": -23487 16 | }, 17 | { 18 | "quarter": "Q3 2022", 19 | "operating_cash_flow": 39665, 20 | "purchases_of_property_and_equipment": -59351, 21 | "free_cash_flow": -19686 22 | }, 23 | { 24 | "quarter": "Q4 2022", 25 | "operating_cash_flow": 46752, 26 | "purchases_of_property_and_equipment": -58321, 27 | "free_cash_flow": -11569 28 | }, 29 | { 30 | "quarter": "Q1 2023", 31 | "operating_cash_flow": 54330, 32 | "purchases_of_property_and_equipment": -57649, 33 | "free_cash_flow": -3319 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q124.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q124", 4 | "data": [ 5 | { 6 | "quarter": "Q1 2023", 7 | "operating_cash_flow": 54330, 8 | "purchases_of_property_and_equipment": -57649, 9 | "free_cash_flow": -3319 10 | }, 11 | { 12 | "quarter": "Q2 2023", 13 | "operating_cash_flow": 61841, 14 | "purchases_of_property_and_equipment": -53963, 15 | "free_cash_flow": 7878 16 | }, 17 | { 18 | "quarter": "Q3 2023", 19 | "operating_cash_flow": 71654, 20 | "purchases_of_property_and_equipment": -50220, 21 | "free_cash_flow": 21434 22 | }, 23 | { 24 | "quarter": "Q4 2023", 25 | "operating_cash_flow": 84946, 26 | "purchases_of_property_and_equipment": -48133, 27 | "free_cash_flow": 36813 28 | }, 29 | { 30 | "quarter": "Q1 2024", 31 | "operating_cash_flow": 99147, 32 | "purchases_of_property_and_equipment": -48998, 33 | "free_cash_flow": 50149 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q220.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q220", 4 | "data": [ 5 | { 6 | "quarter": "Q2 2019", 7 | "operating_cash_flow": 36029, 8 | "purchases_of_property_and_equipment": -11011, 9 | "free_cash_flow": 25018 10 | }, 11 | { 12 | "quarter": "Q3 2019", 13 | "operating_cash_flow": 35332, 14 | "purchases_of_property_and_equipment": -11868, 15 | "free_cash_flow": 23464 16 | }, 17 | { 18 | "quarter": "Q4 2019", 19 | "operating_cash_flow": 38514, 20 | "purchases_of_property_and_equipment": -12689, 21 | "free_cash_flow": 25825 22 | }, 23 | { 24 | "quarter": "Q1 2020", 25 | "operating_cash_flow": 39732, 26 | "purchases_of_property_and_equipment": -15395, 27 | "free_cash_flow": 24337 28 | }, 29 | { 30 | "quarter": "Q2 2020", 31 | "operating_cash_flow": 51220, 32 | "purchases_of_property_and_equipment": -19368, 33 | "free_cash_flow": 31852 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q221.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q221", 4 | "data": [ 5 | { 6 | "quarter": "Q2 2020", 7 | "operating_cash_flow": 51220, 8 | "purchases_of_property_and_equipment": -19368, 9 | "free_cash_flow": 31852 10 | }, 11 | { 12 | "quarter": "Q3 2020", 13 | "operating_cash_flow": 55292, 14 | "purchases_of_property_and_equipment": -25791, 15 | "free_cash_flow": 29501 16 | }, 17 | { 18 | "quarter": "Q4 2020", 19 | "operating_cash_flow": 66064, 20 | "purchases_of_property_and_equipment": -35044, 21 | "free_cash_flow": 31020 22 | }, 23 | { 24 | "quarter": "Q1 2021", 25 | "operating_cash_flow": 67213, 26 | "purchases_of_property_and_equipment": -40803, 27 | "free_cash_flow": 26410 28 | }, 29 | { 30 | "quarter": "Q2 2021", 31 | "operating_cash_flow": 59322, 32 | "purchases_of_property_and_equipment": -47176, 33 | "free_cash_flow": 12146 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q222.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q222", 4 | "data": [ 5 | { 6 | "quarter": "Q2 2021", 7 | "operating_cash_flow": 59322, 8 | "purchases_of_property_and_equipment": -47176, 9 | "free_cash_flow": 12146 10 | }, 11 | { 12 | "quarter": "Q3 2021", 13 | "operating_cash_flow": 54671, 14 | "purchases_of_property_and_equipment": -52119, 15 | "free_cash_flow": 2552 16 | }, 17 | { 18 | "quarter": "Q4 2021", 19 | "operating_cash_flow": 46327, 20 | "purchases_of_property_and_equipment": -55396, 21 | "free_cash_flow": -9069 22 | }, 23 | { 24 | "quarter": "Q1 2022", 25 | "operating_cash_flow": 39324, 26 | "purchases_of_property_and_equipment": -57951, 27 | "free_cash_flow": -18627 28 | }, 29 | { 30 | "quarter": "Q2 2022", 31 | "operating_cash_flow": 35574, 32 | "purchases_of_property_and_equipment": -59061, 33 | "free_cash_flow": -23487 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q223.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q223", 4 | "data": [ 5 | { 6 | "quarter": "Q2 2022", 7 | "operating_cash_flow": 35574, 8 | "purchases_of_property_and_equipment": -59061, 9 | "free_cash_flow": -23487 10 | }, 11 | { 12 | "quarter": "Q3 2022", 13 | "operating_cash_flow": 39665, 14 | "purchases_of_property_and_equipment": -59351, 15 | "free_cash_flow": -19686 16 | }, 17 | { 18 | "quarter": "Q4 2022", 19 | "operating_cash_flow": 46752, 20 | "purchases_of_property_and_equipment": -58321, 21 | "free_cash_flow": -11569 22 | }, 23 | { 24 | "quarter": "Q1 2023", 25 | "operating_cash_flow": 54330, 26 | "purchases_of_property_and_equipment": -57649, 27 | "free_cash_flow": -3319 28 | }, 29 | { 30 | "quarter": "Q2 2023", 31 | "operating_cash_flow": 61841, 32 | "purchases_of_property_and_equipment": -53963, 33 | "free_cash_flow": 7878 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q224.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q224", 4 | "data": [ 5 | { 6 | "quarter": "Q2 2023", 7 | "operating_cash_flow": 61841, 8 | "purchases_of_property_and_equipment": -53963, 9 | "free_cash_flow": 7878 10 | }, 11 | { 12 | "quarter": "Q3 2023", 13 | "operating_cash_flow": 71654, 14 | "purchases_of_property_and_equipment": -50220, 15 | "free_cash_flow": 21434 16 | }, 17 | { 18 | "quarter": "Q4 2023", 19 | "operating_cash_flow": 84946, 20 | "purchases_of_property_and_equipment": -48133, 21 | "free_cash_flow": 36813 22 | }, 23 | { 24 | "quarter": "Q1 2024", 25 | "operating_cash_flow": 99147, 26 | "purchases_of_property_and_equipment": -48998, 27 | "free_cash_flow": 50149 28 | }, 29 | { 30 | "quarter": "Q2 2024", 31 | "operating_cash_flow": 107952, 32 | "purchases_of_property_and_equipment": -54979, 33 | "free_cash_flow": 52973 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q320.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q320", 4 | "data": [ 5 | { 6 | "quarter": "Q3 2019", 7 | "operating_cash_flow": 35332, 8 | "purchases_of_property_and_equipment": -11868, 9 | "free_cash_flow": 23464 10 | }, 11 | { 12 | "quarter": "Q4 2019", 13 | "operating_cash_flow": 38514, 14 | "purchases_of_property_and_equipment": -12689, 15 | "free_cash_flow": 25825 16 | }, 17 | { 18 | "quarter": "Q1 2020", 19 | "operating_cash_flow": 39732, 20 | "purchases_of_property_and_equipment": -15395, 21 | "free_cash_flow": 24337 22 | }, 23 | { 24 | "quarter": "Q2 2020", 25 | "operating_cash_flow": 51220, 26 | "purchases_of_property_and_equipment": -19368, 27 | "free_cash_flow": 31852 28 | }, 29 | { 30 | "quarter": "Q3 2020", 31 | "operating_cash_flow": 55292, 32 | "purchases_of_property_and_equipment": -25791, 33 | "free_cash_flow": 29501 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q321.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q321", 4 | "data": [ 5 | { 6 | "quarter": "Q3 2020", 7 | "operating_cash_flow": 55292, 8 | "purchases_of_property_and_equipment": -25791, 9 | "free_cash_flow": 29501 10 | }, 11 | { 12 | "quarter": "Q4 2020", 13 | "operating_cash_flow": 66064, 14 | "purchases_of_property_and_equipment": -35044, 15 | "free_cash_flow": 31020 16 | }, 17 | { 18 | "quarter": "Q1 2021", 19 | "operating_cash_flow": 67213, 20 | "purchases_of_property_and_equipment": -40803, 21 | "free_cash_flow": 26410 22 | }, 23 | { 24 | "quarter": "Q2 2021", 25 | "operating_cash_flow": 59322, 26 | "purchases_of_property_and_equipment": -47176, 27 | "free_cash_flow": 12146 28 | }, 29 | { 30 | "quarter": "Q3 2021", 31 | "operating_cash_flow": 54671, 32 | "purchases_of_property_and_equipment": -52119, 33 | "free_cash_flow": 2552 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q322.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q322", 4 | "data": [ 5 | { 6 | "quarter": "Q3 2021", 7 | "operating_cash_flow": 54671, 8 | "purchases_of_property_and_equipment": -52119, 9 | "free_cash_flow": 2552 10 | }, 11 | { 12 | "quarter": "Q4 2021", 13 | "operating_cash_flow": 46327, 14 | "purchases_of_property_and_equipment": -55396, 15 | "free_cash_flow": -9069 16 | }, 17 | { 18 | "quarter": "Q1 2022", 19 | "operating_cash_flow": 39324, 20 | "purchases_of_property_and_equipment": -57951, 21 | "free_cash_flow": -18627 22 | }, 23 | { 24 | "quarter": "Q2 2022", 25 | "operating_cash_flow": 35574, 26 | "purchases_of_property_and_equipment": -59061, 27 | "free_cash_flow": -23487 28 | }, 29 | { 30 | "quarter": "Q3 2022", 31 | "operating_cash_flow": 39665, 32 | "purchases_of_property_and_equipment": -59351, 33 | "free_cash_flow": -19686 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q323.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q323", 4 | "data": [ 5 | { 6 | "quarter": "Q3 2022", 7 | "operating_cash_flow": 39665, 8 | "purchases_of_property_and_equipment": -59351, 9 | "free_cash_flow": -19686 10 | }, 11 | { 12 | "quarter": "Q4 2022", 13 | "operating_cash_flow": 46752, 14 | "purchases_of_property_and_equipment": -58321, 15 | "free_cash_flow": -11569 16 | }, 17 | { 18 | "quarter": "Q1 2023", 19 | "operating_cash_flow": 54330, 20 | "purchases_of_property_and_equipment": -57649, 21 | "free_cash_flow": -3319 22 | }, 23 | { 24 | "quarter": "Q2 2023", 25 | "operating_cash_flow": 61841, 26 | "purchases_of_property_and_equipment": -53963, 27 | "free_cash_flow": 7878 28 | }, 29 | { 30 | "quarter": "Q3 2023", 31 | "operating_cash_flow": 71654, 32 | "purchases_of_property_and_equipment": -50220, 33 | "free_cash_flow": 21434 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q420.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q420", 4 | "data": [ 5 | { 6 | "quarter": "Q4 2019", 7 | "operating_cash_flow": 38514, 8 | "purchases_of_property_and_equipment": -12689, 9 | "free_cash_flow": 25825 10 | }, 11 | { 12 | "quarter": "Q1 2020", 13 | "operating_cash_flow": 39732, 14 | "purchases_of_property_and_equipment": -15395, 15 | "free_cash_flow": 24337 16 | }, 17 | { 18 | "quarter": "Q2 2020", 19 | "operating_cash_flow": 51220, 20 | "purchases_of_property_and_equipment": -19368, 21 | "free_cash_flow": 31852 22 | }, 23 | { 24 | "quarter": "Q3 2020", 25 | "operating_cash_flow": 55292, 26 | "purchases_of_property_and_equipment": -25791, 27 | "free_cash_flow": 29501 28 | }, 29 | { 30 | "quarter": "Q4 2020", 31 | "operating_cash_flow": 66064, 32 | "purchases_of_property_and_equipment": -35044, 33 | "free_cash_flow": 31020 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q421.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q421", 4 | "data": [ 5 | { 6 | "quarter": "Q4 2020", 7 | "operating_cash_flow": 66064, 8 | "purchases_of_property_and_equipment": -35044, 9 | "free_cash_flow": 31020 10 | }, 11 | { 12 | "quarter": "Q1 2021", 13 | "operating_cash_flow": 67213, 14 | "purchases_of_property_and_equipment": -40803, 15 | "free_cash_flow": 26410 16 | }, 17 | { 18 | "quarter": "Q2 2021", 19 | "operating_cash_flow": 59322, 20 | "purchases_of_property_and_equipment": -47176, 21 | "free_cash_flow": 12146 22 | }, 23 | { 24 | "quarter": "Q3 2021", 25 | "operating_cash_flow": 54671, 26 | "purchases_of_property_and_equipment": -52119, 27 | "free_cash_flow": 2552 28 | }, 29 | { 30 | "quarter": "Q4 2021", 31 | "operating_cash_flow": 46327, 32 | "purchases_of_property_and_equipment": -55396, 33 | "free_cash_flow": -9069 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q422.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q422", 4 | "data": [ 5 | { 6 | "quarter": "Q4 2021", 7 | "operating_cash_flow": 46327, 8 | "purchases_of_property_and_equipment": -55396, 9 | "free_cash_flow": -9069 10 | }, 11 | { 12 | "quarter": "Q1 2022", 13 | "operating_cash_flow": 39324, 14 | "purchases_of_property_and_equipment": -57951, 15 | "free_cash_flow": -18627 16 | }, 17 | { 18 | "quarter": "Q2 2022", 19 | "operating_cash_flow": 35574, 20 | "purchases_of_property_and_equipment": -59061, 21 | "free_cash_flow": -23487 22 | }, 23 | { 24 | "quarter": "Q3 2022", 25 | "operating_cash_flow": 39665, 26 | "purchases_of_property_and_equipment": -59351, 27 | "free_cash_flow": -19686 28 | }, 29 | { 30 | "quarter": "Q4 2022", 31 | "operating_cash_flow": 46752, 32 | "purchases_of_property_and_equipment": -58321, 33 | "free_cash_flow": -11569 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /4-mmrag_tooluse/table_json/Free_Cash_Flow_Reconciliation_Q423.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Free_Cash_Flow_Reconciliation", 3 | "report_date": "Q423", 4 | "data": [ 5 | { 6 | "quarter": "Q4 2022", 7 | "operating_cash_flow": 46752, 8 | "purchases_of_property_and_equipment": -58321, 9 | "free_cash_flow": -11569 10 | }, 11 | { 12 | "quarter": "Q1 2023", 13 | "operating_cash_flow": 54330, 14 | "purchases_of_property_and_equipment": -57649, 15 | "free_cash_flow": -3319 16 | }, 17 | { 18 | "quarter": "Q2 2023", 19 | "operating_cash_flow": 61841, 20 | "purchases_of_property_and_equipment": -53963, 21 | "free_cash_flow": 7878 22 | }, 23 | { 24 | "quarter": "Q3 2023", 25 | "operating_cash_flow": 71654, 26 | "purchases_of_property_and_equipment": -50220, 27 | "free_cash_flow": 21434 28 | }, 29 | { 30 | "quarter": "Q4 2023", 31 | "operating_cash_flow": 84946, 32 | "purchases_of_property_and_equipment": -48133, 33 | "free_cash_flow": 36813 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /5-4o_fine_tuning/.gitignore: -------------------------------------------------------------------------------- 1 | staticeval/ -------------------------------------------------------------------------------- /5-4o_fine_tuning/logs/ft_gpt-3*5-turbo-0125_openai-gtm_vulnfixes0821_9ym18NbR-0-shot_20240823_0037.log: -------------------------------------------------------------------------------- 1 | Eval Results 2 | -------------------- 3 | Timestamp: 2024-08-23 00:37:20 4 | Model: ft:gpt-3.5-turbo-0125:openai-gtm:vulnfixes0821:9ym18NbR 5 | Score: 50.44% 6 | Semgrep Version: 1.85.0 7 | Passing Tests: 57 out of 113 8 | Number of few-shot examples: 0 9 | Use similarity for examples: No 10 | Fixed Files: 11 | - 093118.py 12 | - 717170.py 13 | - 627547.py 14 | - 773378.py 15 | - 624453.py 16 | - 879024.py 17 | - 758317.py 18 | - 530858.py 19 | - 429723.py 20 | - 837764.py 21 | - 916728.py 22 | - 778047.py 23 | - 783587.py 24 | - 102308.py 25 | - 545558.py 26 | - 549500.py 27 | - 539416.py 28 | - 763767.py 29 | - 589414.py 30 | - 886160.py 31 | - 703706.py 32 | - 215937.py 33 | - 452701.py 34 | - 109129.py 35 | - 262477.py 36 | - 513433.py 37 | - 454489.py 38 | - 082256.py 39 | - 494107.py 40 | - 222094.py 41 | - 426331.py 42 | - 116843.py 43 | - 490297.py 44 | - 204197.py 45 | - 032394.py 46 | - 041528.py 47 | - 557095.py 48 | - 239585.py 49 | - 765068.py 50 | - 287641.py 51 | - 672233.py 52 | - 230568.py 53 | - 076051.py 54 | - 527709.py 55 | - 245327.py 56 | - 870482.py 57 | - 554536.py 58 | - 434281.py 59 | - 930264.py 60 | - 885715.py 61 | - 476533.py 62 | - 588795.py 63 | - 779518.py 64 | - 614629.py 65 | - 494330.py 66 | - 095146.py 67 | - 782536.py 68 | -------------------------------------------------------------------------------- /5-4o_fine_tuning/logs/ft_gpt-4o-2024-08-06_openai-gtm_vulnfixes-cot-0822_9zGknzVV-0-shot_20240822_2220.log: -------------------------------------------------------------------------------- 1 | Eval Results 2 | -------------------- 3 | Timestamp: 2024-08-22 22:20:20 4 | Model: ft:gpt-4o-2024-08-06:openai-gtm:vulnfixes-cot-0822:9zGknzVV 5 | Score: 69.03% 6 | Semgrep Version: 1.85.0 7 | Passing Tests: 78 out of 113 8 | Number of few-shot examples: 0 9 | Use similarity for examples: No 10 | Fixed Files: 11 | - 717170.py 12 | - 916728.py 13 | - 773378.py 14 | - 932523.py 15 | - 177699.py 16 | - 093118.py 17 | - 624453.py 18 | - 948858.py 19 | - 879024.py 20 | - 530858.py 21 | - 837764.py 22 | - 429723.py 23 | - 036289.py 24 | - 778047.py 25 | - 549500.py 26 | - 102308.py 27 | - 804802.py 28 | - 545558.py 29 | - 539416.py 30 | - 886160.py 31 | - 458056.py 32 | - 422890.py 33 | - 589414.py 34 | - 525549.py 35 | - 001029.py 36 | - 974666.py 37 | - 780018.py 38 | - 703706.py 39 | - 452701.py 40 | - 262477.py 41 | - 109129.py 42 | - 513433.py 43 | - 770044.py 44 | - 006394.py 45 | - 454489.py 46 | - 173324.py 47 | - 494107.py 48 | - 387722.py 49 | - 426331.py 50 | - 938513.py 51 | - 222094.py 52 | - 032394.py 53 | - 791267.py 54 | - 490297.py 55 | - 192634.py 56 | - 041528.py 57 | - 693973.py 58 | - 204197.py 59 | - 239585.py 60 | - 514256.py 61 | - 610060.py 62 | - 557095.py 63 | - 916680.py 64 | - 765068.py 65 | - 511699.py 66 | - 969579.py 67 | - 287641.py 68 | - 672233.py 69 | - 218664.py 70 | - 409624.py 71 | - 192152.py 72 | - 263731.py 73 | - 245327.py 74 | - 076051.py 75 | - 527709.py 76 | - 870482.py 77 | - 885715.py 78 | - 930264.py 79 | - 434281.py 80 | - 476533.py 81 | - 310532.py 82 | - 087698.py 83 | - 779518.py 84 | - 588795.py 85 | - 614629.py 86 | - 494330.py 87 | - 095146.py 88 | - 782536.py 89 | -------------------------------------------------------------------------------- /5-4o_fine_tuning/logs/ft_gpt-4o-2024-08-06_openai-gtm_vulnfixes-cot-0822_9zGknzVV-5-shot-sim_20240823_0000.log: -------------------------------------------------------------------------------- 1 | Eval Results 2 | -------------------- 3 | Timestamp: 2024-08-23 00:00:31 4 | Model: ft:gpt-4o-2024-08-06:openai-gtm:vulnfixes-cot-0822:9zGknzVV 5 | Score: 71.68% 6 | Semgrep Version: 1.85.0 7 | Passing Tests: 81 out of 113 8 | Number of few-shot examples: 5 9 | Use similarity for examples: Yes 10 | Fixed Files: 11 | - 916728.py 12 | - 627547.py 13 | - 773378.py 14 | - 177699.py 15 | - 093118.py 16 | - 758317.py 17 | - 879024.py 18 | - 884804.py 19 | - 948858.py 20 | - 359100.py 21 | - 530858.py 22 | - 837764.py 23 | - 102308.py 24 | - 036289.py 25 | - 778047.py 26 | - 695407.py 27 | - 549500.py 28 | - 545558.py 29 | - 804802.py 30 | - 589414.py 31 | - 539416.py 32 | - 763767.py 33 | - 458056.py 34 | - 886160.py 35 | - 780018.py 36 | - 001029.py 37 | - 525549.py 38 | - 703706.py 39 | - 452701.py 40 | - 974666.py 41 | - 124108.py 42 | - 641969.py 43 | - 109129.py 44 | - 770044.py 45 | - 262477.py 46 | - 513433.py 47 | - 006394.py 48 | - 946124.py 49 | - 494107.py 50 | - 454489.py 51 | - 222094.py 52 | - 426331.py 53 | - 791267.py 54 | - 116843.py 55 | - 032394.py 56 | - 041528.py 57 | - 693973.py 58 | - 192634.py 59 | - 204197.py 60 | - 239585.py 61 | - 557095.py 62 | - 813380.py 63 | - 514256.py 64 | - 765068.py 65 | - 969579.py 66 | - 299989.py 67 | - 916680.py 68 | - 511699.py 69 | - 672233.py 70 | - 218664.py 71 | - 409624.py 72 | - 914791.py 73 | - 263731.py 74 | - 245327.py 75 | - 192152.py 76 | - 076051.py 77 | - 527709.py 78 | - 365412.py 79 | - 870482.py 80 | - 434281.py 81 | - 930264.py 82 | - 476533.py 83 | - 252141.py 84 | - 087698.py 85 | - 310532.py 86 | - 779518.py 87 | - 614629.py 88 | - 190570.py 89 | - 095146.py 90 | - 782536.py 91 | - 494330.py 92 | -------------------------------------------------------------------------------- /5-4o_fine_tuning/logs/ft_gpt-4o-2024-08-06_openai-gtm_vulnfixes0821-long_9ymKVX9n-0-shot_20240825_2220.log: -------------------------------------------------------------------------------- 1 | Eval Results 2 | -------------------- 3 | Timestamp: 2024-08-25 22:20:39 4 | Model: ft:gpt-4o-2024-08-06:openai-gtm:vulnfixes0821-long:9ymKVX9n 5 | Score: 61.94% 6 | Semgrep Version: 1.85.0 7 | Passing Tests: 70 out of 113 8 | Number of few-shot examples: 0 9 | Use similarity for examples: No 10 | Fixed Files: 11 | - 717170.py 12 | - 916728.py 13 | - 773378.py 14 | - 932523.py 15 | - 177699.py 16 | - 093118.py 17 | - 624453.py 18 | - 948858.py 19 | - 879024.py 20 | - 530858.py 21 | - 837764.py 22 | - 429723.py 23 | - 036289.py 24 | - 778047.py 25 | - 549500.py 26 | - 102308.py 27 | - 804802.py 28 | - 545558.py 29 | - 539416.py 30 | - 886160.py 31 | - 458056.py 32 | - 422890.py 33 | - 589414.py 34 | - 525549.py 35 | - 001029.py 36 | - 974666.py 37 | - 780018.py 38 | - 703706.py 39 | - 452701.py 40 | - 262477.py 41 | - 109129.py 42 | - 513433.py 43 | - 770044.py 44 | - 006394.py 45 | - 454489.py 46 | - 387722.py 47 | - 426331.py 48 | - 938513.py 49 | - 222094.py 50 | - 032394.py 51 | - 791267.py 52 | - 490297.py 53 | - 192634.py 54 | - 041528.py 55 | - 693973.py 56 | - 204197.py 57 | - 239585.py 58 | - 514256.py 59 | - 610060.py 60 | - 557095.py 61 | - 916680.py 62 | - 765068.py 63 | - 511699.py 64 | - 969579.py 65 | - 287641.py 66 | - 672233.py 67 | - 218664.py 68 | - 409624.py 69 | - 192152.py 70 | - 263731.py 71 | - 245327.py 72 | - 076051.py 73 | - 527709.py 74 | - 434281.py 75 | - 476533.py 76 | - 310532.py 77 | - 087698.py 78 | - 779518.py 79 | - 494330.py 80 | - 782536.py 81 | -------------------------------------------------------------------------------- /5-4o_fine_tuning/logs/ft_gpt-4o-mini-2024-07-18_openai-gtm_vulnfixes0822_9zILpnPW-0-shot_20240823_0027.log: -------------------------------------------------------------------------------- 1 | Eval Results 2 | -------------------- 3 | Timestamp: 2024-08-23 00:27:14 4 | Model: ft:gpt-4o-mini-2024-07-18:openai-gtm:vulnfixes0822:9zILpnPW 5 | Score: 59.29% 6 | Semgrep Version: 1.85.0 7 | Passing Tests: 67 out of 113 8 | Number of few-shot examples: 0 9 | Use similarity for examples: No 10 | Fixed Files: 11 | - 570756.py 12 | - 773378.py 13 | - 627547.py 14 | - 717170.py 15 | - 093118.py 16 | - 916728.py 17 | - 624453.py 18 | - 884804.py 19 | - 879024.py 20 | - 948858.py 21 | - 530858.py 22 | - 837764.py 23 | - 429723.py 24 | - 783587.py 25 | - 778047.py 26 | - 102308.py 27 | - 036289.py 28 | - 695407.py 29 | - 545558.py 30 | - 804802.py 31 | - 539416.py 32 | - 589414.py 33 | - 886160.py 34 | - 422890.py 35 | - 001029.py 36 | - 780018.py 37 | - 703706.py 38 | - 215937.py 39 | - 452701.py 40 | - 109129.py 41 | - 262477.py 42 | - 513433.py 43 | - 006394.py 44 | - 494107.py 45 | - 082256.py 46 | - 387722.py 47 | - 426331.py 48 | - 222094.py 49 | - 116843.py 50 | - 032394.py 51 | - 204197.py 52 | - 041528.py 53 | - 693973.py 54 | - 239585.py 55 | - 557095.py 56 | - 813380.py 57 | - 765068.py 58 | - 287641.py 59 | - 672233.py 60 | - 023226.py 61 | - 218664.py 62 | - 230568.py 63 | - 914791.py 64 | - 409624.py 65 | - 245327.py 66 | - 076051.py 67 | - 527709.py 68 | - 476533.py 69 | - 434281.py 70 | - 930264.py 71 | - 885715.py 72 | - 252141.py 73 | - 614629.py 74 | - 779518.py 75 | - 087698.py 76 | - 494330.py 77 | - 782536.py 78 | -------------------------------------------------------------------------------- /5-4o_fine_tuning/logs/gpt-4o-0-shot_20240823_0018.log: -------------------------------------------------------------------------------- 1 | Eval Results 2 | -------------------- 3 | Timestamp: 2024-08-23 00:18:10 4 | Model: gpt-4o 5 | Score: 53.10% 6 | Semgrep Version: 1.85.0 7 | Passing Tests: 60 out of 113 8 | Number of few-shot examples: 0 9 | Use similarity for examples: No 10 | Fixed Files: 11 | - 916728.py 12 | - 627547.py 13 | - 773378.py 14 | - 093118.py 15 | - 879024.py 16 | - 884804.py 17 | - 530858.py 18 | - 837764.py 19 | - 429723.py 20 | - 102308.py 21 | - 778047.py 22 | - 036289.py 23 | - 695407.py 24 | - 549500.py 25 | - 545558.py 26 | - 804802.py 27 | - 539416.py 28 | - 763767.py 29 | - 589414.py 30 | - 422890.py 31 | - 001029.py 32 | - 780018.py 33 | - 703706.py 34 | - 452701.py 35 | - 215937.py 36 | - 124108.py 37 | - 109129.py 38 | - 513433.py 39 | - 508391.py 40 | - 262477.py 41 | - 006394.py 42 | - 494107.py 43 | - 116843.py 44 | - 938513.py 45 | - 222094.py 46 | - 426331.py 47 | - 032394.py 48 | - 041528.py 49 | - 204197.py 50 | - 239585.py 51 | - 514256.py 52 | - 557095.py 53 | - 765068.py 54 | - 672233.py 55 | - 287641.py 56 | - 218664.py 57 | - 409624.py 58 | - 076051.py 59 | - 245327.py 60 | - 192152.py 61 | - 434281.py 62 | - 930264.py 63 | - 476533.py 64 | - 190570.py 65 | - 087698.py 66 | - 614629.py 67 | - 588795.py 68 | - 494330.py 69 | - 782536.py 70 | - 095146.py 71 | -------------------------------------------------------------------------------- /5-4o_fine_tuning/logs/gpt-4o-5-shot_20240822_2310.log: -------------------------------------------------------------------------------- 1 | Eval Results 2 | -------------------- 3 | Timestamp: 2024-08-22 23:10:56 4 | Model: gpt-4o 5 | Score: 56.64% 6 | Semgrep Version: 1.85.0 7 | Passing Tests: 64 out of 113 8 | Number of few-shot examples: 5 9 | Use similarity for examples: No 10 | Fixed Files: 11 | - 916728.py 12 | - 177699.py 13 | - 627547.py 14 | - 773378.py 15 | - 093118.py 16 | - 948858.py 17 | - 879024.py 18 | - 884804.py 19 | - 530858.py 20 | - 837764.py 21 | - 429723.py 22 | - 695407.py 23 | - 778047.py 24 | - 036289.py 25 | - 545558.py 26 | - 804802.py 27 | - 549500.py 28 | - 539416.py 29 | - 589414.py 30 | - 763767.py 31 | - 886160.py 32 | - 422890.py 33 | - 001029.py 34 | - 780018.py 35 | - 703706.py 36 | - 124108.py 37 | - 109129.py 38 | - 452701.py 39 | - 215937.py 40 | - 262477.py 41 | - 508391.py 42 | - 513433.py 43 | - 006394.py 44 | - 494107.py 45 | - 454489.py 46 | - 387722.py 47 | - 116843.py 48 | - 938513.py 49 | - 222094.py 50 | - 426331.py 51 | - 032394.py 52 | - 041528.py 53 | - 514256.py 54 | - 204197.py 55 | - 239585.py 56 | - 557095.py 57 | - 765068.py 58 | - 287641.py 59 | - 672233.py 60 | - 218664.py 61 | - 409624.py 62 | - 192152.py 63 | - 245327.py 64 | - 076051.py 65 | - 476533.py 66 | - 930264.py 67 | - 434281.py 68 | - 885715.py 69 | - 087698.py 70 | - 614629.py 71 | - 588795.py 72 | - 494330.py 73 | - 782536.py 74 | - 095146.py 75 | -------------------------------------------------------------------------------- /5-4o_fine_tuning/logs/gpt-4o-mini-0-shot_20240822_2322.log: -------------------------------------------------------------------------------- 1 | Eval Results 2 | -------------------- 3 | Timestamp: 2024-08-22 23:22:32 4 | Model: gpt-4o-mini 5 | Score: 53.10% 6 | Semgrep Version: 1.85.0 7 | Passing Tests: 60 out of 113 8 | Number of few-shot examples: 0 9 | Use similarity for examples: No 10 | Fixed Files: 11 | - 916728.py 12 | - 773378.py 13 | - 627547.py 14 | - 093118.py 15 | - 932523.py 16 | - 884804.py 17 | - 879024.py 18 | - 530858.py 19 | - 938702.py 20 | - 837764.py 21 | - 429723.py 22 | - 102308.py 23 | - 036289.py 24 | - 778047.py 25 | - 695407.py 26 | - 549500.py 27 | - 545558.py 28 | - 804802.py 29 | - 539416.py 30 | - 001029.py 31 | - 780018.py 32 | - 422890.py 33 | - 703706.py 34 | - 215937.py 35 | - 124108.py 36 | - 452701.py 37 | - 109129.py 38 | - 508391.py 39 | - 513433.py 40 | - 262477.py 41 | - 006394.py 42 | - 494107.py 43 | - 454489.py 44 | - 387722.py 45 | - 116843.py 46 | - 426331.py 47 | - 791267.py 48 | - 032394.py 49 | - 041528.py 50 | - 514256.py 51 | - 204197.py 52 | - 557095.py 53 | - 299989.py 54 | - 765068.py 55 | - 287641.py 56 | - 672233.py 57 | - 218664.py 58 | - 409624.py 59 | - 230568.py 60 | - 076051.py 61 | - 245327.py 62 | - 192152.py 63 | - 434281.py 64 | - 930264.py 65 | - 476533.py 66 | - 885715.py 67 | - 614629.py 68 | - 087698.py 69 | - 494330.py 70 | - 782536.py 71 | -------------------------------------------------------------------------------- /5-4o_fine_tuning/requirements.txt: -------------------------------------------------------------------------------- 1 | datasets 2 | openai 3 | pydantic 4 | scikit_learn 5 | sentence_transformers 6 | streamlit 7 | tenacity 8 | tiktoken 9 | semgrep==1.85.0 -------------------------------------------------------------------------------- /6-structured_outputs/node-example/app.js: -------------------------------------------------------------------------------- 1 | import OpenAI from "openai"; 2 | import { zodResponseFormat } from "openai/helpers/zod"; 3 | import { z } from "zod"; 4 | import { INPUT } from "./input.js"; 5 | 6 | const openai = new OpenAI(); 7 | 8 | const paperInformationSchema = z.object({ 9 | title: z.string(), 10 | authors: z.array(z.string()), 11 | abstract_summary: z 12 | .string() 13 | .describe("Summary of the abstract in 1-2 sentences"), 14 | keywords: z.array(z.string()), 15 | key_concepts: z.array( 16 | z.object({ 17 | title: z.string(), 18 | description: z.string(), 19 | importance: z 20 | .enum(["high", "medium", "low"]) 21 | .describe("Importance of the concept in this paper."), 22 | }) 23 | ), 24 | }); 25 | 26 | const SYSTEM_PROMPT = 27 | "You will be provided with a research paper. Your goal is to extract information from this paper in a structured format."; 28 | 29 | const completion = await openai.beta.chat.completions.parse({ 30 | model: "gpt-4o-2024-08-06", 31 | messages: [ 32 | { role: "system", content: SYSTEM_PROMPT }, 33 | { 34 | role: "user", 35 | content: INPUT, 36 | }, 37 | ], 38 | response_format: zodResponseFormat( 39 | paperInformationSchema, 40 | "paper_information" 41 | ), 42 | }); 43 | 44 | const result = completion.choices[0].message.parsed; 45 | console.log(result); 46 | -------------------------------------------------------------------------------- /6-structured_outputs/node-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "so-node-example", 3 | "version": "1.0.0", 4 | "type": "module", 5 | "main": "app.js", 6 | "scripts": { 7 | "start": "node app.js", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "author": "", 11 | "license": "ISC", 12 | "description": "", 13 | "dependencies": { 14 | "openai": "^4.64.0", 15 | "zod": "^3.23.8" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /6-structured_outputs/python-example/data/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/6-structured_outputs/python-example/data/__init__.py -------------------------------------------------------------------------------- /6-structured_outputs/python-example/main.py: -------------------------------------------------------------------------------- 1 | from dataclasses import Field 2 | from enum import Enum 3 | from pydantic import BaseModel 4 | from openai import OpenAI 5 | 6 | from data.input import INPUT 7 | 8 | client = OpenAI() 9 | 10 | class Importance(Enum): 11 | HIGH = 'high' 12 | MEDIUM = 'medium' 13 | LOW = 'low' 14 | 15 | class KeyConcept(BaseModel): 16 | title: str 17 | description: str 18 | importance: Importance 19 | 20 | class PaperInformation(BaseModel): 21 | title: str 22 | authors: list[str] 23 | abstract_summary: str 24 | keywords: list[str] 25 | key_concepts: list[KeyConcept] 26 | 27 | SYSTEM_PROMPT = "You will be provided with a research paper. Your goal is to extract information from this paper in a structured format."; 28 | 29 | completion = client.beta.chat.completions.parse( 30 | model="gpt-4o-2024-08-06", 31 | messages=[ 32 | {"role": "system", "content": SYSTEM_PROMPT}, 33 | {"role": "user", "content": INPUT} 34 | ], 35 | response_format=PaperInformation, 36 | ) 37 | 38 | response = completion.choices[0].message.parsed 39 | print(response) 40 | -------------------------------------------------------------------------------- /6-structured_outputs/python-example/requirements.txt: -------------------------------------------------------------------------------- 1 | annotated-types==0.7.0 2 | anyio==4.6.0 3 | certifi==2024.8.30 4 | distro==1.9.0 5 | h11==0.14.0 6 | httpcore==1.0.5 7 | httpx==0.27.2 8 | idna==3.10 9 | jiter==0.5.0 10 | openai==1.48.0 11 | pydantic==2.9.2 12 | pydantic_core==2.23.4 13 | sniffio==1.3.1 14 | tqdm==4.66.5 15 | typing_extensions==4.12.2 16 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["next/core-web-vitals", "next/typescript"] 3 | } 4 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | .yarn/install-state.gz 8 | 9 | # testing 10 | /coverage 11 | 12 | # next.js 13 | /.next/ 14 | /out/ 15 | 16 | # production 17 | /build 18 | 19 | # misc 20 | .DS_Store 21 | *.pem 22 | 23 | # debug 24 | npm-debug.log* 25 | yarn-debug.log* 26 | yarn-error.log* 27 | 28 | # local env files 29 | .env*.local 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/README.md: -------------------------------------------------------------------------------- 1 | This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). 2 | 3 | ## Getting Started 4 | 5 | First, run the development server: 6 | 7 | ```bash 8 | npm run dev 9 | # or 10 | yarn dev 11 | # or 12 | pnpm dev 13 | # or 14 | bun dev 15 | ``` 16 | 17 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. 18 | 19 | You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. 20 | 21 | This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. 22 | 23 | ## Learn More 24 | 25 | To learn more about Next.js, take a look at the following resources: 26 | 27 | - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. 28 | - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. 29 | 30 | You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! 31 | 32 | ## Deploy on Vercel 33 | 34 | The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. 35 | 36 | Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. 37 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/app/api/assistant/get_products/route.ts: -------------------------------------------------------------------------------- 1 | import { getEntryById } from '../../../../lib/database' 2 | 3 | export async function POST(request: Request) { 4 | try { 5 | const { items } = await request.json() 6 | const cartItems = await Promise.all( 7 | items.map(async (item: { id: string; quantity: number }) => { 8 | console.log('retrieving item', item) 9 | const product = await getEntryById('products', item.id) 10 | console.log('product retrieved', product) 11 | return { item: { ...product }, quantity: item.quantity } 12 | }) 13 | ) 14 | return new Response(JSON.stringify({ cartItems }), { 15 | status: 200 16 | }) 17 | } catch (error) { 18 | console.error(error) 19 | return new Response( 20 | JSON.stringify({ error: 'Failed to find candidates' }), 21 | { 22 | status: 500 23 | } 24 | ) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/app/api/assistant/search_products/route.ts: -------------------------------------------------------------------------------- 1 | import { filterEntries } from '../../../../lib/database' 2 | 3 | export async function POST(request: Request) { 4 | try { 5 | const { color, category, style, limit } = await request.json() 6 | const criteria = [] 7 | 8 | if (color.length > 0) criteria.push({ field: 'color', values: color }) 9 | if (category.length > 0) 10 | criteria.push({ field: 'categories', values: category }) 11 | if (style.length > 0) criteria.push({ field: 'style', values: style }) 12 | 13 | const matches = await filterEntries('products', criteria, limit) 14 | console.log('Matches found', matches) 15 | return new Response(JSON.stringify({ matches }), { 16 | status: 200 17 | }) 18 | } catch (error) { 19 | console.error(error) 20 | return new Response(JSON.stringify({ error: 'Failed to find matches' }), { 21 | status: 500 22 | }) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/app/api/assistant/turn_response/route.ts: -------------------------------------------------------------------------------- 1 | import OpenAI from 'openai' 2 | const openai = new OpenAI() 3 | import { tools } from '../../../../lib/tools' 4 | import { ChatCompletionTool } from 'openai/resources/chat/completions' 5 | 6 | export async function POST(request: Request) { 7 | const { messages } = await request.json() 8 | 9 | try { 10 | const response = await openai.beta.chat.completions.parse({ 11 | model: 'gpt-4o-2024-08-06', 12 | messages, 13 | temperature: 0, 14 | tools: tools as ChatCompletionTool[], 15 | parallel_tool_calls: false 16 | }) 17 | 18 | if (response.choices.length > 0) { 19 | console.log('Response:', response.choices[0].message) 20 | if (response.choices[0].tool_calls) { 21 | console.log('Tool call:', response.choices[0].tool_calls[0].function) 22 | } 23 | return new Response(JSON.stringify(response.choices[0].message), { 24 | status: 200 25 | }) 26 | } 27 | return new Response( 28 | JSON.stringify({ 29 | text: 'I am sorry, there was an error processing your message. Please try again.' 30 | }), 31 | { status: 200 } 32 | ) 33 | } catch (error) { 34 | console.error(error) 35 | return new Response(JSON.stringify(error), { status: 500 }) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/app/api/db/init/route.ts: -------------------------------------------------------------------------------- 1 | import { initDb } from '../../../../lib/database' 2 | 3 | export async function POST() { 4 | console.log('Init DB') 5 | try { 6 | await initDb() 7 | return new Response( 8 | JSON.stringify({ message: 'Database initialized successfully' }), 9 | { 10 | status: 200 11 | } 12 | ) 13 | } catch (error) { 14 | console.error(error) 15 | return new Response( 16 | JSON.stringify({ error: 'Failed to initialize database' }), 17 | { 18 | status: 500 19 | } 20 | ) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/app/api/db/route.ts: -------------------------------------------------------------------------------- 1 | import { listEntries } from '../../../lib/database' 2 | 3 | export async function GET() { 4 | console.log('List all entries in DB') 5 | try { 6 | const entries = await listEntries('candidates') 7 | return new Response(JSON.stringify({ candidates: entries }), { 8 | status: 200 9 | }) 10 | } catch (error) { 11 | console.error(error) 12 | return new Response( 13 | JSON.stringify({ error: 'Failed to list entries database' }), 14 | { 15 | status: 500 16 | } 17 | ) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openai/build-hours/97301b74033ee3c0b629ba1d13e5909e9def87dd/6-structured_outputs/structured-outputs-assistant-final/app/favicon.ico -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from 'next' 2 | import './globals.css' 3 | import { Inter } from 'next/font/google' 4 | const inter = Inter({ subsets: ['latin'] }) 5 | 6 | export const metadata: Metadata = { 7 | title: 'Shopping Assistant', 8 | description: 'Structured Outputs demo' 9 | } 10 | 11 | export default function RootLayout({ 12 | children 13 | }: Readonly<{ 14 | children: React.ReactNode 15 | }>) { 16 | return ( 17 | 18 | 19 |
20 |
{children}
21 |
22 | 23 | 24 | ) 25 | } 26 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/app/page.tsx: -------------------------------------------------------------------------------- 1 | import MainView from '@/components/main-view' 2 | 3 | export default function Home() { 4 | return ( 5 |
6 | 7 |
8 | ) 9 | } 10 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "app/globals.css", 9 | "baseColor": "stone", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils", 16 | "ui": "@/components/ui", 17 | "lib": "@/lib", 18 | "hooks": "@/hooks" 19 | } 20 | } -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/components/main-view.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | import React, { useState } from 'react' 3 | import Cart, { CartItem } from './cart' 4 | import Assistant from './assistant' 5 | 6 | const MainView: React.FC = () => { 7 | const [cartItems, setCart] = useState([]) 8 | 9 | const resetDb = async () => { 10 | try { 11 | const response = await fetch('/api/db/init', { 12 | method: 'POST' 13 | }) 14 | if (response.status === 200) alert('Database has been reset') 15 | else alert('Failed to reset database') 16 | } catch (error) { 17 | console.error('Failed to reset database', error) 18 | alert('Failed to reset database') 19 | } 20 | } 21 | 22 | const resetCart = () => { 23 | setCart([]) 24 | } 25 | 26 | return ( 27 |
28 | 29 | 30 |
31 | ) 32 | } 33 | 34 | export default MainView 35 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/components/message.css: -------------------------------------------------------------------------------- 1 | @keyframes bounce { 2 | 0%, 3 | 80%, 4 | 100% { 5 | transform: scale(0); 6 | } 7 | 40% { 8 | transform: scale(1); 9 | } 10 | } 11 | 12 | .dot { 13 | width: 5px; 14 | height: 5px; 15 | margin: 0 5px; 16 | border-radius: 50%; 17 | display: inline-block; 18 | animation: bounce 1.4s infinite ease-in-out both; 19 | } 20 | 21 | .dot:nth-child(1) { 22 | animation-delay: -0.32s; 23 | } 24 | 25 | .dot:nth-child(2) { 26 | animation-delay: -0.16s; 27 | } 28 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/components/ui/badge.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import { cva, type VariantProps } from "class-variance-authority" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const badgeVariants = cva( 7 | "inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", 8 | { 9 | variants: { 10 | variant: { 11 | default: 12 | "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80", 13 | secondary: 14 | "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", 15 | destructive: 16 | "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80", 17 | outline: "text-foreground", 18 | }, 19 | }, 20 | defaultVariants: { 21 | variant: "default", 22 | }, 23 | } 24 | ) 25 | 26 | export interface BadgeProps 27 | extends React.HTMLAttributes, 28 | VariantProps {} 29 | 30 | function Badge({ className, variant, ...props }: BadgeProps) { 31 | return ( 32 |
33 | ) 34 | } 35 | 36 | export { Badge, badgeVariants } 37 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/components/ui/checkbox.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as React from "react" 4 | import * as CheckboxPrimitive from "@radix-ui/react-checkbox" 5 | import { CheckIcon } from "@radix-ui/react-icons" 6 | 7 | import { cn } from "@/lib/utils" 8 | 9 | const Checkbox = React.forwardRef< 10 | React.ElementRef, 11 | React.ComponentPropsWithoutRef 12 | >(({ className, ...props }, ref) => ( 13 | 21 | 24 | 25 | 26 | 27 | )) 28 | Checkbox.displayName = CheckboxPrimitive.Root.displayName 29 | 30 | export { Checkbox } 31 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/components/ui/input.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "@/lib/utils" 4 | 5 | export interface InputProps 6 | extends React.InputHTMLAttributes {} 7 | 8 | const Input = React.forwardRef( 9 | ({ className, type, ...props }, ref) => { 10 | return ( 11 | 20 | ) 21 | } 22 | ) 23 | Input.displayName = "Input" 24 | 25 | export { Input } 26 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/components/ui/label.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as React from "react" 4 | import * as LabelPrimitive from "@radix-ui/react-label" 5 | import { cva, type VariantProps } from "class-variance-authority" 6 | 7 | import { cn } from "@/lib/utils" 8 | 9 | const labelVariants = cva( 10 | "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" 11 | ) 12 | 13 | const Label = React.forwardRef< 14 | React.ElementRef, 15 | React.ComponentPropsWithoutRef & 16 | VariantProps 17 | >(({ className, ...props }, ref) => ( 18 | 23 | )) 24 | Label.displayName = LabelPrimitive.Root.displayName 25 | 26 | export { Label } 27 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/components/ui/spinner.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | import './spinner.css' 3 | 4 | export function Spinner() { 5 | return ( 6 |
7 |
8 |
9 |
10 | ) 11 | } 12 | -------------------------------------------------------------------------------- /6-structured_outputs/structured-outputs-assistant-final/components/ui/textarea.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | 3 | import { cn } from '@/lib/utils' 4 | 5 | export interface TextareaProps 6 | extends React.TextareaHTMLAttributes { 7 | onKeyDown?: (event: React.KeyboardEvent) => void 8 | } 9 | 10 | const Textarea = React.forwardRef( 11 | ({ className, onKeyDown, ...props }, ref) => { 12 | return ( 13 |