Skip to content

Commit

Permalink
chore: Minor edits to prompts.
Browse files Browse the repository at this point in the history
  • Loading branch information
anirbanbasu committed Aug 20, 2024
1 parent 8ae240f commit a017141
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
13 changes: 7 additions & 6 deletions src/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,19 @@ def retrieve_examples(self, state: AgentState, config: RunnableConfig) -> dict:
ai_message: AIMessage = state[constants.AGENT_STATE__KEY_CANDIDATE]
if not ai_message.tool_calls:
# We err here. To make more robust, you could loop back
raise ValueError("Draft agent did not produce a valid code block")
code = ai_message.tool_calls[0]["args"][
raise ValueError("Solver agent did not produce a valid code block")
code = ai_message.tool_calls[0][constants.AGENT_TOOL_CALL__ARGS][
constants.PYDANTIC_MODEL__CODE_OUTPUT__CODE
]
examples_str = "\n".join(
[doc.page_content for doc in self._retriever.invoke(code)[:top_k]]
)
examples_str = f"""
Here are some example solutions of similar problems.
<Examples>
[BEGIN EXAMPLES]
{examples_str}
<Examples>
Approach this new question with similar sophistication."""
[END EXAMPLES]
Approach the given problem with similar sophistication."""

return {constants.AGENT_STATE__KEY_EXAMPLES: examples_str}

Expand Down Expand Up @@ -232,8 +232,9 @@ def extract_dictionary_from_ai_message(
Returns:
dict: The extracted dictionary.
"""
# FIXME: Why are there more than one tool calls to the same tool?
# FIXME: Why are there more than one tool calls, one to a function (which one?) and another for the Pydantic model?
result: dict = None
ic(ai_message)
if ai_message.tool_calls:
if match_tool_call_name is None or (
match_tool_call_name is not None
Expand Down
3 changes: 0 additions & 3 deletions src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@
Make your Python code executable from the command line. Your code must accept all its inputs from `sys.stdin` and print the final output to `sys.stdout`.
Please format your response as a JSON dictionary, using `reasoning`, `pseudocode`, and `code` as keys.
You may be provided below with examples of similar problems and solutions (may not be in Python).
[BEGIN EXAMPLES]
{examples}
[END EXAMPLES]
The problem is given below.
"""
Expand Down

0 comments on commit a017141

Please sign in to comment.