├── .devcontainer ├── Dockerfile ├── devcontainer.json ├── github │ └── devcontainer.json ├── ollama │ └── devcontainer.json └── openai │ └── devcontainer.json ├── .env.sample ├── .env.sample.azure ├── .env.sample.github ├── .env.sample.ollama ├── .env.sample.openai ├── .github ├── CODE_OF_CONDUCT.md ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yaml └── workflows │ ├── python.yaml │ └── test-github-models.yaml ├── .gitignore ├── .pre-commit-config.yaml ├── .vscode └── settings.json ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── azure.yaml ├── chained_calls.py ├── chat.py ├── chat_async.py ├── chat_history.py ├── chat_history_stream.py ├── chat_safety.py ├── chat_stream.py ├── data ├── Aphideater_hoverfly.pdf ├── California_carpenter_bee.pdf ├── Centris_pallida.pdf └── Western_honey_bee.pdf ├── few_shot_examples.py ├── function_calling_basic.py ├── function_calling_call.py ├── function_calling_extended.py ├── function_calling_multiple.py ├── http ├── .env.sample ├── auth.py ├── chat_completion_azure.http ├── chat_completion_ollama.http └── rag_hybrid_azure.http ├── hybrid.csv ├── infra ├── main.bicep ├── main.parameters.json ├── write_dot_env.ps1 └── write_dot_env.sh ├── prompt_engineering.py ├── pyproject.toml ├── rag_csv.py ├── rag_documents_flow.py ├── rag_documents_hybrid.py ├── rag_documents_ingestion.py ├── rag_ingested_chunks.json ├── rag_multiturn.py ├── rag_queryrewrite.py ├── reasoning.py ├── requirements-dev.txt ├── requirements-rag.txt ├── requirements.txt ├── retrieval_augmented_generation.py ├── spanish ├── README.md ├── chained_calls.py ├── chat.py ├── chat_async.py ├── chat_history.py ├── chat_history_stream.py ├── chat_safety.py ├── chat_stream.py ├── data │ ├── Apis_mellifera.pdf │ ├── Centris_pallida.pdf │ ├── Syrphidae.pdf │ └── Xylocopa_californica.pdf ├── few_shot_examples.py ├── function_calling_basic.py ├── function_calling_call.py ├── function_calling_extended.py ├── function_calling_multiple.py ├── hybridos.csv ├── prompt_engineering.py ├── rag_csv.py ├── rag_documents_flow.py ├── rag_documents_hybrid.py ├── rag_documents_ingestion.py ├── rag_ingested_chunks.json ├── rag_multiturn.py ├── rag_queryrewrite.py ├── retrieval_augmented_generation.py ├── structured_outputs_basic.py ├── structured_outputs_description.py ├── structured_outputs_enum.py ├── structured_outputs_function_calling.py └── structured_outputs_nested.py ├── structured_outputs_basic.py ├── structured_outputs_description.py ├── structured_outputs_enum.py ├── structured_outputs_function_calling.py └── structured_outputs_nested.py /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.devcontainer/Dockerfile -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.devcontainer/devcontainer.json -------------------------------------------------------------------------------- /.devcontainer/github/devcontainer.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.devcontainer/github/devcontainer.json -------------------------------------------------------------------------------- /.devcontainer/ollama/devcontainer.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.devcontainer/ollama/devcontainer.json -------------------------------------------------------------------------------- /.devcontainer/openai/devcontainer.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.devcontainer/openai/devcontainer.json -------------------------------------------------------------------------------- /.env.sample: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.env.sample -------------------------------------------------------------------------------- /.env.sample.azure: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.env.sample.azure -------------------------------------------------------------------------------- /.env.sample.github: -------------------------------------------------------------------------------- 1 | # See .env.sample for all options 2 | API_HOST=github 3 | GITHUB_MODEL=gpt-4o 4 | -------------------------------------------------------------------------------- /.env.sample.ollama: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.env.sample.ollama -------------------------------------------------------------------------------- /.env.sample.openai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.env.sample.openai -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.github/CODE_OF_CONDUCT.md -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.github/ISSUE_TEMPLATE.md -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.github/PULL_REQUEST_TEMPLATE.md -------------------------------------------------------------------------------- /.github/dependabot.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.github/dependabot.yaml -------------------------------------------------------------------------------- /.github/workflows/python.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.github/workflows/python.yaml -------------------------------------------------------------------------------- /.github/workflows/test-github-models.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.github/workflows/test-github-models.yaml -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.gitignore -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.pre-commit-config.yaml -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/.vscode/settings.json -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/CONTRIBUTING.md -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/LICENSE.md -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/README.md -------------------------------------------------------------------------------- /azure.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/azure.yaml -------------------------------------------------------------------------------- /chained_calls.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/chained_calls.py -------------------------------------------------------------------------------- /chat.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/chat.py -------------------------------------------------------------------------------- /chat_async.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/chat_async.py -------------------------------------------------------------------------------- /chat_history.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/chat_history.py -------------------------------------------------------------------------------- /chat_history_stream.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/chat_history_stream.py -------------------------------------------------------------------------------- /chat_safety.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/chat_safety.py -------------------------------------------------------------------------------- /chat_stream.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/chat_stream.py -------------------------------------------------------------------------------- /data/Aphideater_hoverfly.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/data/Aphideater_hoverfly.pdf -------------------------------------------------------------------------------- /data/California_carpenter_bee.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/data/California_carpenter_bee.pdf -------------------------------------------------------------------------------- /data/Centris_pallida.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/data/Centris_pallida.pdf -------------------------------------------------------------------------------- /data/Western_honey_bee.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/data/Western_honey_bee.pdf -------------------------------------------------------------------------------- /few_shot_examples.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/few_shot_examples.py -------------------------------------------------------------------------------- /function_calling_basic.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/function_calling_basic.py -------------------------------------------------------------------------------- /function_calling_call.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/function_calling_call.py -------------------------------------------------------------------------------- /function_calling_extended.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/function_calling_extended.py -------------------------------------------------------------------------------- /function_calling_multiple.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/function_calling_multiple.py -------------------------------------------------------------------------------- /http/.env.sample: -------------------------------------------------------------------------------- 1 | SERVICE= 2 | DEPLOYMENT= 3 | TOKEN= 4 | -------------------------------------------------------------------------------- /http/auth.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/http/auth.py -------------------------------------------------------------------------------- /http/chat_completion_azure.http: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/http/chat_completion_azure.http -------------------------------------------------------------------------------- /http/chat_completion_ollama.http: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/http/chat_completion_ollama.http -------------------------------------------------------------------------------- /http/rag_hybrid_azure.http: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/http/rag_hybrid_azure.http -------------------------------------------------------------------------------- /hybrid.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/hybrid.csv -------------------------------------------------------------------------------- /infra/main.bicep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/infra/main.bicep -------------------------------------------------------------------------------- /infra/main.parameters.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/infra/main.parameters.json -------------------------------------------------------------------------------- /infra/write_dot_env.ps1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/infra/write_dot_env.ps1 -------------------------------------------------------------------------------- /infra/write_dot_env.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/infra/write_dot_env.sh -------------------------------------------------------------------------------- /prompt_engineering.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/prompt_engineering.py -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/pyproject.toml -------------------------------------------------------------------------------- /rag_csv.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/rag_csv.py -------------------------------------------------------------------------------- /rag_documents_flow.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/rag_documents_flow.py -------------------------------------------------------------------------------- /rag_documents_hybrid.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/rag_documents_hybrid.py -------------------------------------------------------------------------------- /rag_documents_ingestion.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/rag_documents_ingestion.py -------------------------------------------------------------------------------- /rag_ingested_chunks.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/rag_ingested_chunks.json -------------------------------------------------------------------------------- /rag_multiturn.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/rag_multiturn.py -------------------------------------------------------------------------------- /rag_queryrewrite.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/rag_queryrewrite.py -------------------------------------------------------------------------------- /reasoning.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/reasoning.py -------------------------------------------------------------------------------- /requirements-dev.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/requirements-dev.txt -------------------------------------------------------------------------------- /requirements-rag.txt: -------------------------------------------------------------------------------- 1 | pymupdf4llm 2 | lunr 3 | sentence-transformers 4 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/requirements.txt -------------------------------------------------------------------------------- /retrieval_augmented_generation.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/retrieval_augmented_generation.py -------------------------------------------------------------------------------- /spanish/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/README.md -------------------------------------------------------------------------------- /spanish/chained_calls.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/chained_calls.py -------------------------------------------------------------------------------- /spanish/chat.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/chat.py -------------------------------------------------------------------------------- /spanish/chat_async.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/chat_async.py -------------------------------------------------------------------------------- /spanish/chat_history.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/chat_history.py -------------------------------------------------------------------------------- /spanish/chat_history_stream.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/chat_history_stream.py -------------------------------------------------------------------------------- /spanish/chat_safety.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/chat_safety.py -------------------------------------------------------------------------------- /spanish/chat_stream.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/chat_stream.py -------------------------------------------------------------------------------- /spanish/data/Apis_mellifera.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/data/Apis_mellifera.pdf -------------------------------------------------------------------------------- /spanish/data/Centris_pallida.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/data/Centris_pallida.pdf -------------------------------------------------------------------------------- /spanish/data/Syrphidae.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/data/Syrphidae.pdf -------------------------------------------------------------------------------- /spanish/data/Xylocopa_californica.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/data/Xylocopa_californica.pdf -------------------------------------------------------------------------------- /spanish/few_shot_examples.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/few_shot_examples.py -------------------------------------------------------------------------------- /spanish/function_calling_basic.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/function_calling_basic.py -------------------------------------------------------------------------------- /spanish/function_calling_call.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/function_calling_call.py -------------------------------------------------------------------------------- /spanish/function_calling_extended.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/function_calling_extended.py -------------------------------------------------------------------------------- /spanish/function_calling_multiple.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/function_calling_multiple.py -------------------------------------------------------------------------------- /spanish/hybridos.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/hybridos.csv -------------------------------------------------------------------------------- /spanish/prompt_engineering.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/prompt_engineering.py -------------------------------------------------------------------------------- /spanish/rag_csv.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/rag_csv.py -------------------------------------------------------------------------------- /spanish/rag_documents_flow.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/rag_documents_flow.py -------------------------------------------------------------------------------- /spanish/rag_documents_hybrid.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/rag_documents_hybrid.py -------------------------------------------------------------------------------- /spanish/rag_documents_ingestion.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/rag_documents_ingestion.py -------------------------------------------------------------------------------- /spanish/rag_ingested_chunks.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/rag_ingested_chunks.json -------------------------------------------------------------------------------- /spanish/rag_multiturn.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/rag_multiturn.py -------------------------------------------------------------------------------- /spanish/rag_queryrewrite.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/rag_queryrewrite.py -------------------------------------------------------------------------------- /spanish/retrieval_augmented_generation.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/retrieval_augmented_generation.py -------------------------------------------------------------------------------- /spanish/structured_outputs_basic.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/structured_outputs_basic.py -------------------------------------------------------------------------------- /spanish/structured_outputs_description.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/structured_outputs_description.py -------------------------------------------------------------------------------- /spanish/structured_outputs_enum.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/structured_outputs_enum.py -------------------------------------------------------------------------------- /spanish/structured_outputs_function_calling.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/structured_outputs_function_calling.py -------------------------------------------------------------------------------- /spanish/structured_outputs_nested.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/spanish/structured_outputs_nested.py -------------------------------------------------------------------------------- /structured_outputs_basic.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/structured_outputs_basic.py -------------------------------------------------------------------------------- /structured_outputs_description.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/structured_outputs_description.py -------------------------------------------------------------------------------- /structured_outputs_enum.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/structured_outputs_enum.py -------------------------------------------------------------------------------- /structured_outputs_function_calling.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/structured_outputs_function_calling.py -------------------------------------------------------------------------------- /structured_outputs_nested.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pamelafox/python-openai-demos/HEAD/structured_outputs_nested.py --------------------------------------------------------------------------------