From 9effc1f4e054ad357e67a62dcde0cd38445fb4c0 Mon Sep 17 00:00:00 2001 From: Dillon Laird Date: Mon, 22 Apr 2024 14:38:41 -0700 Subject: [PATCH] updated readme --- README.md | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 741b8ff2..3daa36ef 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ pip install vision-agent ``` Ensure you have an OpenAI API key and set it as an environment variable (if you are -using Azure OpenAI please see the additional setup section): +using Azure OpenAI please see the Azure setup section): ```bash export OPENAI_API_KEY="your-api-key" @@ -96,6 +96,31 @@ you. For example: }] ``` +#### Custom Tools +You can also add your own custom tools for your vision agent to use: + +```python +>>> from vision_agent.tools import Tool, register_tool +>>> @register_tool +>>> class NumItems(Tool): +>>> name = "num_items_" +>>> description = "Returns the number of items in a list." +>>> usage = { +>>> "required_parameters": [{"name": "prompt", "type": "list"}], +>>> "examples": [ +>>> { +>>> "scenario": "How many items are in this list? ['a', 'b', 'c']", +>>> "parameters": {"prompt": "['a', 'b', 'c']"}, +>>> } +>>> ], +>>> } +>>> def __call__(self, prompt: str) -> int: +>>> return len(prompt) +``` +This will register it with the list of tools Vision Agent has access to. It will be able +to pick it based on the tool description and use it based on the usage provided. + +#### Tool List | Tool | Description | | --- | --- | | CLIP | CLIP is a tool that can classify or tag any image given a set of input classes or tags. | @@ -112,7 +137,7 @@ you. For example: It also has a basic set of calculate tools such as add, subtract, multiply and divide. -### Additional Setup +### Azure Setup If you want to use Azure OpenAI models, you can set the environment variable: ```bash