-
Notifications
You must be signed in to change notification settings - Fork 5
[DRAFT] Dev/OpenAI #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ygefen
wants to merge
18
commits into
main
Choose a base branch
from
dev/openai
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[DRAFT] Dev/OpenAI #263
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
154b8c6
Adds openai and httpx dependencies
bfcaac0
Initial basic implemetation for discussion
5c16452
Fixes abstract class signature
a181403
Some fixes that address the PR
f77d942
Removes TODO comment
4f52aab
Implements cache_repr and removes unused constructor argument inferen…
a147b9f
Fixes assignemnt of undeclared variable
37cbfc1
Fixes undeclared variable
04c2caa
Cleans up object attributes
8eabfa1
Implements run_inference_unstructured
9f41886
Removes optional config
658c2b4
sync mode working
7943017
Fixes handling of single prompt wrapped in list for sync responses
3bab0fd
Refactors Batches and Responses API
e10d688
Adds openai full run config
94aba33
Cleans up OpenAIInfrenceEngine and configs
cec7903
Switches from poetry to uv
2260e25
Minor fixes for unstructured output, not sure if we want to merge this
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # @package _global_ | ||
| defaults: | ||
| - override /adm: pipeline_baseline | ||
| - override /interface: ta3 | ||
| - override /inference_engine@adm.structured_inference_engine: openai_gpt5 | ||
|
|
||
| interface: | ||
| session_type: adept | ||
| training_session: full | ||
| username: "testrun-pipeline_baseline" | ||
| domain: "p2triage" | ||
|
|
||
| adm: | ||
| step_definitions: | ||
| outlines_baseline: | ||
| scenario_description_template: | ||
| _target_: align_system.prompt_engineering.outlines_prompts.Phase2ScenarioDescription | ||
| prompt_template: | ||
| _target_: align_system.prompt_engineering.outlines_prompts.Phase2BaselinePrompt | ||
|
|
||
| enable_caching: true | ||
|
|
||
| instance: | ||
| steps: | ||
| # Reference the step instances we want to use in order | ||
| - ${ref:adm.step_definitions.format_choices} | ||
| - ${ref:adm.step_definitions.outlines_baseline} | ||
| # - ${ref:adm.step_definitions.action_parameter_completion} | ||
| - ${ref:adm.step_definitions.ensure_chosen_action} | ||
| - ${ref:adm.step_definitions.populate_choice_info} | ||
|
|
||
| driver: | ||
| apply_action_filtering: false | ||
|
|
||
| force_determinism: true | ||
| align_to_target: false |
34 changes: 34 additions & 0 deletions
34
align_system/configs/experiment/openai_api/comparative_regression.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # @package _global_ | ||
| defaults: | ||
| - override /adm: phase2_pipeline_fewshot_comparative_regression | ||
| - override /interface: ta3 | ||
| - override /adm_component/alignment@adm.step_definitions.scalar_alignment: random_effects_tuple | ||
| - override /inference_engine@adm.structured_inference_engine: openai_gpt5 | ||
|
|
||
| interface: | ||
| session_type: adept | ||
| training_session: full | ||
| username: "testrun-pipeline_fewshot_comp_reg_loo" | ||
| domain: "p2triage" | ||
|
|
||
| adm: | ||
| step_definitions: | ||
| regression_icl: | ||
| icl_generator_partial: | ||
| incontext_settings: | ||
| number: 20 | ||
| leave_one_out_strategy: 'scenario_description' # LOO - Remove for eval | ||
| datasets: | ||
| medical: /data/shared/samba/phase2_icl/Feb2026-MU-train_20251218.json | ||
| affiliation: /data/shared/samba/phase2_icl/Feb2026-AF-train_20251218.json | ||
| merit: /data/shared/samba/phase2_icl/Feb2026-MF-train_20251218.json | ||
| personal_safety: /data/shared/samba/phase2_icl/Feb2026-PS-train_20251218.json | ||
| search: /data/shared/samba/phase2_icl/Feb2026-SS-train_20251218.json | ||
| comparative_regression: | ||
| enable_caching: true | ||
|
|
||
| driver: | ||
| apply_action_filtering: false | ||
|
|
||
| force_determinism: true | ||
| align_to_target: true |
17 changes: 17 additions & 0 deletions
17
align_system/configs/experiment/openai_api/direct_regression_test.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # @package _global_ | ||
| defaults: | ||
| - /alignment_target: "june2025/ADEPT-June2025-affiliation-1.0.yaml" | ||
| - override /adm: phase2_pipeline_direct_regression | ||
| - override /adm_component/alignment@adm.step_definitions.scalar_alignment: medical_urgency_weighted_scalar | ||
| - override /inference_engine@adm.structured_inference_engine: openai_gpt5 | ||
| - override /interface: input_output_file | ||
|
|
||
| interface: | ||
| state_hydration_domain: "p2triage" | ||
| input_output_filepath: ${test_data_dir}/July2025-AF-train_20250804_timing_subsample.json | ||
|
|
||
| driver: | ||
| apply_action_filtering: false | ||
|
|
||
| force_determinism: true | ||
| align_to_target: true |
23 changes: 23 additions & 0 deletions
23
align_system/configs/experiment/openai_api/full_train_run.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # @package _global_ | ||
| defaults: | ||
| - override /adm: phase2_pipeline_direct_regression | ||
| - override /interface: ta3 | ||
| - override /adm_component/alignment@adm.step_definitions.scalar_alignment: random_effects_tuple | ||
| - override /inference_engine@adm.structured_inference_engine: openai_gpt5 | ||
|
|
||
| interface: | ||
| session_type: adept | ||
| training_session: full | ||
| username: "testrun-pipeline_direct" | ||
| domain: "p2triage" | ||
|
|
||
| adm: | ||
| step_definitions: | ||
| direct_regression: | ||
| enable_caching: true | ||
|
|
||
| driver: | ||
| apply_action_filtering: false | ||
|
|
||
| force_determinism: true | ||
| align_to_target: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| _target_: align_system.algorithms.openai_inference_engine.OpenAIInferenceEngine | ||
|
|
||
| # https://github.com/openai/openai-python/blob/main/src/openai/_client.py#L99 | ||
| model_name: gpt-4o | ||
| temperature: 0.7 | ||
| top_p: 0.9 | ||
| max_tokens: 4096 | ||
|
|
||
| # Optional kwargs | ||
| base_url: null # Set to null for OpenAI cloud | ||
| api_key: null # Reads from OPENAI_API_KEY env var if null | ||
| organization: null # Reads from OPENAI_ORG_ID env var if null | ||
| project: null # Reads from OPENAI_PROJECT_ID env var if null | ||
| webhook_secret: null # Reads from OPENAI_WEBHOOK_SECRET env var if null | ||
| timeout: "NOT_GIVEN" | ||
| # Optional unstable kwargs | ||
ygefen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| _strict_response_validation: True | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| _target_: align_system.algorithms.openai_inference_engine.OpenAIInferenceEngine | ||
|
|
||
| # https://github.com/openai/openai-python/blob/main/src/openai/_client.py#L99 | ||
| model_name: gpt-5.2 | ||
| temperature: 0.7 | ||
| top_p: 0.9 | ||
| max_tokens: 4096 | ||
|
|
||
| # Optional kwargs | ||
| base_url: null # Set to null for OpenAI cloud | ||
| api_key: null # Reads from OPENAI_API_KEY env var if null | ||
| timeout: "NOT_GIVEN" | ||
| # Optional unstable kwargs | ||
| _strict_response_validation: True |
7 changes: 7 additions & 0 deletions
7
align_system/configs/inference_engine/vllm_openai_llama3.yaml
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So you were able to successfully run against a local vLLM instance with this config (and the openai api inference code?) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| _target_: align_system.algorithms.openai_inference_engine.OpenAIInferenceEngine | ||
|
|
||
| model_name: meta-llama/Llama-3.1-8B-Instruct | ||
| base_url: http://localhost:8000/v1 | ||
| temperature: 0.3 | ||
| top_p: 0.9 | ||
| max_tokens: 4096 |
ygefen marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.