@@ -36,9 +36,9 @@ class DaggerHackathon:
3636 github_branch : str
3737 github_repo : str
3838 github_token : dagger .Secret
39- azure_api_key : dagger .Secret
40- azure_endpoint : str
41- azure_model : str = "gpt-4o"
39+ azure_openai_api_key : dagger .Secret # use in azure_xxx in StructureLlmResponse with AzureOpenAI library
40+ azure_openai_endpoint : str
41+ azure_openai_model : str = "gpt-4o"
4242 @function
4343 async def GetPrMetadata (self ) -> PrMetadataResult :
4444 """Get the PR number and commit ID
@@ -129,19 +129,18 @@ async def StructureLlmResponse(
129129 command_to_execute = [
130130 "python" , "dagger-hackathon-pipeline/src/dagger_hackathon/structure_llm_response.py" ,
131131 "--response" , response_to_structure ,
132- "--endpoint" , self .azure_endpoint ,
133- "--model" , self .azure_model
132+ "--endpoint" , self .azure_openai_endpoint ,
133+ "--model" , self .azure_openai_model
134134 ]
135135 container = (
136136 dag .container ()
137137 .from_ ("python:3.11" )
138138 .with_mounted_directory ("/app" , self .source )
139139 .with_workdir ("/app" )
140- .with_secret_variable ("AZURE_OPENAI_API_KEY" , self .azure_api_key )
140+ .with_secret_variable ("AZURE_OPENAI_API_KEY" , self .azure_openai_api_key )
141141 .with_exec (["pip" , "install" , "--upgrade" , "pip" ])
142142 .with_exec (["pip" , "install" , "openai==1.82.0" , "pydantic==2.11.5" ])
143143 .with_exec (["sh" , "-c" , "export $(grep -v '^#' .env | xargs)" ])
144- .with_exec (["sh" , "-c" , "echo $OPENAI_API_KEY" ])
145144 .with_exec (command_to_execute )
146145 )
147146
@@ -174,7 +173,7 @@ async def CreatePrSuggestion(
174173 "--method" , "POST" ,
175174 "-H" , "Accept: application/vnd.github+json" ,
176175 "-H" , "X-GitHub-Api-Version: 2022-11-28" ,
177- f"/repos/codetocloudorg/platform-engineering /pulls/{ pr_metadata .pr_number } /comments" ,
176+ f"/repos/{ self . github_repo } /pulls/{ pr_metadata .pr_number } /comments" ,
178177 "-f" , f"body=```suggestion\n { proposed_code_changes .change } \n ```" ,
179178 "-f" , f"commit_id={ pr_metadata .commit_id } " ,
180179 "-f" , f"path={ proposed_code_changes .path } " ,
@@ -244,8 +243,6 @@ async def FixMyTestsAgent(
244243 .with_prompt_file (dag .current_module ().source ().file ("debug_unit_test_prompt.md" ))
245244 )
246245
247- analyzed_results_output = await analyze_results .last_reply ()
248-
249246 proposed_code_change = await self .StructureLlmResponse (
250247 await analyze_results .last_reply ()
251248 )
@@ -259,4 +256,4 @@ async def FixMyTestsAgent(
259256 pr_metadata = pr_metadata ,
260257 pr_suggestions = created_pr_suggestion
261258 ))
262-
259+
0 commit comments