Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS Profiles #1463

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions interpreter/terminal_interface/profiles/defaults/aws-docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
"""
This is an Open Interpreter profile. It is specialized for searching AWS documentation and is configured to run Anthropic's `Claude 3.5 Sonnet`.
"""

# Configure Open Interpreter
from interpreter import interpreter

interpreter.llm.model = "claude-3-5-sonnet-20240620"
interpreter.computer.import_computer_api = True
interpreter.llm.supports_functions = True
interpreter.llm.supports_vision = True
interpreter.llm.context_window = 100000
interpreter.llm.max_tokens = 4096

AWS_DOCS_SEARCH_URL = "https://docs.aws.amazon.com/search/doc-search.html?searchPath=documentation&searchQuery=<query>"

custom_tool = """

import os
import requests

def search_aws_docs(query):

url = "https://api.perplexity.ai/chat/completions"

payload = {
"model": "llama-3.1-sonar-small-128k-online",
"messages": [
{
"role": "system",
"content": "Be precise and concise."
},
{
"role": "user",
"content": query
}
],
"temperature": 0.2,
"top_p": 0.9,
"return_citations": True,
"search_domain_filter": ["docs.aws.amazon.com"],
"return_images": False,
"return_related_questions": False,
#"search_recency_filter": "month",
"top_k": 0,
"stream": False,
"presence_penalty": 0,
"frequency_penalty": 1
}
headers = {
"Authorization": f"Bearer {os.environ.get('PPLX_API_KEY')}",
"Content-Type": "application/json"
}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)

return response.text

"""


interpreter.computer.run("python", custom_tool)

interpreter.custom_instructions = f"""
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.
Use it frequently to ground your usage of AWS products.
Use it often!

If the user wants you to open the docs, open their browser to the URL: {AWS_DOCS_SEARCH_URL}
"""
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"""

"""
Required pip package:
pip install boto3>=1.28.57
Recommended pip package:
pip install boto3

Required environment variables:
Recommended environment variables:
os.environ["AWS_ACCESS_KEY_ID"] = "" # Access key
os.environ["AWS_SECRET_ACCESS_KEY"] = "" # Secret access key
os.environ["AWS_REGION_NAME"] = "" # us-east-1, us-east-2, us-west-1, us-west-2
Expand All @@ -20,7 +20,7 @@

interpreter.computer.import_computer_api = True

interpreter.llm.supports_functions = True
interpreter.llm.supports_vision = True
interpreter.llm.context_window = 100000
interpreter.llm.supports_functions = False
interpreter.llm.supports_vision = False
interpreter.llm.context_window = 10000
interpreter.llm.max_tokens = 4096
Loading