In the previous article, we introduced that AutoCoder can simultaneously view source code, read documentation, and finally iterate the code according to your needs.
In fact, this document has two possibilities:
-
Interface or SDK documentation
-
Some design ideas
Usually for interface or SDK documentation, it is okay to specify through the urls parameter, and AutoCoder >= 0.1.18 also supports specifying local files, as well as supporting PDF, Word, and other documents.
However, if you want AutoCoder to use a search engine to find some ideas, it is also possible. To enable the search engine capability, you need to do two things:
- Apply for a Google or Bing search API Token
- Include two parameters in the AutoCoder parameters
First is to apply for an API Token, we recommend Bing, you can visit here: https://www.microsoft.com/en-us/bing/apis/bing-web-search-api to get the token.
Next is to enable the search function:
source_dir: /tmp/t-py
target_file: /home/winubuntu/projects/ByzerRawCopilot/output.txt
model: qianwen_chat
model_max_length: 2000
model_max_input_length: 100000
anti_quota_limit: 5
search_engine: bing
search_engine_token: ENV {{BING_SEARCH_TOKEN}}
## execute the prompt generated by auto-coder
execute: true
## extract the code from the prompt generated by auto-coder
## and overwrite the source code
auto_merge: true
project_type: py
human_as_model: true
query: >
Modify server.py, add ray initialization connection code after the code app = FastAPI().
Here, we can see the search_engine and search_engine_token parameters. When you use ENV {{BING_SEARCH_TOKEN}}, AutoCoder will find the value of BING_SEARCH_TOKEN in your environment variables. If you are not using environment variables, you can directly copy your token to replace "ENV {{BING_SEARCH_TOKEN}}".
Note that AutoCoder requires you to configure the Model to take effect. In addition, AutoCoder will also use large models to filter the search results, and in the end, there may not be a suitable one, in which case the search content will not affect the subsequent code generation.
If you know your search term clearly, you can directly solve it with a parameter:
search: How to use FastAPI
search_engine: bing
search_engine_token: ENV {{BING_SEARCH_TOKEN}}