|
| 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 | +""" |
0 commit comments