-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
180 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# This workflow will build a .NET project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | ||
|
||
name: dotnet-release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- dotnet/release | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build: | ||
name: Build and release | ||
runs-on: ubuntu-latest | ||
environment: dotnet | ||
defaults: | ||
run: | ||
working-directory: dotnet | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
global-json-file: dotnet/global.json | ||
- name: Restore dependencies | ||
run: | | ||
dotnet restore -bl | ||
- name: Build | ||
run: | | ||
echo "Build AutoGen" | ||
dotnet build --no-restore --configuration Release -bl /p:SignAssembly=true | ||
- name: Unit Test | ||
run: dotnet test --no-build -bl --configuration Release | ||
env: | ||
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} | ||
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }} | ||
AZURE_GPT_35_MODEL_ID: ${{ secrets.AZURE_GPT_35_MODEL_ID }} | ||
OEPNAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
- name: Pack | ||
run: | | ||
echo "Create release build package" | ||
dotnet pack --no-build --configuration Release --output './output/release' -bl | ||
echo "ls output directory" | ||
ls -R ./output | ||
- name: Publish package to Nuget | ||
run: | | ||
echo "Publish package to Nuget" | ||
echo "ls output directory" | ||
ls -R ./output/release | ||
dotnet nuget push --api-key AzureArtifacts ./output/release/*.nupkg --skip-duplicate --api-key ${{ secrets.AUTOGEN_NUGET_API_KEY }} | ||
- name: Tag commit | ||
run: | | ||
Write-Host "Tag commit" | ||
# version = eng/MetaInfo.props.Project.PropertyGroup.VersionPrefix | ||
$metaInfoContent = cat ./eng/MetaInfo.props | ||
$version = $metaInfoContent | Select-String -Pattern "<VersionPrefix>(.*)</VersionPrefix>" | ForEach-Object { $_.Matches.Groups[1].Value } | ||
git tag -a "$version" -m "AutoGen.Net release $version" | ||
git push origin --tags | ||
shell: pwsh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,5 +178,7 @@ test/agentchat/test_agent_scripts/* | |
|
||
# test cache | ||
.cache_test | ||
.db | ||
|
||
|
||
notebook/result.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Retrieval Augmentation | ||
|
||
Retrieval Augmented Generation (RAG) is a powerful technique that combines language models with external knowledge retrieval to improve the quality and relevance of generated responses. | ||
|
||
One way to realize RAG in AutoGen is to construct agent chats with `RetrieveAssistantAgent` and `RetrieveUserProxyAgent` classes. | ||
|
||
## Example Setup: RAG with Retrieval Augmented Agents | ||
The following is an example setup demonstrating how to create retrieval augmented agents in AutoGen: | ||
|
||
### Step 1. Create an instance of `RetrieveAssistantAgent` and `RetrieveUserProxyAgent`. | ||
|
||
Here `RetrieveUserProxyAgent` instance acts as a proxy agent that retrieves relevant information based on the user's input. | ||
```python | ||
assistant = RetrieveAssistantAgent( | ||
name="assistant", | ||
system_message="You are a helpful assistant.", | ||
llm_config={ | ||
"timeout": 600, | ||
"cache_seed": 42, | ||
"config_list": config_list, | ||
}, | ||
) | ||
ragproxyagent = RetrieveUserProxyAgent( | ||
name="ragproxyagent", | ||
human_input_mode="NEVER", | ||
max_consecutive_auto_reply=3, | ||
retrieve_config={ | ||
"task": "code", | ||
"docs_path": [ | ||
"https://raw.githubusercontent.com/microsoft/FLAML/main/website/docs/Examples/Integrate%20-%20Spark.md", | ||
"https://raw.githubusercontent.com/microsoft/FLAML/main/website/docs/Research.md", | ||
os.path.join(os.path.abspath(""), "..", "website", "docs"), | ||
], | ||
"custom_text_types": ["mdx"], | ||
"chunk_token_size": 2000, | ||
"model": config_list[0]["model"], | ||
"client": chromadb.PersistentClient(path="/tmp/chromadb"), | ||
"embedding_model": "all-mpnet-base-v2", | ||
"get_or_create": True, # set to False if you don't want to reuse an existing collection, but you'll need to remove the collection manually | ||
}, | ||
code_execution_config=False, # set to False if you don't want to execute the code | ||
) | ||
``` | ||
|
||
### Step 2. Initiating Agent Chat with Retrieval Augmentation | ||
|
||
Once the retrieval augmented agents are set up, you can initiate a chat with retrieval augmentation using the following code: | ||
|
||
```python | ||
code_problem = "How can I use FLAML to perform a classification task and use spark to do parallel training. Train 30 seconds and force cancel jobs if time limit is reached." | ||
ragproxyagent.initiate_chat( | ||
assistant, message=ragproxyagent.message_generator, problem=code_problem, search_string="spark" | ||
) # search_string is used as an extra filter for the embeddings search, in this case, we only want to search documents that contain "spark". | ||
``` | ||
|
||
## Online Demo | ||
[Retrival-Augmented Chat Demo on Huggingface](https://huggingface.co/spaces/thinkall/autogen-demos) | ||
|
||
## More Examples and Notebooks | ||
For more detailed examples and notebooks showcasing the usage of retrieval augmented agents in AutoGen, refer to the following: | ||
- Automated Code Generation and Question Answering with Retrieval Augmented Agents - [View Notebook](/docs/notebooks/agentchat_RetrieveChat) | ||
- Automated Code Generation and Question Answering with [Qdrant](https://qdrant.tech/) based Retrieval Augmented Agents - [View Notebook](https://github.com/microsoft/autogen/blob/main/notebook/agentchat_qdrant_RetrieveChat.ipynb) | ||
- Chat with OpenAI Assistant with Retrieval Augmentation - [View Notebook](https://github.com/microsoft/autogen/blob/main/notebook/agentchat_oai_assistant_retrieval.ipynb) | ||
- **RAG**: Group Chat with Retrieval Augmented Generation (with 5 group member agents and 1 manager agent) - [View Notebook](/docs/notebooks/agentchat_groupchat_RAG) | ||
|
||
## Roadmap | ||
|
||
Explore our detailed roadmap [here](https://github.com/microsoft/autogen/issues/1657) for further advancements plan around RAG. Your contributions, feedback, and use cases are highly appreciated! We invite you to engage with us and play a pivotal role in the development of this impactful feature. |