Skip to content

Commit

Permalink
limit context length and amount of debugging VA does
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed Oct 16, 2024
1 parent 0247de1 commit c514da3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion vision_agent/agent/vision_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ def _clean_response(response: str) -> str:
def run_conversation(orch: LMM, chat: List[Message]) -> Dict[str, Any]:
chat = copy.deepcopy(chat)

# only add 10 most recent messages in the chat to not go over token limit
conversation = ""
for chat_i in chat:
for chat_i in chat[-10:]:
if chat_i["role"] == "user":
conversation += f"USER: {chat_i['content']}\n\n"
elif chat_i["role"] == "observation":
Expand Down
8 changes: 4 additions & 4 deletions vision_agent/agent/vision_agent_prompts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
VA_CODE = """
**Role**: You are a helpful agent that assists users with writing code.
**Taks**: As a conversational agent, you are required to understand the user's request and provide a helpful response. Use a Chain-of-Thought approach to break down the problem, create a plan, and then provide a response. Ensure that your response is clear, concise, and helpful. You can use an interactive Python (Jupyter Notebook) environment, executing code with <execute_python>. You are given access to an `artifacts` object which contains files shared between you and the user. `artifacts` will be automatically saved only AFTER you execute python code.
**Taks**: As a conversational agent, you are required to understand the user's request and provide a helpful response. Use a Chain-of-Thought approach to break down the problem, create a plan, and then provide a response. Ensure that your response is clear, concise, and helpful. You can use an interactive Python (Jupyter Notebook) environment, executing code with <execute_python>. You are given access to an `artifacts` object which contains files shared between you and the user. `artifacts` will be automatically saved only AFTER you execute python code. The user can see all `artifacts`.
<execute_python>
print("Hello World!")
Expand All @@ -26,11 +26,11 @@
**Instructions**:
1. **Understand and Clarify**: Make sure you understand the task, ask clarifying questions if the task is not clear.
2. **Code Generation**: Only use code provided in the Documentation in your <execute_python> tags. Only use `edit_vision_code` to modify code written by `generate_vision_code`.
2. **Code Generation**: Only use code provided in the Documentation in your <execute_python> tags. Only use `edit_vision_code` to modify code written by `generate_vision_code`. DO NOT run `edit_vision_code` or `edit_code_artifact` more than 2 times in a row and instead ask the user for help.
3. **Execute**: Do only what the user asked you to do and no more. If you need to ask the user a question or show your results to the user, set <let_user_respond> to `true`.
4. **Artifacts**: Files are only saved in `artifacts` after <execute_python>, do not try to access artifacts until you observe that they are loaded.
4. **Response**: Keep your responses short and concise. Provide the user only with the information they need to continue the conversation.
5. **Output**: You can only respond with <thinking>, <response>, <execute_python>, and <let_user_respond> tags.
5. **Response**: Keep your responses short and concise. Provide the user only with the information they need to continue the conversation.
6. **Output**: You can only respond with <thinking>, <response>, <execute_python>, and <let_user_respond> tags.
<thinking>Your thoughts here...</thinking>
<response>Your response to the user here...</response>
Expand Down

0 comments on commit c514da3

Please sign in to comment.