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

feat(awel): New MessageConverter and more AWEL operators #1039

Merged
merged 6 commits into from
Jan 8, 2024

Conversation

fangyinc
Copy link
Collaborator

@fangyinc fangyinc commented Jan 6, 2024

Description

  1. New MessageConverter to support unified model message adaptation.
  2. Model layer multi-version message, the previous one was v1, the new version in the sdk defaults to v2
    • v1 is previous usage.
    • v2 does not automatically convert messages, you need to use MessageConverter
  3. New ChatPromptTemplate
  4. More built-in AWEL operators.

How Has This Been Tested?

  1. make test
  2. Run examples in examples/sdk and examples/awel

Snapshots:

Include snapshots for easier review.

Checklist:

  • My code follows the style guidelines of this project
  • I have already rebased the commits and make the commit message conform to the project standard.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules

@github-actions github-actions bot added the enhancement New feature or request label Jan 6, 2024
@fangyinc
Copy link
Collaborator Author

fangyinc commented Jan 6, 2024

If you run AWEL file with dev mode, it will show AWEL DAG tree and graph, eg.

python examples/awel/data_analyst_assistant.py

DAG Tree:

HttpTrigger(node_id=1be1aa9a-0ae1-47db-ac44-818a31242d55)
 -> PromptTemplateBuilderOperator(node_id=b4156cd3-ca2f-4855-881d-92c194b605f9)
|  -> HistoryDynamicPromptBuilderOperator(node_id=50bcf0c0-3da4-4486-8b71-05e44ab680ad)
|    -> JoinOperator(node_id=61286112-1c4b-4b80-81ec-4fe662f901e3)
|      -> LLMBranchOperator(node_id=0489a3e3-4466-4696-88a6-407d512d00fa)
|        -> LLMOperator(node_id=ec336bd2-2a61-46e1-a56d-7609c2e1b725, node_name=llm_task)
|       |  -> MapOperator(node_id=6a15ac90-43d5-4037-a0c9-0de287e9eb86)
|       |    -> JoinOperator(node_id=edf31b66-c620-473a-94af-a8f8732fcb06)
|        -> StreamingLLMOperator(node_id=f050449a-a04b-4c76-b178-1e0aff787459, node_name=streaming_llm_task)
|          -> OpenAIStreamingOutputOperator(node_id=6c327808-ba77-4bf2-9720-69a55155d1d3)
|            -> JoinOperator(node_id=edf31b66-c620-473a-94af-a8f8732fcb06)
 -> MapOperator(node_id=20425277-ef51-4bd7-bd1f-684b4490b699)
|  -> ServePreChatHistoryLoadOperator(node_id=e1f647d7-48e6-4448-b8ec-ae05fc04d969)
|    -> BufferedConversationMapperOperator(node_id=fa961d16-4eec-4d98-a7fe-7845988f912a)
|      -> HistoryDynamicPromptBuilderOperator(node_id=50bcf0c0-3da4-4486-8b71-05e44ab680ad)
|        -> JoinOperator(node_id=61286112-1c4b-4b80-81ec-4fe662f901e3)
|          -> LLMBranchOperator(node_id=0489a3e3-4466-4696-88a6-407d512d00fa)
|            -> LLMOperator(node_id=ec336bd2-2a61-46e1-a56d-7609c2e1b725, node_name=llm_task)
|           |  -> MapOperator(node_id=6a15ac90-43d5-4037-a0c9-0de287e9eb86)
|           |    -> JoinOperator(node_id=edf31b66-c620-473a-94af-a8f8732fcb06)
|            -> StreamingLLMOperator(node_id=f050449a-a04b-4c76-b178-1e0aff787459, node_name=streaming_llm_task)
|              -> OpenAIStreamingOutputOperator(node_id=6c327808-ba77-4bf2-9720-69a55155d1d3)
|                -> JoinOperator(node_id=edf31b66-c620-473a-94af-a8f8732fcb06)
 -> MapOperator(node_id=f9019745-6093-41d6-ab5a-97d788645c2a)
