Skip to content

Commit 2f2983c

Browse files
committed
Introduced AWS Docs profile with Claude 3.5 Sonnet LLM and Bedrock-Anthropic profile updates to reduce context window, disable function/vision support and modify pip package and environment variables.
1 parent dbc5259 commit 2f2983c

File tree

2 files changed

+78
-6
lines changed

2 files changed

+78
-6
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
"""
2+
This is an Open Interpreter profile. It is specialized for searching AWS documentation and is configured to run Anthropic's `Claude 3.5 Sonnet`.
3+
"""
4+
5+
# Configure Open Interpreter
6+
from interpreter import interpreter
7+
8+
interpreter.llm.model = "claude-3-5-sonnet-20240620"
9+
interpreter.computer.import_computer_api = True
10+
interpreter.llm.supports_functions = True
11+
interpreter.llm.supports_vision = True
12+
interpreter.llm.context_window = 100000
13+
interpreter.llm.max_tokens = 4096
14+
15+
AWS_DOCS_SEARCH_URL = "https://docs.aws.amazon.com/search/doc-search.html?searchPath=documentation&searchQuery=<query>"
16+
17+
custom_tool = """
18+
19+
import os
20+
import requests
21+
22+
def search_aws_docs(query):
23+
24+
url = "https://api.perplexity.ai/chat/completions"
25+
26+
payload = {
27+
"model": "llama-3.1-sonar-small-128k-online",
28+
"messages": [
29+
{
30+
"role": "system",
31+
"content": "Be precise and concise."
32+
},
33+
{
34+
"role": "user",
35+
"content": query
36+
}
37+
],
38+
"temperature": 0.2,
39+
"top_p": 0.9,
40+
"return_citations": True,
41+
"search_domain_filter": ["docs.aws.amazon.com"],
42+
"return_images": False,
43+
"return_related_questions": False,
44+
#"search_recency_filter": "month",
45+
"top_k": 0,
46+
"stream": False,
47+
"presence_penalty": 0,
48+
"frequency_penalty": 1
49+
}
50+
headers = {
51+
"Authorization": f"Bearer {os.environ.get('PPLX_API_KEY')}",
52+
"Content-Type": "application/json"
53+
}
54+
55+
response = requests.request("POST", url, json=payload, headers=headers)
56+
57+
print(response.text)
58+
59+
return response.text
60+
61+
"""
62+
63+
64+
interpreter.computer.run("python", custom_tool)
65+
66+
interpreter.custom_instructions = f"""
67+
You have access to a special function imported inside your python environment, to be executed in python, called `search_aws_docs(query)` which lets you search the AWS docs.
68+
Use it frequently to ground your usage of AWS products.
69+
Use it often!
70+
71+
If the user wants you to open the docs, open their browser to the URL: {AWS_DOCS_SEARCH_URL}
72+
"""

interpreter/terminal_interface/profiles/defaults/bedrock-anthropic.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"""
44

55
"""
6-
Required pip package:
7-
pip install boto3>=1.28.57
6+
Recommended pip package:
7+
pip install boto3
88
9-
Required environment variables:
9+
Recommended environment variables:
1010
os.environ["AWS_ACCESS_KEY_ID"] = "" # Access key
1111
os.environ["AWS_SECRET_ACCESS_KEY"] = "" # Secret access key
1212
os.environ["AWS_REGION_NAME"] = "" # us-east-1, us-east-2, us-west-1, us-west-2
@@ -20,7 +20,7 @@
2020

2121
interpreter.computer.import_computer_api = True
2222

23-
interpreter.llm.supports_functions = True
24-
interpreter.llm.supports_vision = True
25-
interpreter.llm.context_window = 100000
23+
interpreter.llm.supports_functions = False
24+
interpreter.llm.supports_vision = False
25+
interpreter.llm.context_window = 10000
2626
interpreter.llm.max_tokens = 4096

0 commit comments

Comments
 (0)