Skip to content

Commit

Permalink
Merge branch 'main' into fix-microsoft#2845
Browse files Browse the repository at this point in the history
  • Loading branch information
NanthagopalEswaran authored Jun 5, 2024
2 parents 0328035 + 84c7c24 commit 141a5a4
Show file tree
Hide file tree
Showing 19 changed files with 333 additions and 132 deletions.
27 changes: 26 additions & 1 deletion .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,31 @@ jobs:
dotnet build --no-restore --configuration Release -bl /p:SignAssembly=true
- name: Unit Test
run: dotnet test --no-build -bl --configuration Release
aot-test: # this make sure the AutoGen.Core is aot compatible
strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
os: [ ubuntu-latest ]
version: [ net8.0 ]
needs: build
defaults:
run:
working-directory: dotnet

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetching all

- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
global-json-file: dotnet/global.json

- name: publish AOT testApp, assert static analysis warning count, and run the app
shell: pwsh
run: ./.tools/test-aot-compatibility.ps1 ${{ matrix.version }}
openai-test:
name: Run openai test
runs-on: ubuntu-latest
Expand All @@ -75,7 +100,7 @@ jobs:
run:
working-directory: dotnet
if: success() && (github.ref == 'refs/heads/main')
needs: build
needs: aot-test
steps:
- uses: actions/checkout@v4
with:
Expand Down
6 changes: 4 additions & 2 deletions autogen/agentchat/contrib/vectordb/chromadb.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def create_collection(
if self.active_collection and self.active_collection.name == collection_name:
collection = self.active_collection
else:
collection = self.client.get_collection(collection_name)
collection = self.client.get_collection(collection_name, embedding_function=self.embedding_function)
except ValueError:
collection = None
if collection is None:
Expand Down Expand Up @@ -126,7 +126,9 @@ def get_collection(self, collection_name: str = None) -> Collection:
)
else:
if not (self.active_collection and self.active_collection.name == collection_name):
self.active_collection = self.client.get_collection(collection_name)
self.active_collection = self.client.get_collection(
collection_name, embedding_function=self.embedding_function
)
return self.active_collection

def delete_collection(self, collection_name: str) -> None:
Expand Down
5 changes: 3 additions & 2 deletions autogen/agentchat/conversable_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def __init__(

# Registered hooks are kept in lists, indexed by hookable method, to be called in their order of registration.
# New hookable methods should be added to this list as required to support new agent capabilities.
self.hook_lists = {
self.hook_lists: Dict[str, List[Callable]] = {
"process_last_received_message": [],
"process_all_messages_before_reply": [],
"process_message_before_send": [],
Expand Down Expand Up @@ -2724,7 +2724,7 @@ def process_all_messages_before_reply(self, messages: List[Dict]) -> List[Dict]:
processed_messages = hook(processed_messages)
return processed_messages

def process_last_received_message(self, messages):
def process_last_received_message(self, messages: List[Dict]) -> List[Dict]:
"""
Calls any registered capability hooks to use and potentially modify the text of the last message,
as long as the last message is not a function call or exit command.
Expand Down Expand Up @@ -2758,6 +2758,7 @@ def process_last_received_message(self, messages):
processed_user_content = user_content
for hook in hook_list:
processed_user_content = hook(processed_user_content)

if processed_user_content == user_content:
return messages # No hooks actually modified the user's message.

Expand Down
Loading

0 comments on commit 141a5a4

Please sign in to comment.