|  -> HistoryDynamicPromptBuilderOperator(node_id=50bcf0c0-3da4-4486-8b71-05e44ab680ad)
|    -> JoinOperator(node_id=61286112-1c4b-4b80-81ec-4fe662f901e3)
|      -> LLMBranchOperator(node_id=0489a3e3-4466-4696-88a6-407d512d00fa)
|        -> LLMOperator(node_id=ec336bd2-2a61-46e1-a56d-7609c2e1b725, node_name=llm_task)
|       |  -> MapOperator(node_id=6a15ac90-43d5-4037-a0c9-0de287e9eb86)
|       |    -> JoinOperator(node_id=edf31b66-c620-473a-94af-a8f8732fcb06)
|        -> StreamingLLMOperator(node_id=f050449a-a04b-4c76-b178-1e0aff787459, node_name=streaming_llm_task)
|          -> OpenAIStreamingOutputOperator(node_id=6c327808-ba77-4bf2-9720-69a55155d1d3)
|            -> JoinOperator(node_id=edf31b66-c620-473a-94af-a8f8732fcb06)
 -> JoinOperator(node_id=61286112-1c4b-4b80-81ec-4fe662f901e3)
   -> LLMBranchOperator(node_id=0489a3e3-4466-4696-88a6-407d512d00fa)
     -> LLMOperator(node_id=ec336bd2-2a61-46e1-a56d-7609c2e1b725, node_name=llm_task)
    |  -> MapOperator(node_id=6a15ac90-43d5-4037-a0c9-0de287e9eb86)
    |    -> JoinOperator(node_id=edf31b66-c620-473a-94af-a8f8732fcb06)
     -> StreamingLLMOperator(node_id=f050449a-a04b-4c76-b178-1e0aff787459, node_name=streaming_llm_task)
       -> OpenAIStreamingOutputOperator(node_id=6c327808-ba77-4bf2-9720-69a55155d1d3)
         -> JoinOperator(node_id=edf31b66-c620-473a-94af-a8f8732fcb06)

DAG graph
image

Other example

python examples/awel/simple_chat_history_example.py

DAG Tree

HttpTrigger(node_id=b71f0ccc-4539-445e-8d87-1ec5ef6e7e83)
 -> MapOperator(node_id=23d11ff8-a1d4-4541-a1ff-adfb0eadd614)
   -> ChatHistoryPromptComposerOperator(node_id=3ee4c2af-d625-445b-a0f3-60863404d82e)
     -> LLMBranchOperator(node_id=bdc20002-b9e9-4ce8-9211-5aba83f4c16e)
       -> LLMOperator(node_id=b4c3fe48-a9d8-4968-a128-df5a6b6edd4c, node_name=llm_task)
      |  -> MapOperator(node_id=ce768e92-5299-43ab-ac04-09755b5f19e2)
      |    -> JoinOperator(node_id=f33f239e-90dd-4dd4-bc12-30d6d0912cfb)
       -> StreamingLLMOperator(node_id=ca529d57-1bd7-479c-9047-5cb5512ade8e, node_name=streaming_llm_task)
         -> OpenAIStreamingOutputOperator(node_id=1952037e-775a-4c9c-a8c3-7ca678f15871)
           -> JoinOperator(node_id=f33f239e-90dd-4dd4-bc12-30d6d0912cfb)

DAG graph
image

Copy link
Collaborator

@csunny csunny left a comment

Choose a reason for hiding this comment

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

Great, LGTM 🚀

The DAG Visualize is cool.

Copy link
Collaborator

@Aries-ckt Aries-ckt left a comment

Choose a reason for hiding this comment

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

r+

@Aries-ckt Aries-ckt merged commit e8861bd into eosphoros-ai:main Jan 8, 2024
4 checks passed
@fangyinc fangyinc deleted the sdk-dev branch January 9, 2024 03:55
Hopshine pushed a commit to Hopshine/DB-GPT that referenced this pull request Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants