Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Assistant API for agent #490

Merged
merged 5 commits into from
Aug 20, 2024
Merged

Conversation

xuechendi
Copy link
Collaborator

Description

Add Assistant API for agent

Issues

#365

Type of change

List the type of change like below. Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds new functionality)
  • Breaking change (fix or feature that would break existing design and interface)
  • Others (enhancement, documentation, validation, etc.)

Dependencies

No

Tests

test_agent_langchain.sh

@xuechendi
Copy link
Collaborator Author

@minmin-intel , @XuhuiRen , initial impl for assistant API

@xuechendi xuechendi linked an issue Aug 15, 2024 that may be closed by this pull request
Copy link

codecov bot commented Aug 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
comps/cores/proto/api_protocol.py 94.23% <100.00%> (+1.20%) ⬆️

@xuechendi
Copy link
Collaborator Author

xuechendi commented Aug 15, 2024

@minmin-intel , @XuhuiRen, @ftian1 @kevinintel @lkk12014402
Please take a review, this PR is add Assistant API to agent

We will use

v1/assistants => create assistant
v1/threads => create threads and memory
v1/runs => create real run of one query

image

@xuechendi
Copy link
Collaborator Author

@chensuyue this UT seems to fail on other issue, may you take a look
(Example-test / example-test (pull_request_target) Failing after 3m) seems caused by other unknown issue.

@minmin-intel
Copy link
Collaborator

@xuechendi I think the functionality looks good. But I have a couple of questions:

  1. Did you implement the apis and memory with reference to other open-source projects or from scratch? Langgraph has support for memory and threads. See the link below. I think we should use popular open-source frameworks. It will make our agent code easier to develop and maintain.
    https://langchain-ai.github.io/langgraph/concepts/low_level/#checkpointer
    https://langchain-ai.github.io/langgraph/concepts/low_level/#threads
  2. Is each run saved in some kind of memory, with agent states and messages?

@xuechendi
Copy link
Collaborator Author

@xuechendi I think the functionality looks good. But I have a couple of questions:

  1. Did you implement the apis and memory with reference to other open-source projects or from scratch? Langgraph has support for memory and threads. See the link below. I think we should use popular open-source frameworks. It will make our agent code easier to develop and maintain.
    https://langchain-ai.github.io/langgraph/concepts/low_level/#checkpointer
    https://langchain-ai.github.io/langgraph/concepts/low_level/#threads
  2. Is each run saved in some kind of memory, with agent states and messages?

I have aligned with Minmin on question 1. For Question 2, run is saved in global_threads_kv which is a threadSafeDict. and it can be canceled, resume in future request.

@kevinintel kevinintel requested a review from XuhuiRen August 16, 2024 02:53
@chensuyue chensuyue added this to the v0.9 milestone Aug 16, 2024
@xuechendi
Copy link
Collaborator Author

@minmin-intel @XuhuiRen , please help to review this PR. Would like to add AssistantAPI by this week.

Copy link
Collaborator

@minmin-intel minmin-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Signed-off-by: Chendi.Xue <[email protected]>
@xuechendi xuechendi merged commit f3a8935 into opea-project:main Aug 20, 2024
12 checks passed
chensuyue pushed a commit that referenced this pull request Aug 21, 2024
* Add assistants api support

Signed-off-by: Chendi.Xue <[email protected]>

* update UT to match new port definition

Signed-off-by: Chendi.Xue <[email protected]>

* rebase

Signed-off-by: Chendi.Xue <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix gramma in Test

Signed-off-by: Chendi.Xue <[email protected]>

---------

Signed-off-by: Chendi.Xue <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

(cherry picked from commit f3a8935)
Signed-off-by: chensuyue <[email protected]>
tileintel pushed a commit to siddhivelankar23/GenAIComps that referenced this pull request Aug 22, 2024
* Add assistants api support

Signed-off-by: Chendi.Xue <[email protected]>

* update UT to match new port definition

Signed-off-by: Chendi.Xue <[email protected]>

* rebase

Signed-off-by: Chendi.Xue <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix gramma in Test

Signed-off-by: Chendi.Xue <[email protected]>

---------

Signed-off-by: Chendi.Xue <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Signed-off-by: siddhivelankar23 <[email protected]>
sharanshirodkar7 pushed a commit to predictionguard/pg-GenAIComps that referenced this pull request Sep 3, 2024
* Add assistants api support

Signed-off-by: Chendi.Xue <[email protected]>

* update UT to match new port definition

Signed-off-by: Chendi.Xue <[email protected]>

* rebase

Signed-off-by: Chendi.Xue <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix gramma in Test

Signed-off-by: Chendi.Xue <[email protected]>

---------

Signed-off-by: Chendi.Xue <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support assistants API to Agent
4 participants