MCPcopy Create free account
hub / github.com/AmberSahdev/Open-Interface / get_instructions_for_objective

Method get_instructions_for_objective

app/models/gemini.py:20–34  ·  view source on GitHub ↗
(self, original_user_request: str, step_num: int = 0)

Source from the content-addressed store, hash-verified

18 os.environ['GEMINI_API_KEY'] = api_key
19
20 def get_instructions_for_objective(self, original_user_request: str, step_num: int = 0) -> dict[str, Any]:
21 safety_settings = [
22 types.SafetySetting(category=category.value, threshold="BLOCK_NONE")
23 for category in types.HarmCategory
24 if category.value != 'HARM_CATEGORY_UNSPECIFIED'
25 ]
26 message_content = self.format_user_request_for_llm(original_user_request, step_num)
27
28 llm_response = self.client.models.generate_content(
29 model=self.model_name,
30 contents=message_content,
31 config=types.GenerateContentConfig(safety_settings=safety_settings),
32 )
33 json_instructions: dict[str, Any] = self.convert_llm_response_to_json_instructions(llm_response)
34 return json_instructions
35
36 def format_user_request_for_llm(self, original_user_request, step_num) -> list[Any]:
37 base64_img: str = Screen().get_screenshot_in_base64()

Callers

nothing calls this directly

Tested by

no test coverage detected