Full Code of baidubce/app-builder for AI

master 1373b758244c cached
882 files
9.4 MB
2.5M tokens
5162 symbols
1 requests
Copy disabled (too large) Download .txt
Showing preview only (10,687K chars total). Download the full file to get everything.
Repository: baidubce/app-builder
Branch: master
Commit: 1373b758244c
Files: 882
Total size: 9.4 MB

Directory structure:
gitextract_900dxzul/

├── .env_template
├── .github/
│   └── workflows/
│       └── python-package.yml
├── CONTRIBUTING.md
├── LICENSE
├── NEW_README.md
├── README.md
├── cookbooks/
│   ├── README.md
│   ├── advanced_application/
│   │   ├── agent_speech.ipynb
│   │   └── cloud_deploy.ipynb
│   ├── agent_builder.ipynb
│   ├── appbuilder_trace/
│   │   └── trace.ipynb
│   ├── components/
│   │   ├── agent_runtime.ipynb
│   │   ├── asr.ipynb
│   │   ├── gbi.ipynb
│   │   ├── general_ocr.ipynb
│   │   ├── object_recognize.ipynb
│   │   ├── rag_with_baidusearch.ipynb
│   │   ├── text_generation.ipynb
│   │   ├── translate.ipynb
│   │   └── vdb_retriever.ipynb
│   ├── end2end_application/
│   │   ├── agent/
│   │   │   ├── appbuilder_client.ipynb
│   │   │   ├── chatflow.ipynb
│   │   │   ├── tool_call.ipynb
│   │   │   └── tool_choice.ipynb
│   │   └── rag/
│   │       ├── console_dataset.ipynb
│   │       ├── console_rag.ipynb
│   │       ├── qa_system_1_dataset.ipynb
│   │       ├── qa_system_2_dialogue.ipynb
│   │       └── rag.ipynb
│   ├── live_broadcast_material/
│   │   ├── 2024_05_16/
│   │   │   ├── agent_run.py
│   │   │   ├── chatbot.py
│   │   │   ├── service_deploy.py
│   │   │   └── two_agent.py
│   │   ├── 2024_08_22/
│   │   │   ├── README.md
│   │   │   ├── knowledgebase.ipynb
│   │   │   ├── tool_call_1.ipynb
│   │   │   ├── tool_call_2.ipynb
│   │   │   ├── tool_call_3.ipynb
│   │   │   ├── tool_call_4.ipynb
│   │   │   └── trace.ipynb
│   │   └── 2024_12_18/
│   │       └── rag_knowledgebase_01.ipynb
│   ├── mcp/
│   │   ├── app_mcp_server.ipynb
│   │   ├── baidu_map.ipynb
│   │   ├── client.ipynb
│   │   ├── knowledge_base_mcp_server.ipynb
│   │   └── server.ipynb
│   └── pipeline/
│       ├── assistant.ipynb
│       ├── assistant_function_call.ipynb
│       ├── file.ipynb
│       ├── message.ipynb
│       ├── run.ipynb
│       └── thread.ipynb
├── docs/
│   ├── Application/
│   │   ├── Agent/
│   │   │   ├── BasicKnowledge/
│   │   │   │   └── agent.md
│   │   │   ├── ToolCall/
│   │   │   │   └── tool_call.md
│   │   │   ├── ToolChoice/
│   │   │   │   └── tool_choice.md
│   │   │   └── UseOfficialComponents/
│   │   │       └── use_official_components.md
│   │   └── RAG/
│   │       ├── BasicKnowledge/
│   │       │   └── rag.md
│   │       └── DatasetManage/
│   │           └── dataset_manage.md
│   ├── BasisModule/
│   │   ├── Components/
│   │   │   ├── Components.md
│   │   │   ├── animal_recognize/
│   │   │   │   └── README.md
│   │   │   ├── asr/
│   │   │   │   └── README.md
│   │   │   ├── dish_recognize/
│   │   │   │   └── README.md
│   │   │   ├── doc_crop_enhance/
│   │   │   │   └── README.md
│   │   │   ├── doc_format_converter/
│   │   │   │   └── README.md
│   │   │   ├── doc_parser/
│   │   │   │   └── README.md
│   │   │   ├── doc_splitter/
│   │   │   │   └── README.md
│   │   │   ├── document_understanding/
│   │   │   │   └── README.md
│   │   │   ├── embeddings/
│   │   │   │   └── README.md
│   │   │   ├── extract_table/
│   │   │   │   └── README.md
│   │   │   ├── gbi/
│   │   │   │   ├── nl2sql/
│   │   │   │   │   └── README.md
│   │   │   │   └── select_table/
│   │   │   │       └── README.md
│   │   │   ├── general_ocr/
│   │   │   │   └── README.md
│   │   │   ├── handwrite_ocr/
│   │   │   │   └── README.md
│   │   │   ├── image_understand/
│   │   │   │   └── README.md
│   │   │   ├── landmark_recognize/
│   │   │   │   └── README.md
│   │   │   ├── llms/
│   │   │   │   ├── dialog_summary/
│   │   │   │   │   └── README.md
│   │   │   │   ├── hallucination_detection/
│   │   │   │   │   └── README.md
│   │   │   │   ├── is_complex_query/
│   │   │   │   │   └── README.md
│   │   │   │   ├── mrc/
│   │   │   │   │   └── README.md
│   │   │   │   ├── nl2pandas/
│   │   │   │   │   └── README.md
│   │   │   │   ├── oral_query_generation/
│   │   │   │   │   └── README.md
│   │   │   │   ├── playground/
│   │   │   │   │   └── README.md
│   │   │   │   ├── qa_pair_mining/
│   │   │   │   │   └── README.md
│   │   │   │   ├── query_decomposition/
│   │   │   │   │   └── README.md
│   │   │   │   ├── query_rewrite/
│   │   │   │   │   └── README.md
│   │   │   │   ├── similar_question/
│   │   │   │   │   └── README.md
│   │   │   │   ├── style_rewrite/
│   │   │   │   │   └── README.md
│   │   │   │   ├── style_writing/
│   │   │   │   │   └── README.md
│   │   │   │   └── tag_extraction/
│   │   │   │       └── README.md
│   │   │   ├── matching/
│   │   │   │   └── README.md
│   │   │   ├── mix_card_ocr/
│   │   │   │   └── README.md
│   │   │   ├── object_recognize/
│   │   │   │   └── README.md
│   │   │   ├── plant_recognize/
│   │   │   │   └── README.md
│   │   │   ├── ppt_generation_from_file/
│   │   │   │   └── README.md
│   │   │   ├── ppt_generation_from_instruction/
│   │   │   │   └── README.md
│   │   │   ├── ppt_generation_from_paper/
│   │   │   │   └── README.md
│   │   │   ├── qrcode_ocr/
│   │   │   │   └── README.md
│   │   │   ├── rag_with_baidu_search/
│   │   │   │   └── README.md
│   │   │   ├── rag_with_baidu_search_pro/
│   │   │   │   └── README.md
│   │   │   ├── retriever/
│   │   │   │   ├── README.md
│   │   │   │   ├── baidu_vdb/
│   │   │   │   │   └── README.md
│   │   │   │   ├── bes/
│   │   │   │   │   └── README.md
│   │   │   │   └── reranker/
│   │   │   │       └── README.md
│   │   │   ├── table_ocr/
│   │   │   │   └── README.md
│   │   │   ├── text_to_image/
│   │   │   │   └── README.md
│   │   │   ├── translate/
│   │   │   │   └── README.md
│   │   │   ├── tree_mind/
│   │   │   │   └── README.md
│   │   │   └── tts/
│   │   │       └── README.md
│   │   ├── Deployment/
│   │   │   ├── AgentChainlit.md
│   │   │   ├── agentruntime.md
│   │   │   ├── cloud.md
│   │   │   ├── flask.md
│   │   │   └── usersession.md
│   │   ├── Model/
│   │   │   └── get_model_list.md
│   │   ├── Platform/
│   │   │   ├── Application/
│   │   │   │   ├── appbuilder_client.md
│   │   │   │   └── get_app_list.md
│   │   │   ├── CustomComponents/
│   │   │   │   ├── component_client.md
│   │   │   │   └── components.md
│   │   │   └── KnowledgeBase/
│   │   │       └── knowledgebase.md
│   │   └── Trace/
│   │       ├── Debug.md
│   │       ├── README.md
│   │       ├── basic.md
│   │       └── phoenix_method.md
│   ├── DevelopGuide/
│   │   ├── AdvancedDevelopment/
│   │   │   └── README.md
│   │   ├── ChangeLog/
│   │   │   └── changelog.md
│   │   ├── EnvironmentalParameters/
│   │   │   └── env.md
│   │   ├── ErrorMessage/
│   │   │   └── error_message.md
│   │   └── HowToContributeCode/
│   │       └── README.md
│   ├── QuickStart/
│   │   ├── CurrentlySupportedProgrammingLanguages/
│   │   │   └── README.md
│   │   ├── ExamplesOfIndustrialPracticeApplications/
│   │   │   └── README.md
│   │   └── StartFirstAINativeApplication/
│   │       ├── README.md
│   │       └── install.md
│   ├── README.md
│   ├── README_en.md
│   ├── README_ja.md
│   └── Tools/
│       ├── DocPass/
│       │   └── DocPass.md
│       ├── JavaAPI/
│       │   ├── JavaAPI.md
│       │   ├── READEME.md
│       │   └── java_api_update.sh
│       ├── MarkdownSh/
│       │   ├── markdown2rst.py
│       │   └── markdown_parse.py
│       └── SphinxSh/
│           ├── Makefile
│           ├── PythonAPI.md
│           ├── READEME.md
│           ├── appbuilder.core.rst
│           ├── get_components_md.py
│           ├── make.bat
│           ├── requirements.txt
│           ├── source/
│           │   ├── conf.py
│           │   └── index.rst
│           ├── update_doc.sh
│           ├── update_lib.py
│           └── update_rst.py
├── go/
│   ├── appbuilder/
│   │   ├── agent_builder.go
│   │   ├── agent_builder_data.go
│   │   ├── agent_builder_data_test.go
│   │   ├── agent_builder_test.go
│   │   ├── app_builder_client.go
│   │   ├── app_builder_client_data.go
│   │   ├── app_builder_client_test.go
│   │   ├── component_client.go
│   │   ├── component_client_data.go
│   │   ├── component_client_test.go
│   │   ├── config.go
│   │   ├── dataset.go
│   │   ├── dataset_data.go
│   │   ├── dataset_test.go
│   │   ├── go.mod
│   │   ├── go.sum
│   │   ├── knowledge_base.go
│   │   ├── knowledge_base_data.go
│   │   ├── knowledge_base_test.go
│   │   ├── rag.go
│   │   ├── rag_data.go
│   │   ├── rag_test.go
│   │   └── util.go
│   └── run_go_test.sh
├── java/
│   ├── parse_tests_and_coverage.py
│   ├── pom.xml
│   ├── print_coverage.sh
│   └── src/
│       ├── main/
│       │   └── java/
│       │       └── com/
│       │           └── baidubce/
│       │               └── appbuilder/
│       │                   ├── base/
│       │                   │   ├── component/
│       │                   │   │   └── Component.java
│       │                   │   ├── config/
│       │                   │   │   └── AppBuilderConfig.java
│       │                   │   ├── exception/
│       │                   │   │   └── AppBuilderServerException.java
│       │                   │   └── utils/
│       │                   │       ├── http/
│       │                   │       │   ├── HttpClient.java
│       │                   │       │   └── HttpResponse.java
│       │                   │       ├── iterator/
│       │                   │       │   └── StreamIterator.java
│       │                   │       └── json/
│       │                   │           └── JsonUtils.java
│       │                   ├── console/
│       │                   │   ├── agentbuilder/
│       │                   │   │   └── AgentBuilder.java
│       │                   │   ├── aisearch/
│       │                   │   │   └── AISearch.java
│       │                   │   ├── appbuilderclient/
│       │                   │   │   ├── App.java
│       │                   │   │   ├── AppBuilderClient.java
│       │                   │   │   └── AppList.java
│       │                   │   ├── componentclient/
│       │                   │   │   └── ComponentClient.java
│       │                   │   ├── dataset/
│       │                   │   │   └── Dataset.java
│       │                   │   ├── knowledgebase/
│       │                   │   │   └── Knowledgebase.java
│       │                   │   └── rag/
│       │                   │       └── RAG.java
│       │                   └── model/
│       │                       ├── agentbuilder/
│       │                       │   ├── AgentBuilderIterator.java
│       │                       │   ├── AgentBuilderResponse.java
│       │                       │   ├── AgentBuilderResult.java
│       │                       │   ├── ConversationResponse.java
│       │                       │   ├── Event.java
│       │                       │   ├── EventContent.java
│       │                       │   └── FileUploadResponse.java
│       │                       ├── aisearch/
│       │                       │   ├── AISearchIterator.java
│       │                       │   ├── AISearchRequest.java
│       │                       │   └── AISearchResponse.java
│       │                       ├── appbuilderclient/
│       │                       │   ├── App.java
│       │                       │   ├── AppBuilderClientFeedbackRequest.java
│       │                       │   ├── AppBuilderClientFeedbackResponse.java
│       │                       │   ├── AppBuilderClientIterator.java
│       │                       │   ├── AppBuilderClientResponse.java
│       │                       │   ├── AppBuilderClientResult.java
│       │                       │   ├── AppBuilderClientRunRequest.java
│       │                       │   ├── AppDescribeRequest.java
│       │                       │   ├── AppDescribeResponse.java
│       │                       │   ├── AppListRequest.java
│       │                       │   ├── AppListResponse.java
│       │                       │   ├── AppsDescribeRequest.java
│       │                       │   ├── AppsDescribeResponse.java
│       │                       │   ├── ConversationResponse.java
│       │                       │   ├── Event.java
│       │                       │   ├── EventContent.java
│       │                       │   ├── FileUploadResponse.java
│       │                       │   └── ToolCall.java
│       │                       ├── componentclient/
│       │                       │   ├── ComponentClientIterator.java
│       │                       │   ├── ComponentClientRunRequest.java
│       │                       │   └── ComponentClientRunResponse.java
│       │                       ├── dataset/
│       │                       │   ├── DatasetCreateResponse.java
│       │                       │   ├── DatasetCreateResult.java
│       │                       │   ├── DocumentAddResponse.java
│       │                       │   ├── DocumentAddResult.java
│       │                       │   ├── DocumentDeleteResponse.java
│       │                       │   ├── DocumentListData.java
│       │                       │   ├── DocumentListResponse.java
│       │                       │   ├── DocumentListResult.java
│       │                       │   ├── FileUploadResponse.java
│       │                       │   └── FileUploadResult.java
│       │                       ├── knowledgebase/
│       │                       │   ├── ChunkCreateRequest.java
│       │                       │   ├── ChunkCreateResponse.java
│       │                       │   ├── ChunkDeleteRequest.java
│       │                       │   ├── ChunkDescribeRequest.java
│       │                       │   ├── ChunkDescribeResponse.java
│       │                       │   ├── ChunkModifyRequest.java
│       │                       │   ├── ChunksDescribeRequest.java
│       │                       │   ├── ChunksDescribeResponse.java
│       │                       │   ├── Document.java
│       │                       │   ├── DocumentAddRequest.java
│       │                       │   ├── DocumentAddResponse.java
│       │                       │   ├── DocumentDeleteRequest.java
│       │                       │   ├── DocumentDeleteResponse.java
│       │                       │   ├── DocumentDescribeResponse.java
│       │                       │   ├── DocumentListRequest.java
│       │                       │   ├── DocumentListResponse.java
│       │                       │   ├── DocumentsCreateRequest.java
│       │                       │   ├── DocumentsCreateResponse.java
│       │                       │   ├── DocumentsDescribeRequest.java
│       │                       │   ├── DocumentsDescribeResponse.java
│       │                       │   ├── DocumentsUploadResponse.java
│       │                       │   ├── FileUploadResponse.java
│       │                       │   ├── KnowledgeBaseConfig.java
│       │                       │   ├── KnowledgeBaseDetail.java
│       │                       │   ├── KnowledgeBaseDetailRequest.java
│       │                       │   ├── KnowledgeBaseListRequest.java
│       │                       │   ├── KnowledgeBaseListResponse.java
│       │                       │   ├── KnowledgeBaseModifyRequest.java
│       │                       │   ├── QueryKnowledgeBaseRequest.java
│       │                       │   └── QueryKnowledgeBaseResponse.java
│       │                       └── rag/
│       │                           ├── EventContent.java
│       │                           ├── RAGIterator.java
│       │                           ├── RAGResponse.java
│       │                           └── RAGResult.java
│       └── test/
│           └── java/
│               └── com/
│                   └── baidubce/
│                       └── appbuilder/
│                           ├── AISearchTest.java
│                           ├── AgentBuilderTest.java
│                           ├── AppBuilderClientTest.java
│                           ├── ComponentClientTest.java
│                           ├── DatasetTest.java
│                           ├── KnowledgebaseTest.java
│                           ├── RAGTest.java
│                           ├── base/
│                           │   ├── exception/
│                           │   │   └── AppBuilderServerExceptionTest.java
│                           │   └── utils/
│                           │       └── json/
│                           │           └── JsonUtilsTest.java
│                           ├── files/
│                           │   ├── query_knowledgebase.json
│                           │   └── toolcall.json
│                           └── model/
│                               ├── agentbuilder/
│                               │   ├── AgentBuilderResponseTest.java
│                               │   ├── AgentBuilderResultTest.java
│                               │   ├── ConversationResponseTest.java
│                               │   ├── EventContentTest.java
│                               │   ├── EventTest.java
│                               │   └── FileUploadResponseTest.java
│                               ├── appbuilderclient/
│                               │   ├── AppBuilderClientResponseTest.java
│                               │   ├── AppBuilderClientRunRequestTest.java
│                               │   ├── AppListRequestTest.java
│                               │   ├── AppListResponseTest.java
│                               │   ├── AppTest.java
│                               │   ├── ConversationResponseTest.java
│                               │   ├── EventContentTest.java
│                               │   ├── EventTest.java
│                               │   ├── FileUploadResponseTest.java
│                               │   └── ToolCallTest.java
│                               ├── dataset/
│                               │   ├── DatasetCreateResultTest.java
│                               │   ├── DocumentAddResultTest.java
│                               │   ├── DocumentListDataTest.java
│                               │   ├── DocumentListResponseTest.java
│                               │   ├── DocumentListResultTest.java
│                               │   ├── FileUploadResponseTest.java
│                               │   ├── FileUploadResultTest.java
│                               │   └── ResponseTest.java
│                               ├── knowledgebase/
│                               │   ├── ChunkCreateRequestTest.java
│                               │   ├── ChunkCreateResponseTest.java
│                               │   ├── ChunkDeleteRequestTest.java
│                               │   ├── ChunkDescribeRequestTest.java
│                               │   ├── ChunkDescribeResponseTest.java
│                               │   ├── ChunkModifyRequestTest.java
│                               │   ├── ChunksDescribeRequestTest.java
│                               │   ├── ChunksDescribeResponseTest.java
│                               │   ├── DocumentAddRequestTest.java
│                               │   ├── DocumentDeleteRequestTest.java
│                               │   ├── DocumentDeleteResponseTest.java
│                               │   ├── DocumentListRequestTest.java
│                               │   ├── DocumentListResponseTest.java
│                               │   ├── DocumentTest.java
│                               │   ├── DocumentsCreateRequestTest.java
│                               │   ├── FileUploadResponseTest.java
│                               │   ├── KnowledgeBaseConfigTest.java
│                               │   ├── KnowledgeBaseDetailRequestTest.java
│                               │   ├── KnowledgeBaseDetailTest.java
│                               │   ├── KnowledgeBaseListRequestTest.java
│                               │   ├── KnowledgeBaseListResponseTest.java
│                               │   └── KnowledgeBaseModifyRequestTest.java
│                               └── rag/
│                                   ├── EventContentTest.java
│                                   ├── RAGResponseTest.java
│                                   └── RAGResultTest.java
├── mkdocs.yml
├── python/
│   ├── __init__.py
│   ├── core/
│   │   ├── __init__.py
│   │   ├── _client.py
│   │   ├── _exception.py
│   │   ├── _session.py
│   │   ├── agent.py
│   │   ├── assistant/
│   │   │   ├── __init__.py
│   │   │   ├── assistants/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── assistants.py
│   │   │   │   └── files.py
│   │   │   ├── base.py
│   │   │   ├── threads/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── messages/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── messages.py
│   │   │   │   ├── runs/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── runs.py
│   │   │   │   │   ├── steps.py
│   │   │   │   │   └── stream_helper.py
│   │   │   │   └── threads.py
│   │   │   └── type/
│   │   │       ├── __init__.py
│   │   │       ├── assistant_type.py
│   │   │       ├── public_type.py
│   │   │       └── thread_type.py
│   │   ├── component.py
│   │   ├── components/
│   │   │   ├── __init__.py
│   │   │   ├── animal_recognize/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── asr/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── dish_recognize/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── doc_crop_enhance/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── doc_format_converter/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── doc_parser/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   └── component.py
│   │   │   ├── doc_splitter/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   └── component.py
│   │   │   ├── document_understanding/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   └── component.py
│   │   │   ├── embeddings/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   └── component.py
│   │   │   ├── extract_table/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   └── component.py
│   │   │   ├── gbi/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── basic.py
│   │   │   │   ├── nl2sql/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   └── select_table/
│   │   │   │       ├── README.md
│   │   │   │       ├── __init__.py
│   │   │   │       ├── base.py
│   │   │   │       └── component.py
│   │   │   ├── general_ocr/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── handwrite_ocr/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── image_understand/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── landmark_recognize/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── llms/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   ├── dialog_summary/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── hallucination_detection/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── is_complex_query/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── mrc/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── nl2pandas/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── oral_query_generation/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── playground/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── qa_pair_mining/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── query_decomposition/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── query_rewrite/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── similar_question/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── style_rewrite/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── style_writing/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   └── tag_extraction/
│   │   │   │       ├── README.md
│   │   │   │       ├── __init__.py
│   │   │   │       ├── base.py
│   │   │   │       └── component.py
│   │   │   ├── matching/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   └── component.py
│   │   │   ├── mix_card_ocr/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── object_recognize/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── plant_recognize/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── ppt_generation_from_file/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   └── component.py
│   │   │   ├── ppt_generation_from_instruction/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   └── component.py
│   │   │   ├── ppt_generation_from_paper/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   └── component.py
│   │   │   ├── qrcode_ocr/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── rag_with_baidu_search/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── rag_with_baidu_search_pro/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── retriever/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── baidu_vdb/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── component.py
│   │   │   │   │   └── model.py
│   │   │   │   ├── bes/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── component.py
│   │   │   │   └── reranker/
│   │   │   │       ├── README.md
│   │   │   │       ├── __init__.py
│   │   │   │       ├── component.py
│   │   │   │       └── model.py
│   │   │   ├── table_ocr/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── text_to_image/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── translate/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── tree_mind/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── tts/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   └── v2/
│   │   │       ├── __init__.py
│   │   │       ├── animal_recognize/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── asr/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── general_ocr/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── handwrite_ocr/
│   │   │       │   ├── __init__.py
│   │   │       │   ├── component.py
│   │   │       │   └── model.py
│   │   │       ├── image_understand/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── llms/
│   │   │       │   ├── __init__.py
│   │   │       │   ├── dialog_summary/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── hallucination_detection/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── is_complex_query/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── mrc/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── nl2pandas/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── oral_query_generation/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── qa_pair_mining/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── query_decomposition/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── query_rewrite/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── similar_question/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── style_rewrite/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── style_writing/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   └── tag_extraction/
│   │   │       │       ├── __init__.py
│   │   │       │       └── component.py
│   │   │       ├── mix_card_ocr/
│   │   │       │   ├── __init__.py
│   │   │       │   ├── component.py
│   │   │       │   └── model.py
│   │   │       ├── object_recognize/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── plant_recognize/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── qrcode_ocr/
│   │   │       │   ├── __init__.py
│   │   │       │   ├── component.py
│   │   │       │   └── model.py
│   │   │       ├── table_ocr/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── text_to_image/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── translate/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       └── tree_mind/
│   │   │           ├── __init__.py
│   │   │           ├── component.py
│   │   │           └── model.py
│   │   ├── console/
│   │   │   ├── __init__.py
│   │   │   ├── ai_search/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── ai_search.py
│   │   │   │   └── data_class.py
│   │   │   ├── appbuilder_client/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── appbuilder_client.py
│   │   │   │   ├── async_appbuilder_client.py
│   │   │   │   ├── async_event_handler.py
│   │   │   │   ├── data_class.py
│   │   │   │   └── event_handler.py
│   │   │   ├── base.py
│   │   │   ├── component_client/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component_client.py
│   │   │   │   └── data_class.py
│   │   │   ├── dataset/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── dataset.py
│   │   │   │   └── model.py
│   │   │   ├── knowledge_base/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── data_class.py
│   │   │   │   └── knowledge_base.py
│   │   │   └── rag/
│   │   │       ├── __init__.py
│   │   │       └── rag.py
│   │   ├── constants.py
│   │   ├── context.py
│   │   ├── functional.py
│   │   ├── manifest/
│   │   │   ├── __init__.py
│   │   │   ├── manifest_decorator.py
│   │   │   ├── manifest_signature.py
│   │   │   └── models.py
│   │   ├── message.py
│   │   ├── session_message.py
│   │   ├── user_session.py
│   │   └── utils.py
│   ├── mcp_server/
│   │   ├── README.md
│   │   ├── __init__.py
│   │   ├── ai_search/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   └── ai_search_server.py
│   │   ├── app/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   └── app_server.py
│   │   ├── client.py
│   │   ├── http_client.py
│   │   ├── knowledge_base/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   └── knowledge_base_server.py
│   │   ├── openapi.py
│   │   ├── server.py
│   │   └── sse.py
│   ├── tests/
│   │   ├── __init__.py
│   │   ├── component_check.py
│   │   ├── component_collector.py
│   │   ├── component_schemas.py
│   │   ├── component_tool_eval_cases.py
│   │   ├── data/
│   │   │   ├── ghes-3.0.json
│   │   │   ├── ghes-3.0.yaml
│   │   │   ├── mcp_component_server_sample.py
│   │   │   ├── mcp_knowledge_base_case.txt
│   │   │   ├── mcp_official_server_sample.py
│   │   │   └── qa_demo.xlsx
│   │   ├── parallel_ut_run.py
│   │   ├── print_components_error_info.py
│   │   ├── pytest_config.py
│   │   ├── pytest_utils.py
│   │   ├── run_python_test.sh
│   │   ├── sed_str.py
│   │   ├── test_agent.py
│   │   ├── test_ai_search.py
│   │   ├── test_ai_search_stream.py
│   │   ├── test_all_components.py
│   │   ├── test_animal_recognize.py
│   │   ├── test_appbuilder_assistant_trace.py
│   │   ├── test_appbuilder_client.py
│   │   ├── test_appbuilder_client_app_detail.py
│   │   ├── test_appbuilder_client_app_list.py
│   │   ├── test_appbuilder_client_chatflow.py
│   │   ├── test_appbuilder_client_chatflow_event_handler.py
│   │   ├── test_appbuilder_client_chatflow_event_handler_v2.py
│   │   ├── test_appbuilder_client_custom_metadata.py
│   │   ├── test_appbuilder_client_feedback.py
│   │   ├── test_appbuilder_client_follow_up_query.py
│   │   ├── test_appbuilder_client_mcp.py
│   │   ├── test_appbuilder_client_mcp_component.py
│   │   ├── test_appbuilder_client_mcp_official.py
│   │   ├── test_appbuilder_client_parameters.py
│   │   ├── test_appbuilder_client_run_with_handler.py
│   │   ├── test_appbuilder_client_toolcall.py
│   │   ├── test_appbuilder_client_toolcall_event_handler.py
│   │   ├── test_appbuilder_client_toolcall_event_handler_error.py
│   │   ├── test_appbuilder_client_toolcall_event_handler_stream.py
│   │   ├── test_appbuilder_client_toolcall_event_handler_v2.py
│   │   ├── test_appbuilder_client_toolcall_event_handler_v3.py
│   │   ├── test_appbuilder_client_toolcall_stream.py
│   │   ├── test_appbuilder_client_toolcall_v2.py
│   │   ├── test_appbuilder_client_toolcall_v3.py
│   │   ├── test_appbuilder_client_trace.py
│   │   ├── test_appbuilder_components_trace.py
│   │   ├── test_appbuilder_core_components_retriever.py
│   │   ├── test_appbuilder_sentry_trace_off.py
│   │   ├── test_appbuilder_sentry_trace_on.py
│   │   ├── test_appbuilder_trace_raise_error.py
│   │   ├── test_asr.py
│   │   ├── test_assistant_basic_import.py
│   │   ├── test_assistant_class_assistans.py
│   │   ├── test_assistant_class_files.py
│   │   ├── test_assistant_class_messages.py
│   │   ├── test_assistant_class_runs.py
│   │   ├── test_assistant_class_runs_v2.py
│   │   ├── test_assistant_class_threads.py
│   │   ├── test_assistant_e2e_funccall.py
│   │   ├── test_assistant_e2e_funccall_component.py
│   │   ├── test_assistant_e2e_run.py
│   │   ├── test_assistant_e2e_stream_cancel.py
│   │   ├── test_assistant_e2e_stream_event_handler.py
│   │   ├── test_assistant_e2e_stream_event_handler_v2.py
│   │   ├── test_assistant_e2e_stream_funccall.py
│   │   ├── test_assistant_e2e_stream_run.py
│   │   ├── test_async_appbuilder_client.py
│   │   ├── test_async_appbuilder_client_chatflow.py
│   │   ├── test_async_appbuilder_client_custom_metadata.py
│   │   ├── test_async_appbuilder_client_follow_up_query.py
│   │   ├── test_async_appbuilder_client_parameters.py
│   │   ├── test_async_appbuilder_client_toolcall.py
│   │   ├── test_base_component.py
│   │   ├── test_bes_retriever.py
│   │   ├── test_component_client.py
│   │   ├── test_component_is_async.py
│   │   ├── test_console_dataset.py
│   │   ├── test_console_rag.py
│   │   ├── test_core_agent.py
│   │   ├── test_core_client.py
│   │   ├── test_core_components_baidu_vdb_retriever.py
│   │   ├── test_core_components_doc.py
│   │   ├── test_core_components_embedding.py
│   │   ├── test_core_components_table.py
│   │   ├── test_core_components_tts.py
│   │   ├── test_core_console_base.py
│   │   ├── test_core_session.py
│   │   ├── test_core_user_session.py
│   │   ├── test_core_utils.py
│   │   ├── test_dialog_summary.py
│   │   ├── test_dish_recognize.py
│   │   ├── test_doc_crop_enhance.py
│   │   ├── test_doc_format_converter.py
│   │   ├── test_doc_parser.py
│   │   ├── test_doc_splitter.py
│   │   ├── test_document_understanding.py
│   │   ├── test_embedding.py
│   │   ├── test_extract_table.py
│   │   ├── test_gbi_nl2sql.py
│   │   ├── test_gbi_select_table.py
│   │   ├── test_general_ocr.py
│   │   ├── test_get_app_list.py
│   │   ├── test_get_model_list.py
│   │   ├── test_hallucination_detection.py
│   │   ├── test_handwrite_ocr.py
│   │   ├── test_image_understand.py
│   │   ├── test_is_complex_query.py
│   │   ├── test_knowledge_base.py
│   │   ├── test_landmark_recognize.py
│   │   ├── test_langchain_adapter_run.py
│   │   ├── test_langchain_adapter_tool_eval.py
│   │   ├── test_langchain_error.py
│   │   ├── test_llm_base.py
│   │   ├── test_log_set_log_config.py
│   │   ├── test_manifest.py
│   │   ├── test_manifest_decorator.py
│   │   ├── test_manifest_signature.py
│   │   ├── test_matching.py
│   │   ├── test_mcp_ai_search_stdio.py
│   │   ├── test_mcp_app_server_stdio.py
│   │   ├── test_mcp_rag_stdio.py
│   │   ├── test_message.py
│   │   ├── test_mix_card_ocr.py
│   │   ├── test_mrc.py
│   │   ├── test_nl2pandas.py
│   │   ├── test_object_recognize.py
│   │   ├── test_openapi_convert.py
│   │   ├── test_oral_query_generation.py
│   │   ├── test_plant_recognize.py
│   │   ├── test_playground.py
│   │   ├── test_ppt_generation_from_file.py
│   │   ├── test_ppt_generation_from_instruction.py
│   │   ├── test_ppt_generation_from_paper.py
│   │   ├── test_private_llm_component.py
│   │   ├── test_qa_aicape_animal_rec.py
│   │   ├── test_qa_aicape_doc_crop_enhance.py
│   │   ├── test_qa_aicape_handwriting_ocr.py
│   │   ├── test_qa_aicape_image_understand.py
│   │   ├── test_qa_aicape_mixcard_ocr.py
│   │   ├── test_qa_aicape_plant_rec.py
│   │   ├── test_qa_aicape_qrcode_orc.py
│   │   ├── test_qa_aicape_table_ocr.py
│   │   ├── test_qa_doc_parser_extract_table_from_doc.py
│   │   ├── test_qa_llm_dialog_summary.py
│   │   ├── test_qa_llm_get_qianfan_model_list.py
│   │   ├── test_qa_llm_is_complex_query.py
│   │   ├── test_qa_llm_matching.py
│   │   ├── test_qa_llm_oral_query_generation.py
│   │   ├── test_qa_llm_paddle_speech_tts.py
│   │   ├── test_qa_llm_pandas.py
│   │   ├── test_qa_llm_query_decomposition.py
│   │   ├── test_qa_llm_style_rewrite.py
│   │   ├── test_qa_pair_mining.py
│   │   ├── test_qrcode_ocr.py
│   │   ├── test_query_decomposition.py
│   │   ├── test_query_rewrite.py
│   │   ├── test_rag_baidu_search.py
│   │   ├── test_rag_baidu_search_pro.py
│   │   ├── test_rerank.py
│   │   ├── test_similar_question.py
│   │   ├── test_style_rewrite.py
│   │   ├── test_style_writing.py
│   │   ├── test_table_ocr.py
│   │   ├── test_tag_extraction.py
│   │   ├── test_text_to_image.py
│   │   ├── test_trace.py
│   │   ├── test_trace_skip_raise_error.py
│   │   ├── test_translate.py
│   │   ├── test_treemind.py
│   │   ├── test_tts.py
│   │   ├── test_utils.py
│   │   ├── test_utils_collector.py
│   │   ├── test_utils_logger.py
│   │   ├── test_utils_logging_util.py
│   │   ├── test_v2_animal_recognize.py
│   │   ├── test_v2_asr.py
│   │   ├── test_v2_component_trace.py
│   │   ├── test_v2_dialog_summary.py
│   │   ├── test_v2_general_ocr.py
│   │   ├── test_v2_hallucination_detection.py
│   │   ├── test_v2_handwrite_ocr.py
│   │   ├── test_v2_image_understand.py
│   │   ├── test_v2_is_complex_query.py
│   │   ├── test_v2_mix_card_ocr.py
│   │   ├── test_v2_mrc.py
│   │   ├── test_v2_nl2pandas.py
│   │   ├── test_v2_object_recognition.py
│   │   ├── test_v2_oral_query_generat.py
│   │   ├── test_v2_plant_recognize.py
│   │   ├── test_v2_qa_pair_mining.py
│   │   ├── test_v2_qrcode_ocr.py
│   │   ├── test_v2_query_decomposition.py
│   │   ├── test_v2_query_rewrite.py
│   │   ├── test_v2_similar_question.py
│   │   ├── test_v2_style_rewrite.py
│   │   ├── test_v2_style_writing.py
│   │   ├── test_v2_table_ocr.py
│   │   ├── test_v2_tag_extraction.py
│   │   ├── test_v2_text_to_image.py
│   │   ├── test_v2_translate.py
│   │   ├── test_v2_treemind.py
│   │   ├── test_vdb_retriever.py
│   │   └── title_splitter.docx
│   └── utils/
│       ├── __init__.py
│       ├── _bcc.py
│       ├── bce_deploy.py
│       ├── chainlit.md
│       ├── collector.py
│       ├── func_utils.py
│       ├── json_schema_to_model.py
│       ├── logger_file_headler.py
│       ├── logger_util.py
│       ├── model_util.py
│       ├── sse_util.py
│       └── trace/
│           ├── __init__.py
│           ├── _function.py
│           ├── phoenix_wrapper.py
│           ├── tracer.py
│           └── tracer_wrapper.py
├── requirements.txt
└── setup.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .env_template
================================================
# rename this file to .env

APPBUILDER_TOKEN=your-token
APPBUILDER_TOKEN_V2=your-token
BAIDU_VDB_API_KEY=your-token
INSTANCE_ID=your-token
DATASET_ID=your-token
APPBUILDER_TOKEN_DOC_FORMAT=your-token


================================================
FILE: .github/workflows/python-package.yml
================================================
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package

on:
  workflow_dispatch:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

jobs:
  Pylint:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.12.5"]

    steps:
    - uses: actions/checkout@v3
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v3
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        python -m pip install flake8 pytest
        python -m pip install chainlit~=1.0.200 flask~=2.3.2 flask-restful==0.3.9
        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
    - name: Lint with flake8
      run: |
        # stop the build if there are Python syntax errors or undefined names
        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
        # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
        flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

  Python312-CI-Tests:
    runs-on: ubuntu-latest
    env:
      APPBUILDER_TOKEN: ${{ secrets.APPBUILDER_TOKEN }}
      APPBUILDER_TOKEN_V2: ${{ secrets.APPBUILDER_TOKEN_V2 }}
      BAIDU_VDB_API_KEY: ${{ secrets.BAIDU_VDB_API_KEY }}
      INSTANCE_ID: ${{ secrets.INSTANCE_ID }}
      DATASET_ID: ${{ secrets.DATASET_ID }}
      APPBUILDER_TOKEN_DOC_FORMAT: ${{ secrets.APPBUILDER_TOKEN_DOC_FORMAT }}
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.12"]
    
    steps:
    - uses: actions/checkout@v4
      with:
        ref: ${{ github.event.pull_request.head.sha }}
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v3
      with:
        python-version: ${{ matrix.python-version }}
    - name: Print ENV
      run: |
        env
        ls
        pwd
    - name: Git Clone And Checkout Branch
      run: |
        fork_repo="https://github.com/$GITHUB_ACTOR/app-builder.git"
        mkdir cicd
        cd cicd
        git clone $fork_repo
        cd app-builder
        git checkout $GITHUB_HEAD_REF
        git remote add upstream https://github.com/baidubce/app-builder.git 
        git fetch upstream
        git remote -v
        git status

        # 找到当前分支与 upstream/master 的共同祖先提交
        merge_base=$(git merge-base HEAD upstream/master)
        echo "merge_base=$merge_base"

        # 比较当前分支与 merge_base 之间的差异
        changed_files=$(git diff --name-only --diff-filter=ACMRT $merge_base)
        changed_files_py_sh=$(git diff --name-only --diff-filter=ACMRT $merge_base -- $(find python -type f \( -name '*.py' -o -name '*.sh' \)))
        
        echo "发生更改的文件为:"
        echo "$changed_files"

        echo "发生更改的py/sh文件为:"

        if [ -n "$changed_files_py_sh" ]; then
          export APPBUILDER_PYTHON_TESTS=True
          echo "$changed_files_py_sh"
        else
          export APPBUILDER_PYTHON_TESTS=False
          echo "没有检测到Python或Shell文件被更改"
        fi

        echo "APPBUILDER_PYTHON_TESTS=$APPBUILDER_PYTHON_TESTS" >> $GITHUB_ENV
        pwd
    - name: Install dependencies
      run: |
        echo $APPBUILDER_PYTHON_TESTS
        if [ "$APPBUILDER_PYTHON_TESTS" = "False" ]; then
          echo "环境变量APPBUILDER_PYTHON_TESTS为False,没有检测到Python或Shell文件被更改,跳过Install dependencies部分。"
        else
          echo "检测到Python或Shell文件被更改(根据环境变量APPBUILDER_PYTHON_TESTS),准备启动单元测试Install dependencies部分..."
          cd cicd/app-builder
          pwd
          sudo apt-get update
          sudo apt-get install ffmpeg libavcodec-extra
          python3 -m ensurepip --upgrade
          python3 -m pip install --upgrade pip
          python3 -m pip install "setuptools<=76.1.0"
          python3 -m pip install wheel
          python3 -m pip install coverage
          python3 -m pip install diff-cover
          python3 -m pip install pydub
          python3 -m pip install SQLAlchemy==2.0.31
          python3 -m pip install chainlit~=1.0.200 flask~=2.3.2 flask-restful==0.3.9
          python3 -m pip install opentelemetry-exporter-otlp==1.23.0 opentelemetry-instrumentation==0.44b0 opentelemetry-sdk==1.23.0 opentelemetry-api==1.23.0
          python3 -m pip install pandas==2.2.2
          python3 -m pip install mcp ; true
        fi
    - name: Build whl
      run: |
        echo $APPBUILDER_PYTHON_TESTS
        if [ "$APPBUILDER_PYTHON_TESTS" = "False" ]; then
          echo "环境变量APPBUILDER_PYTHON_TESTS为False,没有检测到Python或Shell文件被更改,跳过Build whl部分。"
        else
          echo "检测到Python或Shell文件被更改(根据环境变量APPBUILDER_PYTHON_TESTS),准备启动单元测试Build whl部分..."
          cd cicd/app-builder     
          pwd
          python3 setup.py bdist_wheel
          python3 -m pip uninstall -y appbuilder-sdk
          python3 -m pip install dist/*.whl
        fi
    - name: Test with unittest
      run: |
        echo $APPBUILDER_PYTHON_TESTS
        if [ "$APPBUILDER_PYTHON_TESTS" = "False" ]; then
          echo "环境变量APPBUILDER_PYTHON_TESTS为False,没有检测到Python或Shell文件被更改,跳过Test with unittest部分。"
        else
          echo "检测到Python或Shell文件被更改(根据环境变量APPBUILDER_PYTHON_TESTS),准备启动单元测试Test with unittest部分..."
          cd cicd/app-builder
          pwd
          sh python/tests/run_python_test.sh
        fi

  Python39-CI-Tests:
    runs-on: ubuntu-latest
    env:
      APPBUILDER_TOKEN: ${{ secrets.APPBUILDER_TOKEN }}
      APPBUILDER_TOKEN_V2: ${{ secrets.APPBUILDER_TOKEN_V2 }}
      BAIDU_VDB_API_KEY: ${{ secrets.BAIDU_VDB_API_KEY }}
      INSTANCE_ID: ${{ secrets.INSTANCE_ID }}
      DATASET_ID: ${{ secrets.DATASET_ID }}
      APPBUILDER_TOKEN_DOC_FORMAT: ${{ secrets.APPBUILDER_TOKEN_DOC_FORMAT }}
    strategy:
      fail-fast: false
      matrix:
        python-version: ["3.9"]
    
    steps:
    - uses: actions/checkout@v4
      with:
        ref: ${{ github.event.pull_request.head.sha }}
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v3
      with:
        python-version: ${{ matrix.python-version }}
    - name: Print ENV
      run: |
        env
        ls
        pwd
    - name: Git Clone And Checkout Branch
      run: |
        fork_repo="https://github.com/$GITHUB_ACTOR/app-builder.git"
        mkdir cicd
        cd cicd
        git clone $fork_repo
        cd app-builder
        git checkout $GITHUB_HEAD_REF
        git remote add upstream https://github.com/baidubce/app-builder.git 
        git fetch upstream
        git remote -v
        git status

        # 找到当前分支与 upstream/master 的共同祖先提交
        merge_base=$(git merge-base HEAD upstream/master)
        echo "merge_base=$merge_base"

        # 比较当前分支与 merge_base 之间的差异
        changed_files=$(git diff --name-only --diff-filter=ACMRT $merge_base)
        changed_files_py_sh=$(git diff --name-only --diff-filter=ACMRT $merge_base -- $(find python -type f \( -name '*.py' -o -name '*.sh' \)))
        
        echo "发生更改的文件为:"
        echo "$changed_files"

        echo "发生更改的py/sh文件为:"

        if [ -n "$changed_files_py_sh" ]; then
          export APPBUILDER_PYTHON_TESTS=True
          echo "$changed_files_py_sh"
        else
          export APPBUILDER_PYTHON_TESTS=False
          echo "没有检测到Python或Shell文件被更改"
        fi

        echo "APPBUILDER_PYTHON_TESTS=$APPBUILDER_PYTHON_TESTS" >> $GITHUB_ENV
        pwd
    - name: Install dependencies
      run: |
        echo $APPBUILDER_PYTHON_TESTS
        if [ "$APPBUILDER_PYTHON_TESTS" = "False" ]; then
          echo "环境变量APPBUILDER_PYTHON_TESTS为False,没有检测到Python或Shell文件被更改,跳过Install dependencies部分。"
        else
          echo "检测到Python或Shell文件被更改(根据环境变量APPBUILDER_PYTHON_TESTS),准备启动单元测试Install dependencies部分..."
          cd cicd/app-builder
          pwd
          sudo apt-get update
          sudo apt-get install ffmpeg libavcodec-extra
          python3 -m ensurepip --upgrade
          python3 -m pip install --upgrade pip
          python3 -m pip install "setuptools<=76.1.0"
          python3 -m pip install wheel
          python3 -m pip install coverage
          python3 -m pip install diff-cover
          python3 -m pip install pydub
          python3 -m pip install SQLAlchemy==2.0.31
          python3 -m pip install chainlit~=1.0.200 flask~=2.3.2 flask-restful==0.3.9
          python3 -m pip install opentelemetry-exporter-otlp==1.23.0 opentelemetry-instrumentation==0.44b0 opentelemetry-sdk==1.23.0 opentelemetry-api==1.23.0
          python3 -m pip install pandas==2.2.2
        fi
    - name: Build whl
      run: |
        echo $APPBUILDER_PYTHON_TESTS
        if [ "$APPBUILDER_PYTHON_TESTS" = "False" ]; then
          echo "环境变量APPBUILDER_PYTHON_TESTS为False,没有检测到Python或Shell文件被更改,跳过Build whl部分。"
        else
          echo "检测到Python或Shell文件被更改(根据环境变量APPBUILDER_PYTHON_TESTS),准备启动单元测试Build whl部分..."
          cd cicd/app-builder     
          pwd
          python3 setup.py bdist_wheel
          python3 -m pip uninstall -y appbuilder-sdk
          python3 -m pip install dist/*.whl
        fi
    - name: Test with unittest
      run: |
        echo $APPBUILDER_PYTHON_TESTS
        if [ "$APPBUILDER_PYTHON_TESTS" = "False" ]; then
          echo "环境变量APPBUILDER_PYTHON_TESTS为False,没有检测到Python或Shell文件被更改,跳过Test with unittest部分。"
        else
          echo "检测到Python或Shell文件被更改(根据环境变量APPBUILDER_PYTHON_TESTS),准备启动单元测试Test with unittest部分..."
          cd cicd/app-builder
          pwd
          sh python/tests/run_python_test.sh
        fi
        
  Go-Test-CI:
    runs-on: ubuntu-latest
    env:
      APPBUILDER_TOKEN: ${{ secrets.APPBUILDER_TOKEN }}
      APPBUILDER_TOKEN_V2: ${{ secrets.APPBUILDER_TOKEN_V2 }}
      BAIDU_VDB_API_KEY: ${{ secrets.BAIDU_VDB_API_KEY }}
      INSTANCE_ID: ${{ secrets.INSTANCE_ID }}
      DATASET_ID: ${{ secrets.DATASET_ID }}
      APPBUILDER_TOKEN_DOC_FORMAT: ${{ secrets.APPBUILDER_TOKEN_DOC_FORMAT }}
 
      APPBUILDER_TOKEN_V3: ${{ secrets.APPBUILDER_TOKEN_V3 }}
      DATASET_ID_V3: ${{ secrets.DATASET_ID_V3 }}
      DOCUMENT_ID_V3: ${{ secrets.DOCUMENT_ID_V3 }}
    strategy:
      fail-fast: false
      matrix:
        go-version: ['1.18']
      max-parallel: 2

    steps:
    - name: Checkout code
      uses: actions/checkout@v3
      with:
        ref: ${{ github.event.pull_request.head.sha }}
    - name: Set up Go
      uses: actions/setup-go@v3
      with:
        go-version: ${{ matrix.go-version }}
    - name: Git Clone And Checkout Branch
      run: |
        fork_repo="https://github.com/$GITHUB_ACTOR/app-builder.git"
        mkdir cicd
        cd cicd
        git clone $fork_repo
        cd app-builder
        echo "github_head的值为:"
        echo $GITHUB_HEAD_REF
        git checkout $GITHUB_HEAD_REF
        git remote add upstream https://github.com/baidubce/app-builder.git 
        git fetch upstream
        git remote -v
        git status

        # 找到当前分支与 upstream/master 的共同祖先提交
        merge_base=$(git merge-base HEAD upstream/master)
        echo "merge_base=$merge_base"

        # 比较当前分支与 merge_base 之间的差异
        changed_files=$(git diff --name-only --diff-filter=ACMRT $merge_base)
        changed_files_go=$(git diff --name-only --diff-filter=ACMRT $merge_base -- 'go/**')

        echo "发生更改的文件为:"
        echo "$changed_files"
        echo "发生更改的Go相关文件为:"

        if [ -n "$changed_files_go" ]; then
          export APPBUILDER_GO_TESTS=True
          echo "$changed_files_go"
        else
          export APPBUILDER_GO_TESTS=False
          echo "没有检测到Go或Shell文件被更改"
        fi

        echo "APPBUILDER_GO_TESTS=$APPBUILDER_GO_TESTS" >> $GITHUB_ENV
    - name: Install dependencies and tools
      run: |
        echo $APPBUILDER_GO_TESTS
        if [ "$APPBUILDER_GO_TESTS" = "False" ]; then
          echo "环境变量APPBUILDER_GO_TESTS为False,没有检测到Go文件被更改,跳过Install dependencies and tools部分。"
        else
          echo "检测到Go文件被更改,准备启动Install dependencies and tools部分..."
          cd cicd/app-builder/go/appbuilder
          go mod tidy

          go get github.com/axw/gocov/gocov  # 安装增量覆盖率工具

          # 安装 golangci-lint
          curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.53.3
          echo "$GOPATH/bin" >> $GITHUB_PATH

        fi

    - name: Run tests and calculate incremental coverage
      run: |
        echo $APPBUILDER_GO_TESTS
        if [ "$APPBUILDER_GO_TESTS" = "False" ]; then
          echo "环境变量APPBUILDER_GO_TESTS为False,没有检测到Go文件被更改,跳过Run tests部分。"
        else
          echo "检测到Go文件被更改,准备启动Run tests部分..."
          cd cicd/app-builder/go
          # 运行测试并生成覆盖率报告
          chmod +x run_go_test.sh
          ./run_go_test.sh
        fi
      shell: bash
  Java-CI-Tests:
    runs-on: ubuntu-latest
    env:
      APPBUILDER_TOKEN: ${{ secrets.APPBUILDER_TOKEN }}
      APPBUILDER_TOKEN_V2: ${{ secrets.APPBUILDER_TOKEN_V2 }}
      BAIDU_VDB_API_KEY: ${{ secrets.BAIDU_VDB_API_KEY }}
      INSTANCE_ID: ${{ secrets.INSTANCE_ID }}
      DATASET_ID: ${{ secrets.DATASET_ID }}
      APPBUILDER_TOKEN_DOC_FORMAT: ${{ secrets.APPBUILDER_TOKEN_DOC_FORMAT }}
 
      APPBUILDER_TOKEN_V3: ${{ secrets.APPBUILDER_TOKEN_V3 }}
      DATASET_ID_V3: ${{ secrets.DATASET_ID_V3 }}
      DOCUMENT_ID_V3: ${{ secrets.DOCUMENT_ID_V3 }}
    strategy:
      fail-fast: false
      matrix:
        java-version: ['8']  # 使用 Java 11 和 17 作为示例

    steps:
    - name: Checkout code
      uses: actions/checkout@v3
      with:
        ref: ${{ github.event.pull_request.head.sha }}
    
    - name: Set up JDK ${{ matrix.java-version }}
      uses: actions/setup-java@v3
      with:
        java-version: ${{ matrix.java-version }}
        distribution: 'temurin'

    - name: Print ENV
      run: |
        env
        ls
        pwd

    - name: Git Clone And Checkout Branch
      run: |
        fork_repo="https://github.com/$GITHUB_ACTOR/app-builder.git"
        mkdir cicd
        cd cicd
        git clone $fork_repo
        cd app-builder
        git checkout $GITHUB_HEAD_REF
        git remote add upstream https://github.com/baidubce/app-builder.git 
        git fetch upstream
        git remote -v
        git status

        # 找到当前分支与 upstream/master 的共同祖先提交
        merge_base=$(git merge-base HEAD upstream/master)
        echo "merge_base=$merge_base"

        # 比较当前分支与 merge_base 之间的差异
        changed_files=$(git diff --name-only --diff-filter=ACMRT $merge_base)
        changed_files_java=$(git diff --name-only --diff-filter=ACMRT $merge_base -- 'java/**')
        
        echo "发生更改的文件为:"
        echo "$changed_files"

        echo "发生更改的Java相关文件为:"

        if [ -n "$changed_files_java" ]; then
          export APPBUILDER_JAVA_TESTS=True
          echo "$changed_files_java"
        else
          export APPBUILDER_JAVA_TESTS=False
          echo "没有检测到Java文件被更改"
        fi

        echo "APPBUILDER_JAVA_TESTS=$APPBUILDER_JAVA_TESTS" >> $GITHUB_ENV
        pwd

    - name: Install Python dependencies
      run: |
        python -m pip install --upgrade pip
        pip install gitpython lxml
    - name: Install dependencies
      run: |
        echo $APPBUILDER_JAVA_TESTS
        if [ "$APPBUILDER_JAVA_TESTS" = "False" ]; then
          echo "环境变量APPBUILDER_JAVA_TESTS为False,没有检测到Java文件被更改,跳过Install dependencies部分。"
        else
          echo "检测到Java文件被更改(根据环境变量APPBUILDER_JAVA_TESTS),准备启动单元测试Install dependencies部分..."
          cd cicd/app-builder/java
          mvn clean install -DskipTests
        fi
 
    - name: Run Java tests with Jacoco
      if: env.APPBUILDER_JAVA_TESTS == 'True'
      run: |
        echo "检测到Java文件被更改(根据环境变量APPBUILDER_JAVA_TESTS),准备启动Run Java tests with Jacoco部分..."
        cd cicd/app-builder/java
        bash print_coverage.sh



================================================
FILE: CONTRIBUTING.md
================================================
# Contributing to AppBuilder

Thanks for your interest in contributing to AppBuilder!  Please follow these guidelines to make the contribution process easy and effective for everyone involved.


## Contributing Guide for python SDK

### Development

Clone the source code from Github

```
git clone https://github.com/baidubce/app-builder.git
```

Use `pip` to install from source

```shell
cd appbuilder
pip install -e .
```

`-e` means "editable mode" in pip. With "editable mode" all changes to python code will immediately become effective in the current environment.

### Testing

We highly recommend writing tests for new features or bug fixes and ensure all tests passing before submitting a PR.

AppBuilder uses [unittest](https://docs.python.org/3/library/unittest.html) as the test framework, requires no 3rd party dependencies to install.

Before running tests, make sure add the following environment variables:

```shell
export TEST_CASE=CPU_PARALLEL
export APPBUILDER_TOKEN=<your_token>
```


To run all existing test cases together, run

```
pip install -e .[all]
sh appbuilder/tests/run_python_test.sh
```

If you only want to run specific test file, e.g.:

```
python appbuilder/tests/test_playground.py
```


To debug tests in vs code update .env file to roo folder of the project:
```
APPBUILDER_TOKEN=<your-token>
APPBUILDER_TOKEN_V2=<your-token>
TEST_CASE=CPU_SERIAL
```

and add/update `.vscode/settings.json` file with the following content:

```
{
    "python.testing.unittestArgs": [
        "-v",
        "-s",
        "./python",
        "-p",
        "test*.py"
    ],
    "python.testing.unittestEnabled": true,
    "python.envFile": "${workspaceFolder}/.env"
}
```



================================================
FILE: LICENSE
================================================
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright (c) 2023 Baidu, Inc. All Rights Reserved.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: NEW_README.md
================================================
<div align="center">
<img src='docs/image/logo.png' alt='logo' width='700' >
<br>

[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](LICENSE)
![Supported Python versions](https://img.shields.io/badge/python-3.9+-orange.svg)
![Supported OSs](https://img.shields.io/badge/os-linux%2C%20win%2C%20mac-yellow.svg)
</div>

简体中文 | [English](./docs/README_en.md) | [日本語](./docs/README_ja.md)

<br>

## 🚀 欢迎使用 AppBuilder-SDK

AppBuilder-SDK 是百度智能云千帆AppBuilder面向AI原生应用开发者提供的一站式开发平台客户端SDK。无论你是AI新手还是资深开发者,都能在这里找到适合你的AI应用开发方案。

### ✨ 为什么选择 AppBuilder-SDK?

| 特性 | 描述 | 优势 |
|------|------|------|
| 丰富的AI能力 | 40+个百度生态优质组件 | 开箱即用,无需重复开发 |
| 灵活的部署方式 | 支持本地、云端、API等多种部署 | 适应不同场景需求 |
| 完整的开发工具 | 提供监控、调试、追踪等工具 | 提升开发效率 |
| 活跃的社区支持 | 微信交流群、Github社区 | 快速解决问题 |

### 🎯 我能用 AppBuilder-SDK 做什么?

#### 1. 构建智能应用
- **RAG应用**:构建基于知识库的智能问答系统,支持文档解析、切片、向量化、检索等完整流程
- **Agent应用**:开发具有自主决策能力的AI助手,支持工具调用、多轮对话、状态管理
- **工作流应用**:通过可视化编排或代码方式构建复杂的AI处理流程

#### 2. 调用AI能力
- **大模型调用**:支持多种大模型,可自定义prompt
- **组件调用**:40+个百度生态优质组件
- **MCP组件**:支持将本地组件转换为MCP服务

#### 3. 部署与监控
- **多种部署方式**:支持Flask、Chainlit、公有云部署
- **完整的监控工具**:提供可视化Tracing、DebugLog等

### 🛠️ 快速开始

#### 1. 环境要求
- Python >= 3.9
- 使用MCP组件功能需要 Python >= 3.12
- 支持的操作系统:Linux、Windows、MacOS

#### 2. 安装SDK
```bash
python3 -m pip install --upgrade appbuilder-sdk
```

#### 3. 选择你的开发路径

<div align="center">
<img src='docs/image/quickstart-flow.png' alt='quickstart-flow' width='600' >
</div>

| 开发路径 | 适合人群 | 推荐文档 |
|---------|---------|---------|
| 新手入门 | 刚接触AI开发 | [快速开始指南](./docs/QuickStart/StartFirstAINativeApplication/README.md) |
| 组件开发 | 想开发自定义组件 | [MCP组件开发指南](./cookbooks/mcp/server.ipynb) |
| 应用开发 | 已有AI开发经验 | [应用开发指南](./docs/Application/README.md) |

### 📚 学习资源

#### 1. 基础教程
- [组件使用示例](./cookbooks/components/README.md)
- [工作流编排指南](./cookbooks/pipeline/README.md)
- [端到端应用示例](./cookbooks/end2end_application/README.md)

#### 2. 进阶教程
- [MCP组件开发](./cookbooks/mcp/README.md)
- [公有云部署](./cookbooks/advanced_application/cloud_deploy.ipynb)
- [性能优化指南](./docs/DevelopGuide/AdvancedDevelopment/README.md)

### 🔥 最新特性:MCP组件支持

AppBuilder-SDK 最新版本支持将本地组件转换为MCP服务,实现端云组件联动。主要特性包括:

| 特性 | 描述 | 文档链接 |
|------|------|---------|
| 组件服务化 | 将本地组件转换为MCP服务 | [MCP组件开发指南](./cookbooks/mcp/server.ipynb) |
| 端云联动 | 实现本地组件与云端组件的联动 | [端云组件联动示例](./cookbooks/end2end_application/agent/tool_call.ipynb) |

### 💡 快速示例

#### 1. 调用大模型
```python
import appbuilder
import os

# 设置环境中的TOKEN
os.environ["APPBUILDER_TOKEN"] = "your-token-here"

# 定义prompt模板
template_str = "你扮演{role}, 请回答我的问题。\n\n问题:{question}。\n\n回答:"

# 定义输入,调用playground组件
input = appbuilder.Message({"role": "java工程师", "question": "请简要回答java语言的内存回收机制是什么,要求100字以内"})

playground = appbuilder.Playground(prompt_template=template_str, model="DeepSeek-V3.1")

# 以打字机的方式,流式展示大模型回答内容
output = playground(input, stream=True, temperature=1e-10)
for stream_message in output.content:
    print(stream_message)
```

#### 2. 调用能力组件
```python
import appbuilder
import os

# 设置环境中的TOKEN
os.environ["APPBUILDER_TOKEN"] = "your-token-here"

# 创建组件实例
rag_with_baidu_search_pro = appbuilder.RagWithBaiduSearchPro(model="DeepSeek-V3.1")

# 执行组件
input = appbuilder.Message("9.11和9.8哪个大")
result = rag_with_baidu_search_pro.run(
    message=input,
    instruction=appbuilder.Message("你是专业知识助手"))

# 输出运行结果
print(result.model_dump_json(indent=4))
```

#### 3. 使用MCP组件
```python
import os
from appbuilder.mcp_server.server import MCPComponentServer
from appbuilder.core.components.v2 import Translation, Text2Image

os.environ['APPBUILDER_TOKEN'] = 'your-token-here'

# 定义server
server = MCPComponentServer(name="AB Component Server")

# 初始化组件实例
translation = Translation()
text2image = Text2Image()

# 把组件作为tool添加到server
server.add_component(translation)
server.add_component(text2image)

# 启动server
server.run()
```

### 🤝 加入社区

<div align="center">
<h3>加入我们的微信交流群</h3>
<img src='docs/image/wechat_group.png' alt='wechat' width='200' >
</div>

- [Github Issue](https://github.com/baidubce/app-builder/issues): 提交问题、报告bug、建议新特性
- [百度智能云千帆社区](https://cloud.baidu.com/qianfandev): 参与社区活动、获取最新资讯

### 📄 文档导航

- [完整文档目录](./docs/README.md)
- [API参考](./docs/API/README.md)
- [更新日志](./docs/DevelopGuide/ChangeLog/changelog.md)
- [常见问题](./docs/DevelopGuide/ErrorMessage/error_message.md)

## License

AppBuilder-SDK遵循Apache-2.0开源协议。 

================================================
FILE: README.md
================================================
<div align="center">
<img src='docs/image/logo.png' alt='logo' width='700' >
<br>

[![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](LICENSE)
![Supported Python versions](https://img.shields.io/badge/python-3.9+-orange.svg)
![Supported OSs](https://img.shields.io/badge/os-linux%2C%20win%2C%20mac-yellow.svg)
</div>

简体中文 | [English](./docs/README_en.md) | [日本語](./docs/README_ja.md)

<br>


## 什么是AppBuilder-SDK

百度智能云千帆AppBuilder-SDK是[百度智能云千帆AppBuilder](https://appbuilder.cloud.baidu.com/)面向AI原生应用开发者提供的一站式开发平台的客户端SDK。

### AppBuilder-SDK 有哪些功能?

百度智能云千帆AppBuilder-SDK提供了以下AI应用开发者的必备功能:

- **调用**
    - 调用大模型,可自由调用您在[百度智能云千帆大模型平台](https://qianfan.cloud.baidu.com/)的模型,开发并调优prompt
    - 调用能力组件,提供40+个源于百度生态的[优质组件](https://cloud.baidu.com/doc/AppBuilder/s/Glqb6dfiz#3%E3%80%81%E5%BC%80%E9%80%9A%E7%BB%84%E4%BB%B6%E6%9C%8D%E5%8A%A1),赋能Agent应用
    - 调用AI原生应用,通过[AppBuilderClient](/docs/BasisModule/Platform/Application/appbuilder_client.md)可访问并管理在百度智能云千帆AppBuilder[网页端](https://console.bce.baidu.com/ai_apaas/app)发布的AI原生应用,并可注册本地函数联动端云组件
- **编排**
    - 配置知识库,通过[KnowledgeBase](/docs/BasisModule/Platform/KnowledgeBase/knowledgebase.md)管理知识库,进行文档及知识切片的增删改查,配合[网页端](https://console.bce.baidu.com/ai_apaas/app)开发产业级的`RAG`应用
    - 编排工作流,提供了`Message`、`Component`、`AgentRuntime`多级工作流抽象,实现工作流编排,并可与LangChain、OpenAI等业界生态能力打通
- **监控**
    - 提供了可视化Tracing、详细DebugLog等监控工具,助力开发者在生产环境应用
- **部署**
    - `AgentRuntime`支持部署为基于`Flask`与`gunicorn`的API服务
    - `AgentRuntime`支持部署为基于`Chainlit`的对话框交互前端
    - 提供了`appbuilder_bce_deploy`工具,可快速部署程序到百度云,提供公网API服务,联动AppBuilder工作流

### 使用 AppBuilder-SDK 可以构建什么应用?

#### **产业级RAG应用**

AppBuilder-SDK提供多类型组件,覆盖以下构建产业级`RAG`应用的完整步骤:
- 文档解析(Parser)
- 文档切片(Chunker)
- 切片向量化(Embedding)
- 索引构建(Indexing)
- 切片召回(Retrieval)
- 答案生成(Answer Generation)

AppBuilder-SDK不仅提供了百度智能云提供的基础能力组件,同时提供经过深度优化的大模型高级能力组件,可以组合下表提供的原子能力组件,构建个性化的RAG应用[RAG 原子能力 CookBook](./cookbooks/end2end_application/rag/rag.ipynb):


| 阶段 |组件名称 | 组件类型 |组件链接 |
|--------|--------|--------|---|
| 文档解析 | 文档矫正增强 (DocCropEnhance) | 基础能力组件 | [链接](./python/core/components/doc_crop_enhance/README.md) |
| 文档解析 | 文档格式转换 (DocFormatConverter) | 基础能力组件 | [链接](./python/core/components/doc_format_converter/README.md)|
| 文档解析 | 文档解析(DocParser)| 基础能力组件 | [链接](./python/core/components/doc_parser/README.md) |
| 文档解析 | 表格抽取组件(ExtractTableFromDoc)| 基础能力组件 | [链接](./python/core/components/extract_table/README.md) |
| 文档解析 | 通用文字识别-高精度版(GeneralOCR)| 基础能力组件 | [链接](./python/core/components/general_ocr/README.md) |
| 文档切片 | 文档切分(DocSplitter)| 基础能力组件 | [链接](./python/core/components/doc_splitter/README.md) |
| 切片向量化 | 向量计算(Embedding) | 基础能力组件 | [链接](./python/core/components/embeddings/README.md) |
| 索引构建及切片召回 | 向量检索-VectorDB(BaiduVectorDBRetriever) | 基础能力组件 | [链接](./python/core/components/retriever/baidu_vdb/README.md) |
| 索引构建及切片召回 | 向量检索-BES(BaiduElasticSearchRetriever) | 基础能力组件 | [链接](./python/core/components/retriever/bes/README.md) |
| 文档切片及答案生成 | 问答对挖掘(QAPairMining)| 高级能力组件 | [链接](./python/core/components/llms/qa_pair_mining/README.md) |
| 文档切片及答案生成 | 相似问生成(SimilarQuestion)| 高级能力组件 | [链接](./python/core/components/llms/similar_question/README.md) |
| 答案生成| 标签抽取(TagExtraction)| 高级能力组件 | [链接](./python/core/components/llms/tag_extraction/README.md) |
| 答案生成 | 复杂Query判定(IsComplexQuery)| 高级能力组件 | [链接](./python/core/components/llms/is_complex_query/README.md) |
| 答案生成 | 复杂Query分解(QueryDecomposition)| 高级能力组件 | [链接](./python/core/components/llms/query_decomposition/README.md) |
| 答案生成 | 多轮改写 (QueryRewrite)| 高级能力组件 | [链接](./python/core/components/llms/query_rewrite/README.md) |
| 答案生成 | 阅读理解问答(MRC)| 高级能力组件 | [链接](./python/core/components/llms/mrc/README.md) |
| 答案生成 | 幻觉检测(Hallucination Detection)| 高级能力组件 | [链接](./python/core/components/llms/hallucination_detection/README.md) |





##  如何安装AppBuilder-SDK

#### 百度智能云千帆AppBuilder-SDK 最新版本 1.1.0 (2025-06-20)

百度智能云千帆AppBuilder-SDK 更新记录&最新特性请查阅我们的[版本说明](/docs/DevelopGuide/ChangeLog/changelog.md)

- `Python`版本安装,要求Python版本 >= `3.9`

```bash
python3 -m pip install --upgrade appbuilder-sdk
```
- `Java` 及 `Go` 版本安装,以及通过`Docker`镜像使用,请查阅[安装说明](/docs/QuickStart/StartFirstAINativeApplication/install.md)


## 快速开始你的AI原生应用开发之旅
> - 请在`>=3.9`的Python环境安装`appbuilder-sdk`后使用该端到端应用示例
> - 示例中使用请替换为您的个人Token


### 1. 调用大模型
- 使用`Playground`组件可自由调用,您在百度智能云千帆大模型平台有权限的任何模型,并可自定义`prompt`模板 与 模型参数

#### 代码示例

```python
import appbuilder
import os

# 设置环境中的TOKEN,请替换为您的个人TOKEN
os.environ["APPBUILDER_TOKEN"] = "your api key"

# 定义prompt模板
template_str = "你扮演{role}, 请回答我的问题。\n\n问题:{question}。\n\n回答:"

# 定义输入,调用playground组件
input = appbuilder.Message({"role": "java工程师", "question": "请简要回答java语言的内存回收机制是什么,要求100字以内"})

playground = appbuilder.Playground(prompt_template=template_str, model="DeepSeek-V3.1")

# 以打字机的方式,流式展示大模型回答内容
output = playground(input, stream=True, temperature=1e-10)
for stream_message in output.content:
    print(stream_message)
    
# 流式输出结束后,可再次打印完整的大模型对话结果,除回答内容外,还包括token的用量情况
print(output.model_dump_json(indent=4))

```
#### 回答展示

```shell
Java语言的
内存回收机制是通过垃圾回收器(Garbage Collector)来实现的。
垃圾回收器会自动检测不再使用的对象,并释放其占用的内存空间,从而确保系统的内存不会被耗尽。
Java提供了多种垃圾回收器,如串行回收器、并行回收器、CMS回收器和G1回收器等,以满足不同场景下的性能需求
。

{
    "content": "Java语言的内存回收机制是通过垃圾回收器(Garbage Collector)来实现的。垃圾回收器会自动检测不再使用的对象,并释放其占用的内存空间,从而确保系统的内存不会被耗尽。Java提供了多种垃圾回收器,如串行回收器、并行回收器、CMS回收器和G1回收器等,以满足不同场景下的性能需求。",
    "name": "msg",
    "mtype": "dict",
    "id": "2bbee989-40e3-45e4-9802-e144cdc829a9",
    "extra": {},
    "token_usage": {
        "prompt_tokens": 35,
        "completion_tokens": 70,
        "total_tokens": 105
    }
}
```

### 2. 调用能力组件
- SDK提供了40+个源于百度生态的优质组件,列表可见[组件列表](https://cloud.baidu.com/doc/AppBuilder/s/Glqb6dfiz#3%E3%80%81%E5%BC%80%E9%80%9A%E7%BB%84%E4%BB%B6%E6%9C%8D%E5%8A%A1), 调用前需要申领[免费试用额度](https://console.bce.baidu.com/ai-engine/old/#/ai/ocr/overview/resource/list)
- 示例中的组件为`RAG with Baidu Search增强版`, 结合百度搜索的搜索引擎技术和ERNIE模型的语义理解能力,可以更准确地理解用户的搜索意图,并提供与搜索查询相关性更高的搜索结果

#### 代码示例
```python
import appbuilder
import os

# 设置环境中的TOKEN,使用请替换为您的个人TOKEN
os.environ["APPBUILDER_TOKEN"] = "your api key"

rag_with_baidu_search_pro = appbuilder.RagWithBaiduSearchPro(model="DeepSeek-V3.1")

input = appbuilder.Message("9.11和9.8哪个大")
result = rag_with_baidu_search_pro.run(
    message=input,
    instruction=appbuilder.Message("你是专业知识助手"))

# 输出运行结果
print(result.model_dump_json(indent=4))
```

#### 回答展示
```shell
{
    "content": "9.11小于9.8。在比较两个小数的大小时,需要逐位比较它们的数值,包括整数部分和小数部分。对于9.11和9.8,整数部分都是9,所以需要在小数部分进行比较。小数点后的第一位是1和8,显然1小于8,所以9.11小于9.8。",
    "name": "msg",
    "mtype": "dict",
    "id": "eb31b7de-dd6a-485f-adb9-1f7921a6f4bf",
    "extra": {
        "search_baidu": [
            {
                "content": "大模型‘智商’受质疑:9.11 vs 9...",
                "icon": "https://appbuilder.bj.bcebos.com/baidu-search-rag-pro/icon/souhu.ico",
                "url": "https://m.sohu.com/a/793754123_121924584/",
                "ref_id": "2",
                "site_name": "搜狐网",
                "title": "大模型‘智商’受质疑:9.11 vs 9.8的比较揭示AI理解能力的..."
            },
            {
                "content": "究竟|9.11比9.8大?大模型们为何会...",
                "icon": "https://appbuilder.bj.bcebos.com/baidu-search-rag-pro/icon/tencent.svg.png",
                "url": "https://new.qq.com/rain/a/20240717A07JLV00",
                "ref_id": "4",
                "site_name": "腾讯网",
                "title": "究竟|9.11比9.8大?大模型们为何会在小学数学题上集体..."
            },
            ...
        ]
    },
    "token_usage": {
        "completion_tokens": 77,
        "prompt_tokens": 2008,
        "total_tokens": 2085
    }
}
```


### 3. 调用AI原生应用
- 示例中的应用为:[说唱导师](https://appbuilder.baidu.com/s/3qfjXy7k),点击该连接在网页端试用

#### 代码示例

```python
import appbuilder
import os

# 设置环境中的TOKEN,请替换为您的个人TOKEN
os.environ["APPBUILDER_TOKEN"] = "your api key"

# 从AppBuilder网页获取并传入应用ID,以下为说唱导师应用ID
app_id = "4678492a-5864-472e-810a-654538d3503c"

app_builder_client = appbuilder.AppBuilderClient(app_id)
conversation_id = app_builder_client.create_conversation()

answer = app_builder_client.run(conversation_id, "以“上班狼狈却又追逐梦想“为主题进行一首说唱创作,保持押韵, 控制在200字以内")
print(answer.content.answer)
```

#### 回答展示
```shell
好的,我们来以“上班狼狈却又追逐梦想”为主题,进行一段简短的说唱创作。这里是一个简单的示例,你可以根据自己的感觉进行调整:

Intro:
朝九晚五,生活重压,
狼狈上班,却心怀梦想,
每一天,都是新的挑战,
为了那未来,我奋发向前。

Verse 1:
穿上西装,打好领带,
步入人群,去追逐名利,
虽然狼狈,却不曾言败,
因为心中,有梦想在激励。

Hook:
上班狼狈,却不曾放弃,
追逐梦想,是我心中的火炬,
照亮前路,指引我前行,
无论多难,我都要坚持到底。

这首小曲儿以“上班狼狈却又追逐梦想”为主题,通过押韵的方式表达了上班族虽然生活艰辛,但依然怀揣梦想,勇往直前的精神。希望你喜欢!
```

#### 更多示例

- 更多AI原生应用示例,请浏览[应用广场](https://console.bce.baidu.com/ai_apaas/appCenter)
- 更多代码Cookbook,请浏览 [Cookbooks](./cookbooks/README.md),我们有以下cookbook推荐您优先阅读:

| 应用类型 |应用链接 | 推荐理由 |
|--|--|--|
| 基础能力组件 | [通用文字识别](/cookbooks/components/general_ocr.ipynb) | 体验百度AI开放平台提供的通用文字识别-高精度版的精准识别结果 |
| 基础能力组件 | [基础组件服务化](/cookbooks/components/agent_runtime.ipynb) | 基础组件可通过flask实现服务化部署 或 通过chainlit实现可交互的前端部署,集成到您的系统中 |
| 流程编排 |  [Assistant SDK](/cookbooks/pipeline/assistant_function_call.ipynb) | 学习如何纯代码态搭建一个Agent应用,并实现自定义工作流程及FunctionCall |
| 端到端应用 |  [AppBuilder Client SDK](/cookbooks/agent_builder.ipynb) | 使用AppBuilder网页端创建并发布一个Agent应用后,通过AppBuilderClient SDK集成到你的系统中 |
| 端到端应用 |  [Agent应用-工作流Agent](/cookbooks/end2end_application/agent/chatflow.ipynb) | 使用AppBuilder网页端创建并发布一个工作流Agent应用后,通过AppBuilderClient SDK集成到你的系统中 |
| 端到端应用 |  [通过AppBuilder-ToolCall功能实现端云组件联动的Agent](/cookbooks/end2end_application/agent/tool_call.ipynb) | 学习Agent、FunctionCall的知识,并构造调用本地组件的Agent |
| 端到端应用 |  [简历筛选小助手](/cookbooks/end2end_application/rag/rag.ipynb) | 通过对本地简历库的简历进行解析、切片、创建索引,实现基于JD进行简历筛选,并对筛选的Top1简历进行总结 |
| 端到端应用 |  [企业级问答系统](/cookbooks/end2end_application/rag/qa_system_2_dialogue.ipynb) | 学习如何通过SDK与网页平台搭配,实现离线知识库生产与在线问答 |
| 进阶应用 |  [使用appbuilder_bce_deploy部署公有云服务](/cookbooks/advanced_application/cloud_deploy.ipynb) | 一键将自己的服务部署到百度智能云,部署后可以自动生成公网ip,联动工作流的API节点 |
| 进阶应用 |  [使用appbuilder_trace_server实现对使用状态的跟踪](/cookbooks/appbuilder_trace/trace.ipynb) | 使用Appbuilder-SDK Trace功能实现对组件、应用调用情况的追踪|


## 百度智能云千帆AppBuilder-SDK 能力全景图
<div align="center">
<img src='docs/image/structure-cn.png' alt='wechat' width='800' >
</div>


## 用户文档

## Github 文档
- [首页](https://github.com/baidubce/app-builder/blob/master/docs/README.md)
    - 快速上手: 
        - 开始你的第一个AI原生应用: 
            - [安装](https://github.com/baidubce/app-builder/blob/master/docs/QuickStart/StartFirstAINativeApplication/install.md)
            - [快速开始](https://github.com/baidubce/app-builder/blob/master/docs/QuickStart/StartFirstAINativeApplication/README.md)
        - 产业实践应用范例: 
            - [SDK使用示例](https://github.com/baidubce/app-builder/blob/master/docs/QuickStart/ExamplesOfIndustrialPracticeApplications/README.md)
        - [SDK当前支持的编程语言](https://github.com/baidubce/app-builder/blob/master/docs/QuickStart/CurrentlySupportedProgrammingLanguages/README.md)
    - 基础:
        - 模型:
            - [获取模型列表](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Model/get_model_list.md)
        - [组件](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Components)
        - 监控:
            - [TRACE基础功能](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/basic.md)
            - [TRACE拓展功能](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Trace/phoenix_method.md)
        - 部署:
            - [交互式前端部署](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/AgentChainlit.md)
            - [公有云部署](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/cloud.md)
            - [API 访问](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/flask.md)
            - [AgentRuntime](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/agentruntime.md)
            - [UserSession](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Deployment/usersession.md)
        - 平台:
            - 应用:
                - [AppBuilderClient组件](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/Application/appbuilder_client.md)
                - [获取AppBuilder已发布的应用列表](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/Application/get_app_list.md)
            - 知识库:
                - [知识库组件](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/KnowledgeBase/knowledgebase.md)
            - 自定义组件:
                - [基础能力组件](https://github.com/baidubce/app-builder/blob/master/docs/BasisModule/Platform/CustomComponents/components.md)
    - 应用:
        - Agent:
            - [基础知识](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/BasicKnowledge/agent.md)
            - [使用官方组件](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/UseOfficialComponents/use_official_components.md)
            - [ToolCall](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/ToolCall/tool_call.md)
            - [ToolChoice](https://github.com/baidubce/app-builder/blob/master/docs/Application/Agent/ToolChoice/tool_choice.md)
            - [使用异步和流式加速客户端调用](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
        - RAG:
            - [基础知识](https://github.com/baidubce/app-builder/blob/master/docs/Application/RAG/BasicKnowledge/rag.md)
            - [知识库管理](https://github.com/baidubce/app-builder/blob/master/docs/Application/RAG/DatasetManage/dataset_manage.md)
            - [Reference信息处理](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
        - Workflow:
            - [基础知识](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
            - [从零使用Workflow组装一个RAG应用](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
            - [从零使用Workflow组装一个Agent应用](https://github.com/baidubce/app-builder/blob/master/docs/Tools/DocPass/DocPass.md)
    - 开发者指南:
        - [如何贡献代码](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/HowToContributeCode/README.md)
        - [二次开发](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/AdvancedDevelopment/README.md)
        - [版本升级日志](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/ChangeLog/changelog.md)
        - [错误信息](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/ErrorMessage/error_message.md)
        - [环境参数](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/EnvironmentalParameters/env.md)


## 开源社区与活动
<div align="center">
<h3>百度智能云千帆AppBuilder-SDK微信交流群</h3>
<img src='docs/image/wechat_group.png' alt='wechat' width='200' >
</div>

- [Github Issue](https://github.com/baidubce/app-builder/issues):  提交安装/使用问题、报告bug、建议新特性、沟通开发计划等

- [百度智能云千帆社区](https://cloud.baidu.com/qianfandev)

## License

AppBuilder-SDK遵循Apache-2.0开源协议。



================================================
FILE: cookbooks/README.md
================================================
# AppBuilder-SDK Cookbook

## Cookbook目录

### 基础组件
- [短语音识别组件-asr](/cookbooks/components/asr.ipynb)
- [gbi - 自动选表问表](/cookbooks/components/gbi.ipynb)
- [general_ocr - 通用文字识别](/cookbooks/components/general_ocr.ipynb)
- [object_recognize - 通用物体识别](/cookbooks/components/object_recognize.ipynb)
- [rag_with_baidusearch - 百度搜索](/cookbooks/components/rag_with_baidusearch.ipynb)
- [text_generation - 文本生成](/cookbooks/components/text_generation.ipynb)
- [translate - 文本翻译](/cookbooks/components/translate.ipynb)
- [vdb_retriever - VectorDB向量存储](/cookbooks/components/vdb_retriever.ipynb)


### 流程编排
- [基于AssistantSDK 实现FunctionCall](/cookbooks/pipeline/assistant_function_call.ipynb)
- [AssistantSDK assistant函数演示](/cookbooks/pipeline/assistant.ipynb)
- [AssistantSDK file函数演示](/cookbooks/pipeline/file.ipynb)
- [AssistantSDK message函数演示](/cookbooks/pipeline/message.ipynb)
- [AssistantSDK run函数演示](/cookbooks/pipeline/run.ipynb)
- [AssistantSDK thread函数演示](/cookbooks/pipeline/thread.ipynb)


### 端到端应用
- [Agent应用](/cookbooks/end2end_application/agent/appbuilder_client.ipynb)
- [Agent应用-工作流Agent](/cookbooks/end2end_application/agent/chatflow.ipynb)
- [RAG应用-简历筛选小助手](/cookbooks/end2end_application/rag/rag.ipynb)
- [RAG应用-问答助手](/cookbooks/end2end_application/rag/console_rag.ipynb)
- [RAG应用-企业问答系统-离线知识生产](/cookbooks/end2end_application/rag/qa_system_1_dataset.ipynb)
- [RAG应用-企业问答系统-在线问答流程](/cookbooks/end2end_application/rag/qa_system_2_dialogue.ipynb)
- [知识库操作助手](/cookbooks/end2end_application/rag/console_dataset.ipynb)
- [通过AppBuilder-ToolCall功能实现端云组件联动的Agent](/cookbooks/end2end_application/agent/tool_call.ipynb) 

### 进阶应用
- [公有云部署](/cookbooks/advanced_application/cloud_deploy.ipynb)

### 辅助工具
- [Appbuilder-Trace工具](/cookbooks/appbuilder_trace/trace.ipynb)


================================================
FILE: cookbooks/advanced_application/agent_speech.ipynb
================================================
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 实时语音对话能力\n",
    "**注意⚠️:实时语音功能目前处于内测阶段,使用过程中有任何问题,欢迎提issue或微信群反馈~**\n",
    "\n",
    "## 目标\n",
    "实现一个实时语音对话功能,支持多种语音音色。用户可以参考cookbook代码,通过AppBuilder-SDK将实时语音功能很好地融入自己的平台、应用中。\n",
    "\n",
    "## 实现原理\n",
    "通过循环不断处理用户的语音,将语音转文本,然后进行对话,最后将对话结果通过TTS进行播报。。\n",
    "* 使用大模型的 ASR 进行语音转文本。\n",
    "* 使用用户自己创建的Agent进行对话,适配用户的应用场景,并具有上下文理解能力。\n",
    "* 使用大模型的 TTS 进行文本转语音并进行播报。\n",
    "\n",
    "## 前置条件\n",
    "* 使用内置ASR、TTS组件之前,请先开通组件服务并够买额度,可参考[开通组件服务](https://cloud.baidu.com/doc/AppBuilder/s/Glqb6dfiz#3%E3%80%81%E5%BC%80%E9%80%9A%E7%BB%84%E4%BB%B6%E6%9C%8D%E5%8A%A1)\n",
    "* pip安装pyaudio、webrtcvad依赖包\n",
    "* 给程序开放麦克风权限\n",
    "* 创建好自己的Agent应用\n",
    "\n",
    "## 示例代码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n",
    "#\n",
    "# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
    "# you may not use this file except in compliance with the License.\n",
    "# You may obtain a copy of the License at\n",
    "#\n",
    "#     http://www.apache.org/licenses/LICENSE-2.0\n",
    "#\n",
    "# Unless required by applicable law or agreed to in writing, software\n",
    "# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
    "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
    "# See the License for the specific language governing permissions and\n",
    "# limitations under the License.\n",
    "\n",
    "import os\n",
    "import time\n",
    "import wave\n",
    "import sys\n",
    "import pyaudio\n",
    "import webrtcvad\n",
    "import appbuilder\n",
    "import re\n",
    "\n",
    "# 请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5\n",
    "# 设置环境变量\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = (\n",
    "    \"...\"\n",
    ")\n",
    "# 已发布AppBuilder应用的ID\n",
    "app_id = \"...\"\n",
    "appbuilder.logger.setLoglevel(\"ERROR\")\n",
    "\n",
    "CHUNK = 1024\n",
    "FORMAT = pyaudio.paInt16\n",
    "CHANNELS = 1 if sys.platform == \"darwin\" else 2\n",
    "RATE = 16000\n",
    "DURATION = 30  # ms\n",
    "CHUNK = RATE // 1000 * DURATION\n",
    "\n",
    "\n",
    "class Chatbot:\n",
    "    def __init__(self):\n",
    "        self.p = pyaudio.PyAudio()\n",
    "        self.tts = appbuilder.TTS()\n",
    "        self.asr = appbuilder.ASR()\n",
    "        self.agent = appbuilder.AppBuilderClient(app_id)\n",
    "        self.conversation_id = self.agent.create_conversation()\n",
    "\n",
    "    def run(self):\n",
    "        self.run_tts_and_play_audio(\n",
    "            \"我是你的专属聊天机器人,如果你有什么问题,可以直接问我\"\n",
    "        )\n",
    "        while True:\n",
    "            # Record\n",
    "            audio_path = \"output.wav\"\n",
    "            print(\"开始记录音频...\")\n",
    "            if self.record_audio(audio_path) < 1000:\n",
    "                time.sleep(1)\n",
    "                continue\n",
    "            print(\"音频记录结束\")\n",
    "\n",
    "            # ASR\n",
    "            print(\"开始执行ASR...\")\n",
    "            query = self.run_asr(audio_path)\n",
    "            print(\"结束执行ASR\")\n",
    "\n",
    "            # Agent\n",
    "            print(\"query: \", query)\n",
    "            if len(query) == 0:\n",
    "                continue\n",
    "            answer = self.run_agent(query)\n",
    "            results = re.findall(r\"(https?://[^\\s]+)\", answer)\n",
    "            for result in results:\n",
    "                print(\"链接地址:\", result)\n",
    "                answer = answer.replace(result, \"\")\n",
    "            print(\"answer:\", answer)\n",
    "\n",
    "            # TTS\n",
    "            print(\"开始执行TTS并播报...\")\n",
    "            self.run_tts_and_play_audio(answer)\n",
    "            print(\"结束TTS并播报结束\")\n",
    "\n",
    "    def record_audio(self, path):\n",
    "        with wave.open(path, \"wb\") as wf:\n",
    "            wf.setnchannels(CHANNELS)\n",
    "            wf.setsampwidth(self.p.get_sample_size(FORMAT))\n",
    "            wf.setframerate(RATE)\n",
    "            stream = self.p.open(\n",
    "                format=FORMAT, channels=CHANNELS, rate=RATE, input=True\n",
    "            )\n",
    "            vad = webrtcvad.Vad(1)\n",
    "            not_speech_times = 0\n",
    "            speech_times = 0\n",
    "            total_times = 0\n",
    "            start_up_times = 33 * 5  # 初始时间设置为5秒\n",
    "            history_speech_times = 0\n",
    "            while True:\n",
    "                if history_speech_times > 33 * 10:\n",
    "                    break\n",
    "                data = stream.read(CHUNK, False)\n",
    "                if vad.is_speech(data, RATE):\n",
    "                    speech_times += 1\n",
    "                    wf.writeframes(data)\n",
    "                else:\n",
    "                    not_speech_times += 1\n",
    "                total_times += 1\n",
    "                if total_times >= start_up_times:\n",
    "                    history_speech_times += speech_times\n",
    "                    # 模拟滑窗重新开始计数\n",
    "                    if float(not_speech_times) / float(total_times) > 0.7:\n",
    "                        break\n",
    "                    not_speech_times = 0\n",
    "                    speech_times = 0\n",
    "                    total_times = 0\n",
    "                    start_up_times = start_up_times / 2\n",
    "                    if start_up_times < 33:\n",
    "                        start_up_times = 33\n",
    "            stream.close()\n",
    "            return history_speech_times * DURATION\n",
    "\n",
    "    def run_tts_and_play_audio(self, text: str):\n",
    "        # AppBuilder内置的TTS使用文档,用户可根据文档调整参数:https://github.com/baidubce/app-builder/tree/master/python/core/components/tts\n",
    "        msg = self.tts.run(\n",
    "            appbuilder.Message(content={\"text\": text}),\n",
    "            speed=5,\n",
    "            pitch=5,\n",
    "            volume=5,\n",
    "            person=0,\n",
    "            audio_type=\"pcm\",\n",
    "            model=\"paddlespeech-tts\",\n",
    "            stream=True,\n",
    "        )\n",
    "        stream = self.p.open(\n",
    "            format=self.p.get_format_from_width(2),\n",
    "            channels=1,\n",
    "            rate=24000,\n",
    "            output=True,\n",
    "            frames_per_buffer=2048,\n",
    "        )\n",
    "        for pcm in msg.content:\n",
    "            stream.write(pcm)\n",
    "        stream.stop_stream()\n",
    "        stream.close()\n",
    "\n",
    "    # AppBuilder内置的ASR使用文档,用户可根据文档调整参数:https://github.com/baidubce/app-builder/blob/master/python/core/components/asr/README.md\n",
    "    def run_asr(self, audio_path: str):\n",
    "        with open(audio_path, \"rb\") as f:\n",
    "            content_data = {\"audio_format\": \"wav\", \"raw_audio\": f.read(), \"rate\": 16000}\n",
    "            msg = appbuilder.Message(content_data)\n",
    "            out = self.asr.run(msg)\n",
    "            text = out.content[\"result\"][0]\n",
    "            return text\n",
    "\n",
    "    def run_agent(self, query):\n",
    "        msg = self.agent.run(self.conversation_id, query, stream=True)\n",
    "        answer = \"\"\n",
    "        for content in msg.content:\n",
    "            answer += content.answer\n",
    "        return answer\n",
    "\n",
    "\n",
    "if __name__ == \"__main__\":\n",
    "    chatbot = Chatbot()\n",
    "    chatbot.run()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 使用方法\n",
    "\n",
    "直接运行程序即可。\n",
    "\n",
    "用户也可以将下面的功能模块替换成自己的其他实现或模型:\n",
    "* record_audio: 录音\n",
    "* run_asr: 语音识别语音识别,[AppBuilder ASR组件使用文档](https://github.com/baidubce/app-builder/blob/master/python/core/components/asr/README.md)\n",
    "* run_agent: Agent对话功能,[AppBuilder TTS组件使用文档](https://github.com/baidubce/app-builder/blob/master/python/core/components/tts/README.md)\n",
    "* run_tts_and_play_audio:回复的语音生成并播报\n",
    "\n",
    "**AppBuilder TTS组件参数**\n",
    "| 参数名称       | 参数类型    | 是否必须 | 描述                                                                                                                                                                                             | 示例值                                 |\n",
    "|------------|---------|------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|\n",
    "| message    | String  | 是    | 待转成语音的文本                                                                                                                                                                                       | Message(content={\"text\": \"需合成的文本\"}) |\n",
    "| model      | String  | 否    | 默认是`baidu-tts`模型,可选值:`paddlespeech-tts`、`baidu-tts`                                                                                                                                            | paddlespeech-tts                    |\n",
    "| speed      | Integer | 否    | 语音语速,默认是5中等语速,取值范围在0~15之间,仅当模型为`baidu-tts`参数有效,如果模型为`paddlespeech-tts`,参数自动失效                                                                                                                  | 5                                   |\n",
    "| pitch      | Integer | 否    | 语音音调,默认是5中等音调,取值范围在0~15之间,仅当模型为`baidu-tts`参数有效,如果模型为`paddlespeech-tts`,参数自动失效                                                                                                                  | 5                                   |\n",
    "| volume     | Integer | 否    | 语音音量,默认是5中等音量,取值范围在0~15之间,,仅当模型为`baidu-tts`参数有效,如果模型为`paddlespeech-tts`,参数自动失效                                                                                                                 | 5                                   |\n",
    "| person     | Integer | 否    | 语音人物特征,默认是0(度小美),普通音库可选值包括: 0(度小美)、1(度小宇)、3(度逍遥-基础)、4(度丫丫);精品音库包括:5003(度逍遥-精品)、5118(度小鹿)、106(度博文)、110(度小童)、111(度小萌)、103(度米朵)、5(度小娇);臻品音库包括:4003(度逍遥-情感男声)、4106(度博文-专业男主播)、4115(度小贤-电台男主播)、4119(度小鹿-甜美女声)、4105(度灵儿-清激女声)、4117(度小乔-活泼女声)、4100(度小雯-活力女主播)、4103(度米朵-可爱女声)、4144(度姗姗-娱乐女声)、4278(度小贝-知识女主播)、4143(度清风-配音男声)、4140(度小新-专业女主播)、4129(度小彦-知识男主播)、4149(度星河-广告男声)、4254(度小清-广告女声)、4206(度博文-综艺男声)、4226(南方-电台女主播)。仅当模型为`baidu-tts`参数有效,如果模型为`paddlespeech-tts`,参数自动失效 | 0                                   |\n",
    "| audio_type | String  | 否    | 音频文件格式,如果使用`baidu-tts`模型可选`mp3`, `wav`; 如果使用`paddlespeech-tts`模型非流式返回,参数只能设为`wav`;如果使用`paddlespeech-tts`模型流式返回,参数只能设为`pcm`                                                                     | wav                                 |\n",
    "| stream     | Bool    | 否    | 默认是False, 目前`paddlespeech-tts`模型支持流式返回,`baidu-tts`模型不支持流式返回                                                                                                                                    | False                               |\n",
    "| retry      | Integer | 否    | HTTP重试次数                                                                                                                                                                                       | 3                                   |\n",
    "| timeout    | Integer | 否    | HTTP超时时间                                                                                                                                                                                       | 5                                   |"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}


================================================
FILE: cookbooks/advanced_application/cloud_deploy.ipynb
================================================
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 公有云部署AppBuilderSDK\n",
    "**注意⚠️:部署上云功能目前处于内测阶段,使用过程中有任何问题,欢迎提issue或微信群反馈~**\n",
    "\n",
    "\n",
    "## 目标\n",
    "一键将自己的服务部署到公有云上,目前支持百度智能云。部署后可以自动生成公网ip,无需额外配置。具体可以用来解决以下问题:\n",
    "* 在百度云部署的WebService,可以引入到AppBuilder工作流中的API节点,形成应用中嵌套应用,构建能够解决复杂业务问题的工作流。\n",
    "* 可将自己本地复杂的服务、组件、模型等,方便快捷地上云,并与AppBuilder形成联动。\n",
    "* 构建自己的公网对话服务。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "## 部署\n",
    "### 前置操作:\n",
    "* 在百度智能云完成实名认证,并开通bos服务:\n",
    "  * https://cloud.baidu.com/doc/BOS/s/Jk4xttg03#%E5%BC%80%E9%80%9Abos%E6%9C%8D%E5%8A%A1\n",
    "* 您需要在钱包中至少充值100元,用于bcc服务、bos服务费用\n",
    "  * 云服务费用标准:https://cloud.baidu.com/product-price/bcc.html\n",
    "  * 默认配置使用最便宜的bcc.e1.c2m2,并且使用按量付费\n",
    "  * bos存储服务费用标准:https://cloud.baidu.com/product-price/bos.html\n",
    "* 通过如下步骤获得您的AK/SK信息:\n",
    "  * https://cloud.baidu.com/doc/Reference/s/9jwvz2egb\n",
    "* 部署的AppBuilder >= 0.9.0\n",
    "\n",
    "### 部署流程:\n",
    "通过下面三步执行部署:\n",
    "* Step1 以下面的yaml文件为模板创建config.yaml,完善并创建配置文件\n",
    "  * 最小修改范围:ak、sk、admin_pass、run_cmd、local_dir、APPBUILDER_TOKEN\n",
    "```yaml\n",
    "bce_config:\n",
    "    host: \"http://bcc.bj.baidubce.com\"\n",
    "    bos_host: \"bj.bcebos.com\"\n",
    "    # 前置操作获取的ak、sk\n",
    "    ak: \"\"\n",
    "    sk: \"\"\n",
    "    spec: \"bcc.e1.c2m2\"\n",
    "    root_disk_size_in_gb: 20\n",
    "    # 服务器密码,根据实际使用设置\n",
    "    admin_pass: \"\"\n",
    "    security_group_id: \"\"\n",
    "    zone_name: cn-bj-d\n",
    "\n",
    "appbuilder_config:\n",
    "    # 本地用来打包的代码路径,根据实际使用修改\n",
    "    local_dir: \"./sample\"\n",
    "    workspace: \"/home/work/appbuilder\"\n",
    "\n",
    "    # 服务的运行命令,根据实际使用修改\n",
    "    run_cmd: \"python3 sample.py\"\n",
    "\n",
    "env:\n",
    "    APPBUILDER_LOGLEVEL: debug\n",
    "    APPBUILDER_TOKEN: \"\"\n",
    "```\n",
    "* Step2 编写自己的服务运行代码(以组件服务为例)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "vscode": {
     "languageId": "plaintext"
    }
   },
   "outputs": [],
   "source": [
    "# 创建配置中的local_dir目录\n",
    "mkdir sample\n",
    "touch sample/sample.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "vscode": {
     "languageId": "plaintext"
    }
   },
   "outputs": [],
   "source": [
    "# 编写服务运行代码\n",
    "# sample/sample.py\n",
    "import appbuilder\n",
    "\n",
    "component = appbuilder.Playground(prompt_template=\"{query}\", model=\"ERNIE-Bot\")\n",
    "agent = appbuilder.AgentRuntime(component=component)\n",
    "agent.serve(port=8091)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* Step3 执行部署"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "vscode": {
     "languageId": "plaintext"
    }
   },
   "outputs": [],
   "source": [
    "# ./config.yaml为第一步创建的config.yaml文件\n",
    "appbuilder_bce_deploy --conf ./config.yaml\n",
    "\n",
    "# 执行后取日志\"deployment finished! public ip:\"后的ip为部署实例的公网ip \n",
    "# 若部署结果不符合预期,使用自己配置的\"admin_pass\"登陆服务器进行调试,具体参考文档:https://cloud.baidu.com/doc/BCC/s/Hkbblll70"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 示例:Component服务,接入AppBuilder工作流\n",
    "示例代码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "vscode": {
     "languageId": "plaintext"
    }
   },
   "outputs": [],
   "source": [
    "import appbuilder\n",
    "\n",
    "component = appbuilder.Playground(prompt_template=\"{query}\", model=\"ERNIE-Bot\")\n",
    "agent = appbuilder.AgentRuntime(component=component)\n",
    "agent.serve(port=8091)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "示例请求"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "vscode": {
     "languageId": "plaintext"
    }
   },
   "outputs": [],
   "source": [
    "# public_ip为部署获取的实例公网IP\n",
    "curl --location 'http://{public_ip}:8091/chat' \\\n",
    "--header 'Content-Type: application/json' \\\n",
    "--data '{\n",
    "    \"message\": \"海淀区的面积是多少\",\n",
    "    \"stream\": false\n",
    "}'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "通过API节点接入Appbuilder工作流,用于创建组件\n",
    "* 操作参考:https://cloud.baidu.com/doc/AppBuilder/s/glv0f48qe\n",
    "* API接入调试成功\n",
    "\n",
    "<img src=\"../app_builder_resources/component_api_debug.png\" alt=\"drawing\" width=\"800\"/>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 示例:随时随地的对话服务 \n",
    "**⚠️示例仅提供demo,实际业务需增加鉴权等能力**\n",
    "\n",
    "\n",
    "示例代码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "vscode": {
     "languageId": "plaintext"
    }
   },
   "outputs": [],
   "source": [
    "import appbuilder\n",
    "\n",
    "\n",
    "component = appbuilder.Playground(prompt_template=\"{query}\", model=\"ERNIE-Bot\")\n",
    "\n",
    "agent = appbuilder.AgentRuntime(component=component)\n",
    "agent.chainlit_demo(port=8091)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "示例效果"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src=\"../app_builder_resources/deploy_chainlit.png\" alt=\"drawing\" width=\"300\"/>"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}


================================================
FILE: cookbooks/agent_builder.ipynb
================================================
{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "42eace26869295fb",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# Console AppBuilderClient使用示例\n",
    "\n",
    "整体使用流程包括以下两个环节:\n",
    "\n",
    "1. 在[百度智能云千帆AppBuilder官网](https://cloud.baidu.com/product/AppBuilder)创建并发布应用、获取应用ID、获取密钥\n",
    "2. 引用AppBuilderSDK代码,初始化AppBuilderClient实例、创建会话、上传文档(可选)、执行对话\n",
    "\n",
    "以下分别提供三个样例,快递查询小助手、植物识别小助手、篮球教练来说明使用流程,注意以下流程用到的密钥可在图示位置中获取:\n",
    "<img src=\"./app_builder_resources/secret.png\" alt=\"drawing\" width=\"1000\"/>\n",
    "\n",
    "\n",
    "## 1. 快递查询小助手\n",
    "\n",
    "[<span style=\"font-size:1.3em;\"> 快递查询小助手</span>](https://appbuilder.baidu.com/s/KVSXK)一键体验\n",
    "\n",
    "### 1.1 Console端应用配置与发布\n",
    "1 进入[百度智能云千帆AppBuilder官网](https://cloud.baidu.com/product/AppBuilder),配置智能体指令、选择相应的工具组件、发布应用\n",
    "\n",
    "<img src=\"./app_builder_resources/express_assistant.png\" alt=\"drawing\" width=\"1200\"/>\n",
    "\n",
    "2 获取应用ID\n",
    "<img src=\"./app_builder_resources/app_id.png\" alt=\"drawing\" width=\"1200\"/>\n",
    "\n",
    "### 1.2 SDK代码调用示例"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a6a9e2ba6159a8e4",
   "metadata": {
    "collapsed": false,
    "is_executing": true
   },
   "outputs": [],
   "source": [
    "import appbuilder\n",
    "import os\n",
    "# 注意以下示例正确运行依赖的条件包括:\n",
    "# 1. 在百度智能云千帆AppBuilder官网使用AppBuilderClient创建应用且应用已发布\n",
    "# 2. 密钥正确有效\n",
    "# 3. 密钥需要与发布应用正确对应,即需要使用发布应用的账户下的密钥\n",
    "\n",
    "# 配置密钥与应用ID\n",
    "os.environ[\"APPBUILDER_TOKEN\"] =\"secret_key\"\n",
    "app_id = \"35f4fed3-d530-4dad-bc8e-f2150a4450be\"\n",
    "\n",
    "# 初始化Agent\n",
    "builder = appbuilder.AppBuilderClient(app_id)\n",
    "\n",
    "# 创建会话ID\n",
    "conversation_id = builder.create_conversation()\n",
    "\n",
    "# 执行对话\n",
    "msg = builder.run(conversation_id, \"我的快递单号是:9858485940100; 请查询下此快递的状态\")\n",
    "print(\"快递查询助理回答内容:\", msg.content.answer)\n",
    "\n",
    "# 执行流式对话\n",
    "msg = builder.run(conversation_id, \"使用语音播报快递当前状态\", stream=True)\n",
    "for content in msg.content:\n",
    "    for ev in content.events:\n",
    "        if ev.content_type == \"audio\":\n",
    "            print(\"快递查询助理生成的音频播放地址:\", ev.detail[\"audio\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3e462991dab3283d",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "## 2. 植物识别小助手\n",
    "[<span style=\"font-size:1.3em;\">植物识别小助手</span>](https://appbuilder.baidu.com/s/50zyD)一键体验\n",
    "\n",
    "### 2.1 Console端应用配置与发布\n",
    "1 进入[百度智能云千帆AppBuilder官网](https://cloud.baidu.com/product/AppBuilder),配置智能体指令、选择相应的工具组件、发布应用\n",
    "<img src=\"./app_builder_resources/plant_recog_assistant.png\" alt=\"drawing\" width=\"1200\"/>\n",
    "\n",
    "2 获取应用ID, 同1.1\n",
    "\n",
    "### 2.2 SDK代码调用示例"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4d051395a2aa1d11",
   "metadata": {
    "collapsed": false,
    "is_executing": true
   },
   "outputs": [],
   "source": [
    "import os\n",
    "import appbuilder\n",
    "\n",
    "# 注意以下示例正确运行依赖的条件包括:\n",
    "# 1. 在百度智能云千帆AppBuilder官网使用AppBuilderClient创建应用且应用已发布\n",
    "# 2. 密钥正确有效\n",
    "# 3. 密钥需要与发布的应用正确对应,即需要使用发布应用的账户下的密钥\n",
    "\n",
    "# 配置密钥与应用ID\n",
    "os.environ[\"APPBUILDER_TOKEN\"] =\"...\"\n",
    "app_id = \"7016e0d3-451b-4a47-a818-dc0a16d4b496\" \n",
    "\n",
    "# 初始化Agent实例\n",
    "builder = appbuilder.AppBuilderClient(app_id)\n",
    "\n",
    "# 创建会话ID\n",
    "conversation_id = builder.create_conversation()\n",
    "\n",
    "# 上传植物图片\n",
    "file_id = builder.upload_local_file(conversation_id, \"./app_builder_resources/tree.png\" )\n",
    "\n",
    "# 植物识别\n",
    "msg = builder.run(conversation_id, \"请识别图中的植物类别\", file_ids=[file_id])\n",
    "print(\"植物识别助理回答内容:\", msg.content.answer)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c112f09d6ce35d10",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "## 3. 篮球教练\n",
    "[<span style=\"font-size:1.3em;\">篮球教练知识增强检索</span>](https://appbuilder.baidu.com/s/RCVEn)一键体验\n",
    "\n",
    "### 3.1 Console端应用配置与发布\n",
    "1 进入[百度智能云千帆AppBuilder官网](https://cloud.baidu.com/product/AppBuilder),配置智能体指令、上传文档并关联知识库、发布应用\n",
    "<img src=\"./app_builder_resources/agent_builder_rag.png\" alt=\"drawing\" width=\"1200\"/>\n",
    "\n",
    "2 获取应用ID, 同1.1\n",
    "\n",
    "### 3.2 SDK代码调用示例"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "65e488aa883cf94e",
   "metadata": {
    "collapsed": false,
    "is_executing": true
   },
   "outputs": [],
   "source": [
    "import os\n",
    "import appbuilder\n",
    "\n",
    "# 注意以下示例正确运行依赖的条件包括:\n",
    "# 1. 在百度智能云千帆AppBuilder官网使用AppBuilderClient创建应用且应用已发布\n",
    "# 2. 密钥正确有效\n",
    "# 3. 密钥需要与发布的应用正确对应,即需要使用发布应用的账户下的密钥\n",
    "\n",
    "# 配置密钥与应用ID\n",
    "os.environ[\"APPBUILDER_TOKEN\"] =\"...\"\n",
    "app_id = \"4316a7cb-b6b2-4448-b6fa-ff131c484ec9\" \n",
    "\n",
    "# 初始化Agent实例\n",
    "builder = appbuilder.AppBuilderClient(app_id)\n",
    "\n",
    "# 创建会话ID\n",
    "conversation_id = builder.create_conversation()\n",
    "\n",
    "# 执行对话\n",
    "msg = builder.run(conversation_id, \"突破技巧中如何运用胯下变向?\", )\n",
    "print(\"篮球教练回答内容:\", msg.content.answer)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}


================================================
FILE: cookbooks/appbuilder_trace/trace.ipynb
================================================
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 使用Appbuilder-SDK Trace框架实现对Client的跟踪\n",
    "\n",
    "- 如果没有安装phoenix,需要先安装phoenix,这里建议使用清华源镜像安装,推荐使用4.5.0版本"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "vscode": {
     "languageId": "shellscript"
    }
   },
   "outputs": [],
   "source": [
    "python3 -m pip install arize-phoenix==4.5.0 -i https://pypi.tuna.tsinghua.edu.cn/simple"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- 启动phoenix服务"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "vscode": {
     "languageId": "shellscript"
    }
   },
   "outputs": [],
   "source": [
    "appbuilder_trace_server"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- ctrl+鼠标左键点击http://localhost:8080/进入可视化界面,跟踪的信息将在这里可视化展示\n",
    "![phoenix可视化界面](https://bj.bcebos.com/v1/appbuilder-sdk-components/Phoenix%E5%8F%AF%E8%A7%86%E5%8C%96%E7%95%8C%E9%9D%A2%EF%BC%881%EF%BC%89.png?authorization=bce-auth-v1%2FALTAKGa8m4qCUasgoljdEDAzLm%2F2024-07-22T04%3A41%3A00Z%2F-1%2Fhost%2F19a246ca50757aa64a3ccabfac0c8cd93730a08599201dd81e9de9bb2f9bb2a3)\n",
    "- 使用ctrl+c停止phoenix服务\n",
    "\n",
    "### 启动Appbuilder-SDK TRACE"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[2024-07-03 11:10:00,040.040] tracer.py [line:128] INFO [main-9857193014994891849] OTLPSpanExporter endpoint: http://localhost:8080/v1/traces\n"
     ]
    }
   ],
   "source": [
    "from appbuilder import AppBuilderTracer\n",
    "tracer=AppBuilderTracer(\n",
    "    enable_phoenix = True,\n",
    "    enable_console = False,\n",
    "    )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- enable_phoenix:是否启动phoenix可视化跟踪\n",
    "- enable_console:是否将trace信息反馈到控制台"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[2024-07-03 11:10:03,800.800] tracer.py [line:162] INFO [main-13600015437371441059] AppBuilder Starting trace...\n",
      "answer='' events=[Event(code=0, message='', status='done', event_type='function_call', content_type='function_call', detail={'text': {'arguments': {}, 'component_code': 'ChatAgent', 'component_name': '聊天助手'}}, usage=None)]\n",
      "answer='' events=[Event(code=0, message='', status='preparing', event_type='ChatAgent', content_type='status', detail={}, usage=None)]\n",
      "answer='作为植物' events=[Event(code=0, message='', status='running', event_type='ChatAgent', content_type='text', detail={'text': '作为植物'}, usage=Usage(prompt_tokens=77, completion_tokens=0, total_tokens=77, name='ERNIE-4.0-8K'))]\n",
      "answer='识别专家,我可以帮助您识别各种植物种类。' events=[Event(code=0, message='', status='running', event_type='ChatAgent', content_type='text', detail={'text': '识别专家,我可以帮助您识别各种植物种类。'}, usage=Usage(prompt_tokens=77, completion_tokens=0, total_tokens=77, name='ERNIE-4.0-8K'))]\n",
      "answer='如果您提供植物的图片或详细描述,我可以利用植物识别组件来分析并确定植物的种类,为您提供准确、专业的识别结果。' events=[Event(code=0, message='', status='running', event_type='ChatAgent', content_type='text', detail={'text': '如果您提供植物的图片或详细描述,我可以利用植物识别组件来分析并确定植物的种类,为您提供准确、专业的识别结果。'}, usage=Usage(prompt_tokens=77, completion_tokens=0, total_tokens=77, name='ERNIE-4.0-8K'))]\n",
      "answer='无论是常见的花卉、树木,还是稀有的植物品种,我都可以尽力为您提供识别服务。' events=[Event(code=0, message='', status='running', event_type='ChatAgent', content_type='text', detail={'text': '无论是常见的花卉、树木,还是稀有的植物品种,我都可以尽力为您提供识别服务。'}, usage=Usage(prompt_tokens=77, completion_tokens=0, total_tokens=77, name='ERNIE-4.0-8K'))]\n",
      "answer='' events=[Event(code=0, message='', status='done', event_type='ChatAgent', content_type='text', detail={'text': ''}, usage=Usage(prompt_tokens=77, completion_tokens=60, total_tokens=137, name='ERNIE-4.0-8K'))]\n",
      "answer='' events=[Event(code=0, message='', status='success', event_type='ChatAgent', content_type='status', detail={}, usage=None)]\n",
      "answer='' events=[]\n",
      "[2024-07-03 11:10:11,965.965] tracer.py [line:166] INFO [main-9471189008456186581] AppBuilder Ending trace...\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "INFO:appbuilder:AppBuilder Ending trace...\n"
     ]
    }
   ],
   "source": [
    "# 启动trace \n",
    "import os\n",
    "import appbuilder\n",
    "\n",
    "tracer.start_trace()\n",
    "\n",
    "# 这里将APPBUILDER_TOKEN与app_id更换为你的APPBUILDER_TOKEN和app_id\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = \"YOUR_APPBUILDER_TOKEN\"\n",
    "app_id = \"YOUR_APP_ID\"\n",
    "\n",
    "builder = appbuilder.AppBuilderClient(app_id)\n",
    "conversation_id = builder.create_conversation()\n",
    "msg = builder.run(conversation_id=conversation_id, query=\"你可以做什么?\",stream=True)\n",
    "\n",
    "for m in msg.content:\n",
    "    print(m)\n",
    "\n",
    "# 结束trace\n",
    "tracer.end_trace()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### phoneix可视化跟踪界面展示\n",
    "![phoenix可视化页面展示结果](https://bj.bcebos.com/v1/appbuilder-sdk-components/Phoenix%E5%8F%AF%E8%A7%86%E5%8C%96%E7%95%8C%E9%9D%A2%EF%BC%882%EF%BC%89.png?authorization=bce-auth-v1%2FALTAKGa8m4qCUasgoljdEDAzLm%2F2024-07-22T04%3A41%3A31Z%2F-1%2Fhost%2F86460e40ecab90c50168da46ca0cf79f6179696943e1a1546f9a9ce6d34b8063)\n",
    "- 可以在可视化界面查看跟踪信息如Client组件的调用链路,输入输出、消耗token数等信息\n",
    "- 点击某个调用链路,可以查看该调用链路详细信息,流式运行过程,HTTP-POST节点展示curl命令\n",
    "![phoenix可视化页面节点展示结果](https://bj.bcebos.com/v1/appbuilder-sdk-components/Phoenix%E5%8F%AF%E8%A7%86%E5%8C%96%E7%95%8C%E9%9D%A2%EF%BC%883%EF%BC%89.png?authorization=bce-auth-v1%2FALTAKGa8m4qCUasgoljdEDAzLm%2F2024-07-22T04%3A41%3A46Z%2F-1%2Fhost%2F096835857c7de8714250a260a0373e69938c91d5452e3955d3f4b2ca298b8bcc)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}


================================================
FILE: cookbooks/components/agent_runtime.ipynb
================================================
{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "f802e64d-4eaa-445d-a48a-1042a91bc394",
   "metadata": {
    "tags": []
   },
   "source": [
    "# 基于AgentRuntime服务化组件\n",
    "\n",
    "## 目标\n",
    "使用 AgentRuntime 对组件进行服务化。\n",
    "\n",
    "AgentRuntime 是对组件(Component)的服务化封装,具体有如下几个功能:\n",
    "- 一键服务化组件: 使得组件能够以服务的形式运行,支持 API 调用和对话框交互。\n",
    "- Session 数据管理: 提供 Session 数据的管理功能,允许跟踪和存储用户会话数据。\n",
    "- 请求时鉴权: 支持在请求时进行认证,确保安全性。\n",
    "\n",
    "\n",
    "## 准备工作\n",
    "### 安装Python SDK\n",
    "\n",
    "appbuilder 支持使用 pip 安装(要求Python >= 3.8),并且 AgentRuntime 服务化组件依赖 `appbuilder-sdk[serve]`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2939356f-61c2-42e9-9e0c-fc6729c193f6",
   "metadata": {
    "vscode": {
     "languageId": "shellscript"
    }
   },
   "outputs": [],
   "source": [
    "pip install appbuilder-sdk 'appbuilder-sdk[serve]'"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "aeb2fa55-075f-48df-a9fb-8b40d9900684",
   "metadata": {},
   "source": [
    "## 基本用法\n",
    "\n",
    "### 快速开始\n",
    "\n",
    "下面的示例会基于 Playground 组件,在 8091 端口部署 Web 服务: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "41559341-fd7a-478c-a08b-1477d79e9d41",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-12-18T06:24:26.982459Z",
     "start_time": "2023-12-18T06:23:53.771345Z"
    }
   },
   "outputs": [],
   "source": [
    "import os\n",
    "import appbuilder\n",
    "\n",
    "# 使用组件之前,请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1、创建密钥\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = '...'\n",
    "\n",
    "component = appbuilder.Playground(\n",
    "    prompt_template=\"{query}\",\n",
    "    model=\"ERNIE-Bot\"\n",
    ")\n",
    "\n",
    "agent = appbuilder.AgentRuntime(component=component)\n",
    "agent.serve(port=8091)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b71e24eb",
   "metadata": {},
   "source": [
    "通过 Shell 命令测试启动的服务, 请求 Body 为组件 run 方法的入参:\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "12c71fa5",
   "metadata": {
    "vscode": {
     "languageId": "shellscript"
    }
   },
   "outputs": [],
   "source": [
    "curl --location 'http://0.0.0.0:8091/chat' \\\n",
    "--header 'Content-Type: application/json' \\\n",
    "--data '{\n",
    "    \"message\": \"海淀区的面积是多少\",\n",
    "    \"stream\": false\n",
    "}'"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "5fc5bc38-6bc5-4187-a8fd-f802d77d89fa",
   "metadata": {},
   "source": [
    "## AgentRuntime 参数说明"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c2364c35",
   "metadata": {},
   "source": [
    "### 1. 类初始化参数说明\n",
    "\n",
    "AgentRuntime 初始化接受两个参数。\n",
    "\n",
    "| 参数名称 | 参数类型 | 是否必须 | 描述 | 示例值 |\n",
    "|--|--|--|--|--|\n",
    "| component | Component | 是 | 可运行的 Component, 该 Component 需要实现 run(message, stream, **args) 方法。 | Playground(prompt_template=\"{query}\", model=\"ERNIE-Bot\") |\n",
    "| user_session_config | sqlalchemy.engine.URL\\|Str\\|None | 否 | 会话 Session 数据存储的数据库配置,遵循 sqlalchemy 后端定义,可参考[文档](https://docs.sqlalchemy.org/en/20/core/engines.html#backend-specific-urls)。默认使用 sqlite:///user_session.db,即本地的 SQLite 存储 | \"sqlite:///user_session.db\" |"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "62e1af06",
   "metadata": {},
   "source": [
    "### 2. API 服务参数\n",
    "\n",
    "#### 2.1 请求参数\n",
    "\n",
    "**接口定义**\n",
    "\n",
    "| URL | Method |\n",
    "|--|--|\n",
    "| /chat | POST |\n",
    "\n",
    "**Header 参数**\n",
    "\n",
    "| 参数名称 | 是否必须 | 描述 | 示例值 |\n",
    "|--|--|--|--|\n",
    "| Content-Type | 是 | 必须设置为\"application/json\" | \"application/json\" |\n",
    "| X-Appbuilder-Token | 否 | 开启请求时认证能力时需要带入 APPBUILDER_TOKEN 进行鉴权 | 前往千帆AppBuilder官网创建密钥,流程详见[文档](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1、创建密钥) |\n",
    "\n",
    "**Body 参数**\n",
    "\n",
    "| 参数名称 | 参数类型 | 是否必须 | 描述 | 示例值 |\n",
    "|--|--|--|--|--|\n",
    "| message | Any | 是 | 透传到 component 的 run 方法的 message 参数 | \"海淀区的面积是多少\" |\n",
    "| stream | Bool | 否 | 是否流式调用。透传到 component 的 run 方法的 stream 参数。默认为 false | false |\n",
    "| session_id | Str | 否 | 用于标示同一个会话(Session)。如果不传该值,后端会自动生成 session_id,在响应参数中返回 | \"99680089-5acb-4298-9ade-a1a3f6c28102\" |\n",
    "| 其他参数 | Any | 否 | 透传到 component 的 run 方法 | - |\n",
    "\n",
    "\n",
    "#### 2.2 响应参数\n",
    "分为非流式响应和流式响应。\n",
    "\n",
    "**非流式响应**\n",
    "\n",
    "| 参数名称 | 参数类型 | 描述 | 示例值 |\n",
    "|--|--|--|--|\n",
    "| code | Int | 错误码。值为0表示成功,否则为失败。非0错误详见错误码部分描述 | 0 |\n",
    "| message | Str | 错误信息描述。 | \"Missing input variable query in message ['海淀区的面积是多少']\" |\n",
    "| result | Object | 请求结果 | - |\n",
    "| + answer_message | Object | 组件返回值,由返回的 Message 序列化得到 | {\"content\":\"海淀区是北京市的一个区,位于北京市主城区西部和西北部,东与西城区、朝阳区相邻,南与丰台区毗连,西与石景山区、门头沟区交界,北与昌平区接壤。海淀区的面积为**431平方千米**,约占北京市总面积的2.6%。\",\"extra\":{},\"id\":\"6b4e5019-a708-4bc5-a6ec-595fb4285677\",\"mtype\":\"dict\",\"name\":\"msg\"} |\n",
    "| + session_id | Str | 用于标示同一个会话(Session) | \"99680089-5acb-4298-9ade-a1a3f6c28102\" |\n",
    "\n",
    "**流式响应**\n",
    "\n",
    "流式数据以追加的形式返回。流式和非流式的数据结构一致,不再描述。\n",
    "\n",
    "#### 2.3 响应示例\n",
    "\n",
    "分为非流式响应和流式响应。\n",
    "\n",
    "**非流式响应**\n",
    "\n",
    "```shell\n",
    "{\n",
    "  \"code\": 0,\n",
    "  \"message\": \"\",\n",
    "  \"result\": {\n",
    "    \"answer_message\": {\n",
    "      \"content\": \"海淀区是北京市的一个区,位于北京市主城区西部和西北部,东与西城区、朝阳区相邻,南与丰台区毗连,西与石景山区、门头沟区交界,北与昌平区接壤。海淀区的面积为**431平方千米**,约占北京市总面积的2.6%。\",\n",
    "      \"extra\": {},\n",
    "      \"id\": \"6b4e5019-a708-4bc5-a6ec-595fb4285677\",\n",
    "      \"mtype\": \"dict\",\n",
    "      \"name\": \"msg\"\n",
    "    },\n",
    "    \"session_id\": \"99680089-5acb-4298-9ade-a1a3f6c28102\"\n",
    "  }\n",
    "}\n",
    "```\n",
    "\n",
    "**流式响应**\n",
    "\n",
    "```shell\n",
    "data: {\"code\": 0, \"message\": \"\", \"result\": {\"session_id\": \"663303a9-d83d-481f-a084-872ece87989c\", \"answer_message\": {\"content\": \"海淀区\", \"extra\": {}}}}\n",
    "\n",
    "data: {\"code\": 0, \"message\": \"\", \"result\": {\"session_id\": \"663303a9-d83d-481f-a084-872ece87989c\", \"answer_message\": {\"content\": \",隶属于北京市,位于北京市主城区西部和西北部,东与西城区、朝阳区相邻,南与丰台区毗连,\", \"extra\": {}}}}\n",
    "\n",
    "data: {\"code\": 0, \"message\": \"\", \"result\": {\"session_id\": \"663303a9-d83d-481f-a084-872ece87989c\", \"answer_message\": {\"content\": \"西与石景山区、门头沟区交界,北与昌平区接壤,总面积**431平方千米**。\", \"extra\": {}}}}\n",
    "\n",
    "data: {\"code\": 0, \"message\": \"\", \"result\": {\"session_id\": \"663303a9-d83d-481f-a084-872ece87989c\", \"answer_message\": {\"content\": \"\", \"extra\": {}}}}\n",
    "```\n",
    "\n",
    "#### 2.4 错误码\n",
    "| 错误码 | 描述 |\n",
    "|--|--|\n",
    "| 400 | 客户端请求参数错误 |\n",
    "| 1000 | 服务端执行错误 |"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "61923b00",
   "metadata": {},
   "source": [
    "## 高级用法"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a2303c76",
   "metadata": {},
   "source": [
    "### 1. 一键服务化组件 \n",
    "AgentRuntime 可以快速组件以服务的形式运行,支持 API 调用和对话框交互。\n",
    "\n",
    "**1.1 API调用**\n",
    "\n",
    "API 调用的基础用法在快速开始小结已经给出,这里不再赘述。\n",
    "\n",
    "下面介绍使用 `gunicorn` 启动生产级 Web 服务的方法,`gunicorn` 是一个适用于 UNIX 的 Python WSGI HTTP 服务器,详见[项目链接](https://github.com/benoitc/gunicorn)。\n",
    "\n",
    "首先创建 `app.py` 文件,暴露 Flask App:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fde5cc94",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import appbuilder\n",
    "\n",
    "# 使用组件之前,请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1、创建密钥\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = '...'\n",
    "\n",
    "def get_flask_app():\n",
    "    component = appbuilder.Playground(\n",
    "        prompt_template=\"{query}\",\n",
    "        model=\"ERNIE-Bot\"\n",
    "    )\n",
    "    agent = appbuilder.AgentRuntime(component=component)\n",
    "    return agent.create_flask_app()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a41ef57b",
   "metadata": {},
   "source": [
    "基于 `gunicorn` 启动生产级服务:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2077833f",
   "metadata": {
    "vscode": {
     "languageId": "shellscript"
    }
   },
   "outputs": [],
   "source": [
    "# 服务工作进程数\n",
    "SERVER_WORKER_AMOUNT=8\n",
    "# 服务工作进程启动方式\n",
    "SERVER_WORKER_CLASS=gevent\n",
    "# 服务超时时间\n",
    "GUNICORN_TIMEOUT=60\n",
    "\n",
    "gunicorn \\\n",
    "  --bind \"0.0.0.0:8091\" \\\n",
    "  --workers ${SERVER_WORKER_AMOUNT} \\\n",
    "  --worker-class ${SERVER_WORKER_CLASS} \\\n",
    "  --timeout ${GUNICORN_TIMEOUT} \\\n",
    "  \"app:get_flask_app()\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "673c7565",
   "metadata": {},
   "source": [
    "**1.2 对话框交互**\n",
    "\n",
    "基于 chainlit 的对话框交互对被服务化的组件的 message 参数更加严格,要求能够接受 Str 的基础类型。\n",
    "\n",
    "执行下面的代码,会启动一个 chainlit 页面,页面地址:0.0.0.0:8091"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e485544f",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import appbuilder\n",
    "\n",
    "# 使用组件之前,请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1、创建密钥\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = '...'\n",
    "\n",
    "component = appbuilder.Playground(\n",
    "    prompt_template=\"{query}\",\n",
    "    model=\"ERNIE-Bot\"\n",
    ")\n",
    "\n",
    "agent = appbuilder.AgentRuntime(component=component)\n",
    "agent.chainlit_demo(port=8091)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4d63bece",
   "metadata": {},
   "source": [
    "Chainlit Demo页面示意图如下所示,\n",
    "\n",
    "![chainlit demo](image/agent_runtime_with_chainlit_demo.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a074f367",
   "metadata": {},
   "source": [
    "**1.3 对话框交互AppBuilderClient**\n",
    "\n",
    "基于 chainlit 的对话框交互AppBuilderClient,可实现对话交互。支持工作流Agent、自主规划Agent应用。\n",
    "\n",
    "执行下面的代码,会启动一个 chainlit 页面,页面地址:0.0.0.0:8091。可在页面上上传文档(可选)、执行对话。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0a75e035",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import appbuilder\n",
    "\n",
    "# 使用组件之前,请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1、创建密钥\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = \"...\"\n",
    "# 使用之前,在官网个人空间获取应用ID,如下图\n",
    "app_id= \"...\"\n",
    "client = appbuilder.AppBuilderClient(app_id)\n",
    "agent = appbuilder.AgentRuntime(client)\n",
    "agent.chainlit_agent(port=8091)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d5162e29",
   "metadata": {},
   "source": [
    "在官网个人空间获取应用ID\n",
    "![get app_id](../app_builder_resources/app_id.png)\n",
    "\n",
    "使用服务上传文件并对话示例图如下所示\n",
    "![chainlit demo](./image/agent_runtime_with_chainlit_agent.png)\n",
    "\n",
    "使用工作流Agent应用对话示例如下图所示\n",
    "![chainlit demo](./image/agent_runtime_with_chainlit_chatflow.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2392f46d",
   "metadata": {},
   "source": [
    "### 2. Session 数据管理\n",
    "AgentRuntime 提供 Session 数据的管理功能,允许跟踪和存储用户会话数据。一般只有在二次开发的组件需要使用该能力。\n",
    "\n",
    "**2.1 二次开发组件**\n",
    "\n",
    "二次开发的组件需要重写组件的 run(message, stream, **args)方法,并且至少需要有 message 和 stream 两个参数。\n",
    "\n",
    "下面基于 QueryRewrite 和 Playground 两个组件,开发 PlaygroundWithHistory 组件,该组件需要对会话数据进行操作。\n",
    "\n",
    "当使用 Component 独立运行时,会话数据会被存储于内存。\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "079048e3",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import logging\n",
    "from appbuilder.core.component import Component\n",
    "from appbuilder import (\n",
    "    AgentRuntime, UserSession, Message, QueryRewrite, Playground,\n",
    ")\n",
    "\n",
    "# 使用组件之前,请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1、创建密钥\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = '...'\n",
    "\n",
    "class PlaygroundWithHistory(Component):\n",
    "    def __init__(self):\n",
    "        super().__init__()\n",
    "        self.query_rewrite = QueryRewrite(model=\"DeepSeek-V3.1\")\n",
    "        self.playground = Playground(\n",
    "            prompt_template=\"{query}\",\n",
    "            model=\"ERNIE-Bot\"\n",
    "        )\n",
    "\n",
    "    def run(self, message: Message, stream: bool=False):\n",
    "        user_session = UserSession()\n",
    "        # 获取 Session 历史数据\n",
    "        history_queries = user_session.get_history(\"query\", limit=1)\n",
    "        history_answers = user_session.get_history(\"answer\", limit=1)\n",
    "\n",
    "        # query 改写\n",
    "        if history_queries and history_answers:\n",
    "            history = []\n",
    "            for query, answer in zip(history_queries, history_answers):\n",
    "                history.extend([query.content, answer.content])\n",
    "            logging.info(f\"history: {history}\")\n",
    "            message = self.query_rewrite(\n",
    "                Message(history + [message.content]), rewrite_type=\"带机器人回复\")\n",
    "        logging.info(f\"message: {message}\") \n",
    "\n",
    "        # 执行 playground\n",
    "        answer = self.playground.run(message, stream)\n",
    "\n",
    "        # 保存本轮数据\n",
    "        user_session.append({\n",
    "            \"query\": message,\n",
    "            \"answer\": answer,\n",
    "        }) \n",
    "        return answer\n",
    "\n",
    "# component 可以独立运行,session数据会被保存于内存\n",
    "playground_with_history_component = PlaygroundWithHistory()\n",
    "print(playground_with_history_component.run(Message(\"海淀区的面积是多少\"), stream=False))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "480fd56d",
   "metadata": {},
   "source": [
    "**2.2 会话数据存储数据库**\n",
    "\n",
    "使用 AgentRuntime 对 Component 服务化,会话数据会被存储于数据库。\n",
    "下面的代码以 SQLite 为例展示该能力,更多数据库配置详见[文档](https://docs.sqlalchemy.org/en/20/core/engines.html#backend-specific-urls)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "111b11de",
   "metadata": {},
   "outputs": [],
   "source": [
    "user_session_config = \"sqlite:///foo.db\"\n",
    "agent = appbuilder.AgentRuntime(\n",
    "    component=playground_with_history_component, \n",
    "    user_session_config=user_session_config)\n",
    "agent.serve(port=8091)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e7dc38ec",
   "metadata": {},
   "source": [
    "### 3. 请求时鉴权\n",
    "AgentRuntime 支持在请求时进行认证,确保安全性。\n",
    "\n",
    "使用该能力,在初始化组件时需要设置 lazy 鉴权:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2125bf4f",
   "metadata": {},
   "outputs": [],
   "source": [
    "import appbuilder\n",
    "\n",
    "# 无需配置 APPBUILDER_TOKEN 环境变量\n",
    "\n",
    "component = appbuilder.Playground(\n",
    "    prompt_template=\"{query}\",\n",
    "    model=\"ERNIE-Bot\",\n",
    "    lazy_certification=True, # 设置 lazy 鉴权,在创建时不进行认证\n",
    ")\n",
    "\n",
    "agent = appbuilder.AgentRuntime(component=component)\n",
    "agent.serve(port=8091)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bbf35a0a",
   "metadata": {},
   "source": [
    "当初始化组件时进行了 lazy 鉴权,请求时请求头必须带上 `X-Appbuilder-Token` (即Appbuilder密钥,获取流程详见[千帆AppBuilder官网创建密钥](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1、创建密钥))进行鉴权:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "60dcfa37",
   "metadata": {
    "vscode": {
     "languageId": "shellscript"
    }
   },
   "outputs": [],
   "source": [
    "curl --location 'http://0.0.0.0:8091/chat' \\\n",
    "    --header 'Content-Type: application/json' \\\n",
    "    --header 'X-Appbuilder-Token: ...' \\\n",
    "    --data '{\n",
    "        \"message\": \"海淀区的面积是多少\",\n",
    "        \"stream\": false\n",
    "    }'"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f8584416",
   "metadata": {},
   "source": [
    "### 4. 查看user_session.db储存信息\n",
    "\n",
    "\n",
    "使用该能力,查看用户对话信息。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "id": "9bbeb156",
   "metadata": {
    "vscode": {
     "languageId": "shellscript"
    }
   },
   "outputs": [],
   "source": [
    "import sqlite3  \n",
    "  \n",
    "# 连接到 SQLite 数据库  \n",
    "# 如果文件不存在,会自动在当前目录创建:  \n",
    "user_session_path = '本地user_session.db地址' \n",
    "conn = sqlite3.connect(user_session_path)  \n",
    "cursor = conn.cursor()  "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "54cce03b",
   "metadata": {},
   "source": [
    "执行 SQL 语句,列出SQLite数据库中的所有表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "id": "f4ca2963",
   "metadata": {
    "vscode": {
     "languageId": "shellscript"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[('appbuilder_session_messages',)]\n"
     ]
    }
   ],
   "source": [
    "# 执行一条 SQL 语句,列出所有表  \n",
    "cursor.execute(\"SELECT name FROM sqlite_master WHERE type='table';\")  \n",
    "print(cursor.fetchall())  "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e5b838f4",
   "metadata": {},
   "source": [
    "查询appbuilder_session_messages表的列信息,appbuilder_session_messages表的列信息为:\n",
    "- id\n",
    "- session_id\n",
    "- request_id\n",
    "- message_key\n",
    "- message_value\n",
    "- created_at\n",
    "- updated_at\n",
    "- deleted"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "id": "1ac388d7",
   "metadata": {
    "vscode": {
     "languageId": "shellscript"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "id\n",
      "session_id\n",
      "request_id\n",
      "message_key\n",
      "message_value\n",
      "created_at\n",
      "updated_at\n",
      "deleted\n"
     ]
    }
   ],
   "source": [
    "cursor.execute(\"PRAGMA table_info(appbuilder_session_messages);\")  \n",
    "columns_info = cursor.fetchall()  \n",
    "\n",
    "column_names = [info[1] for info in columns_info]  # info[1]是列名的位置  \n",
    "for column_name in column_names:  \n",
    "    print(column_name)   "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3965454f",
   "metadata": {},
   "source": [
    "查询表中的特定数据【以message_value信息为例】\n",
    "输出content、id、token_usage等信息"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "id": "2e6d9e45",
   "metadata": {
    "vscode": {
     "languageId": "shellscript"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'content': '你好', 'name': 'msg', 'mtype': 'str', 'id': '90c8d150-c7b9-44a4-ac77-50dd61ee329a'}\n",
      "{'content': '你好,我是百度研发的知识增强大语言模型,中文名是文心一言,英文名是ERNIE Bot。我能够与人对话互动,回答问题,协助创作,高效便捷地帮助人们获取信息、知识和灵感。', 'name': 'msg', 'mtype': 'dict', 'id': '0fc6c5f7-23bf-4f25-8555-69b4155908b7', 'extra': {}, 'token_usage': {'prompt_tokens': 2, 'completion_tokens': 42, 'total_tokens': 44}}\n",
      "{'content': '请介绍一下你自己', 'name': 'msg', 'mtype': 'dict', 'id': '4f5cf6d1-976e-456e-a632-93c4b2550523', 'extra': {'search_db': [{'content': '带机器人回复:请你扮演一个智能搜索改写补全机器人,请根据User的搜索历史以及对应的搜索结果,对最后一句话先进行主语继承改写,然后进行上下文信息补全,注意:不要改变原文的意思,答案要尽可能简洁,不要直接回答该问题,不要输出多于的内容。\\\\n\\\\n例子:\\\\n搜索历史:\\\\nUser:今天上午你干嘛了\\\\nAssistant:去打篮球啦\\\\nUser:好玩吗?\\\\n答案:\\\\n打篮球好玩吗?', 'dataset_id': '1f777fa3-26db-4237-98d5-075abc07a84f', 'dataset_name': '多轮改写Prompt', 'document_id': '92e0f30d-1f30-46f0-8377-59ab0fb6eb93', 'document_name': '多轮改写prompt_带机器人回复.txt', 'id': '61657591-f610-44f0-84ec-67cedcb66447', 'mock_id': '1', 'position': 0, 'score': 0.511053, 'sentences': [{'content': '带机器人回复:请你扮演一个智能搜索改写补全机器人,请根据User的搜索历史以及对应的搜索结果,对最后一句话先进行主语继承改写,然后进行上下文信息补全,注意:不要改变原文的意思,答案要尽可能简洁,不要直接回答该问题,不要输出多于的内容。\\\\n\\\\n例子:\\\\n搜索历史:\\\\nUser:今天上午你干嘛了\\\\nAssistant:去打篮球啦\\\\nUser:好玩吗?', 'id': '1f777fa3-26db-4237-98d5-075abc07a84f-5992356ea8c0c05485388623218e134e-975ec17bbf8206762df7cfb24a5cd85e-97468bdaf0accef718118a2b742d5cc0', 'score': 0.628708, 'source': None}], 'title': '多轮改写prompt_带机器人回复.txt', 'tokens': 0, 'type': 'engine', 'word_count': 188}]}, 'token_usage': {'prompt_tokens': 321, 'completion_tokens': 3, 'total_tokens': 324}}\n",
      "{'content': '您好,我是文心一言,英文名是ERNIE Bot。我能够与人对话互动,回答问题,协助创作,高效便捷地帮助人们获取信息、知识和灵感。', 'name': 'msg', 'mtype': 'dict', 'id': 'f769c850-f4e5-4d02-a62a-766fd8c8132e', 'extra': {}, 'token_usage': {'prompt_tokens': 4, 'completion_tokens': 33, 'total_tokens': 37}}\n",
      "{'content': '介绍一下baidu公司', 'name': 'msg', 'mtype': 'dict', 'id': '0ff3b298-7f01-4036-927d-722e00afaf33', 'extra': {'search_db': [{'content': '带机器人回复:请你扮演一个智能搜索改写补全机器人,请根据User的搜索历史以及对应的搜索结果,对最后一句话先进行主语继承改写,然后进行上下文信息补全,注意:不要改变原文的意思,答案要尽可能简洁,不要直接回答该问题,不要输出多于的内容。\\\\n\\\\n例子:\\\\n搜索历史:\\\\nUser:今天上午你干嘛了\\\\nAssistant:去打篮球啦\\\\nUser:好玩吗?\\\\n答案:\\\\n打篮球好玩吗?', 'dataset_id': '1f777fa3-26db-4237-98d5-075abc07a84f', 'dataset_name': '多轮改写Prompt', 'document_id': '92e0f30d-1f30-46f0-8377-59ab0fb6eb93', 'document_name': '多轮改写prompt_带机器人回复.txt', 'id': '61657591-f610-44f0-84ec-67cedcb66447', 'mock_id': '1', 'position': 0, 'score': 0.511053, 'sentences': [{'content': '带机器人回复:请你扮演一个智能搜索改写补全机器人,请根据User的搜索历史以及对应的搜索结果,对最后一句话先进行主语继承改写,然后进行上下文信息补全,注意:不要改变原文的意思,答案要尽可能简洁,不要直接回答该问题,不要输出多于的内容。\\\\n\\\\n例子:\\\\n搜索历史:\\\\nUser:今天上午你干嘛了\\\\nAssistant:去打篮球啦\\\\nUser:好玩吗?', 'id': '1f777fa3-26db-4237-98d5-075abc07a84f-5992356ea8c0c05485388623218e134e-975ec17bbf8206762df7cfb24a5cd85e-97468bdaf0accef718118a2b742d5cc0', 'score': 0.628708, 'source': None}], 'title': '多轮改写prompt_带机器人回复.txt', 'tokens': 0, 'type': 'engine', 'word_count': 188}]}, 'token_usage': {'prompt_tokens': 910, 'completion_tokens': 3, 'total_tokens': 913}}\n",
      "{'content': '百度公司是中国最大的互联网搜索引擎提供商之一,也是全球领先的AI公司。以下是对百度的详细介绍:\\n\\n一、公司概况\\n\\n百度(BIDU)是一家提供中文搜索引擎的公司,由李彦宏于2000年1月在北京中关村创立。经过多年的发展,百度已经从单一的搜索引擎服务商成功转型为内容生态与人工智能(AI)融合的互联网公司。百度的使命是“用科技让复杂的世界更简单”,其核心价值观包括“简单可依赖”。\\n\\n二、主要业务与产品\\n\\n1. 搜索业务:百度搜索是中国最大的中文搜索引擎,每天响应来自全球各地的搜索请求。除了传统的网页、图片、视频等搜索结果外,还提供了知识图谱、语音搜索等创新功能。\\n2. 移动生态业务:百度APP是百度移动生态的核心产品,围绕看、搜、听、问、购等核心场景为用户提供服务。此外,百度还拥有信息流、智能小程序、百度知道、百度文库等一系列移动生态产品。\\n3. 智能云业务:百度智能云是百度提供的云计算服务平台,为企业提供计算、存储、网络等基础设施服务以及人工智能、大数据等中间件服务。\\n4. 智能驾驶业务:百度在自动驾驶领域具有领先地位,其Apollo自动驾驶平台已经发展出多种商业模式,包括自动驾驶技术解决方案、百度造车以及共享无人车等。\\n\\n三、财务状况与业绩表现\\n\\n根据百度发布的财报显示,其业绩表现亮眼。例如,在2023年,百度总营收达到了显著的水平,其中百度核心收入同比增长。这主要得益于公司在广告市场的持续领先地位以及非在线营销收入的增长。同时,百度在研发投入方面也保持了较高水平,以推动其AI技术的持续创新和发展。\\n\\n四、AI技术与创新\\n\\n百度在AI技术方面取得了显著成果。其文心大模型已经升级到4.0版本,用户规模超过了1亿。这一技术使得百度具备了与全球领先的AI产品相媲美的能力。此外,百度还在文字生成视频等领域进行了战略投资,以进一步拓展其业务范围并加强在AI领域的领先地位。\\n\\n综上所述,百度公司作为中国最大的互联网搜索引擎提供商和全球领先的AI公司之一,凭借其强大的技术实力和创新能力,在搜索、移动生态、智能云和智能驾驶等领域取得了显著的成果。', 'name': 'msg', 'mtype': 'dict', 'id': 'c4f02188-1206-4c02-be8e-1c5481428003', 'extra': {}, 'token_usage': {'prompt_tokens': 4, 'completion_tokens': 456, 'total_tokens': 460}}\n"
     ]
    }
   ],
   "source": [
    "import json\n",
    "cursor.execute(\"SELECT message_value FROM appbuilder_session_messages;\")  \n",
    "for row in cursor.fetchall():  \n",
    "    print(json.loads(row[0]))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5ff82880",
   "metadata": {},
   "source": [
    "以id查询相关的agent_runtime信息"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "id": "e79e2554",
   "metadata": {
    "vscode": {
     "languageId": "shellscript"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "16010b88-d766-4524-81ee-37f96ceadb4d\n",
      "b2c9d058-4475-4258-ad90-4334f3d024d5\n",
      "0bdafb3d-f7e3-4187-bc1d-63cf51fbda29\n",
      "query\n",
      "{'content': '你好', 'name': 'msg', 'mtype': 'str', 'id': '90c8d150-c7b9-44a4-ac77-50dd61ee329a'}\n",
      "2024-07-30 15:01:10.949475\n",
      "2024-07-30 15:01:10.949485\n",
      "0\n",
      "4bd85fd0-2e5c-4de1-a47e-ea122f7e928c\n",
      "b2c9d058-4475-4258-ad90-4334f3d024d5\n",
      "0bdafb3d-f7e3-4187-bc1d-63cf51fbda29\n",
      "answer\n",
      "{'content': '你好,我是百度研发的知识增强大语言模型,中文名是文心一言,英文名是ERNIE Bot。我能够与人对话互动,回答问题,协助创作,高效便捷地帮助人们获取信息、知识和灵感。', 'name': 'msg', 'mtype': 'dict', 'id': '0fc6c5f7-23bf-4f25-8555-69b4155908b7', 'extra': {}, 'token_usage': {'prompt_tokens': 2, 'completion_tokens': 42, 'total_tokens': 44}}\n",
      "2024-07-30 15:01:10.955875\n",
      "2024-07-30 15:01:10.955884\n",
      "0\n",
      "d6e433fc-ef4d-4ade-9a63-fec600e95481\n",
      "b2c9d058-4475-4258-ad90-4334f3d024d5\n",
      "6300b76b-2307-4ed3-9f6d-e61dfc621ff8\n",
      "query\n",
      "{'content': '请介绍一下你自己', 'name': 'msg', 'mtype': 'dict', 'id': '4f5cf6d1-976e-456e-a632-93c4b2550523', 'extra': {'search_db': [{'content': '带机器人回复:请你扮演一个智能搜索改写补全机器人,请根据User的搜索历史以及对应的搜索结果,对最后一句话先进行主语继承改写,然后进行上下文信息补全,注意:不要改变原文的意思,答案要尽可能简洁,不要直接回答该问题,不要输出多于的内容。\\\\n\\\\n例子:\\\\n搜索历史:\\\\nUser:今天上午你干嘛了\\\\nAssistant:去打篮球啦\\\\nUser:好玩吗?\\\\n答案:\\\\n打篮球好玩吗?', 'dataset_id': '1f777fa3-26db-4237-98d5-075abc07a84f', 'dataset_name': '多轮改写Prompt', 'document_id': '92e0f30d-1f30-46f0-8377-59ab0fb6eb93', 'document_name': '多轮改写prompt_带机器人回复.txt', 'id': '61657591-f610-44f0-84ec-67cedcb66447', 'mock_id': '1', 'position': 0, 'score': 0.511053, 'sentences': [{'content': '带机器人回复:请你扮演一个智能搜索改写补全机器人,请根据User的搜索历史以及对应的搜索结果,对最后一句话先进行主语继承改写,然后进行上下文信息补全,注意:不要改变原文的意思,答案要尽可能简洁,不要直接回答该问题,不要输出多于的内容。\\\\n\\\\n例子:\\\\n搜索历史:\\\\nUser:今天上午你干嘛了\\\\nAssistant:去打篮球啦\\\\nUser:好玩吗?', 'id': '1f777fa3-26db-4237-98d5-075abc07a84f-5992356ea8c0c05485388623218e134e-975ec17bbf8206762df7cfb24a5cd85e-97468bdaf0accef718118a2b742d5cc0', 'score': 0.628708, 'source': None}], 'title': '多轮改写prompt_带机器人回复.txt', 'tokens': 0, 'type': 'engine', 'word_count': 188}]}, 'token_usage': {'prompt_tokens': 321, 'completion_tokens': 3, 'total_tokens': 324}}\n",
      "2024-07-30 15:01:19.161269\n",
      "2024-07-30 15:01:19.161272\n",
      "0\n",
      "f0d76f00-93be-4d7c-a6b3-a9583fd677ad\n",
      "b2c9d058-4475-4258-ad90-4334f3d024d5\n",
      "6300b76b-2307-4ed3-9f6d-e61dfc621ff8\n",
      "answer\n",
      "{'content': '您好,我是文心一言,英文名是ERNIE Bot。我能够与人对话互动,回答问题,协助创作,高效便捷地帮助人们获取信息、知识和灵感。', 'name': 'msg', 'mtype': 'dict', 'id': 'f769c850-f4e5-4d02-a62a-766fd8c8132e', 'extra': {}, 'token_usage': {'prompt_tokens': 4, 'completion_tokens': 33, 'total_tokens': 37}}\n",
      "2024-07-30 15:01:19.163405\n",
      "2024-07-30 15:01:19.163411\n",
      "0\n",
      "936c394a-a3fa-48fd-a72f-b1778ebc35e4\n",
      "b2c9d058-4475-4258-ad90-4334f3d024d5\n",
      "5eb09e91-6496-44d9-9303-a4790e97f61c\n",
      "query\n",
      "{'content': '介绍一下baidu公司', 'name': 'msg', 'mtype': 'dict', 'id': '0ff3b298-7f01-4036-927d-722e00afaf33', 'extra': {'search_db': [{'content': '带机器人回复:请你扮演一个智能搜索改写补全机器人,请根据User的搜索历史以及对应的搜索结果,对最后一句话先进行主语继承改写,然后进行上下文信息补全,注意:不要改变原文的意思,答案要尽可能简洁,不要直接回答该问题,不要输出多于的内容。\\\\n\\\\n例子:\\\\n搜索历史:\\\\nUser:今天上午你干嘛了\\\\nAssistant:去打篮球啦\\\\nUser:好玩吗?\\\\n答案:\\\\n打篮球好玩吗?', 'dataset_id': '1f777fa3-26db-4237-98d5-075abc07a84f', 'dataset_name': '多轮改写Prompt', 'document_id': '92e0f30d-1f30-46f0-8377-59ab0fb6eb93', 'document_name': '多轮改写prompt_带机器人回复.txt', 'id': '61657591-f610-44f0-84ec-67cedcb66447', 'mock_id': '1', 'position': 0, 'score': 0.511053, 'sentences': [{'content': '带机器人回复:请你扮演一个智能搜索改写补全机器人,请根据User的搜索历史以及对应的搜索结果,对最后一句话先进行主语继承改写,然后进行上下文信息补全,注意:不要改变原文的意思,答案要尽可能简洁,不要直接回答该问题,不要输出多于的内容。\\\\n\\\\n例子:\\\\n搜索历史:\\\\nUser:今天上午你干嘛了\\\\nAssistant:去打篮球啦\\\\nUser:好玩吗?', 'id': '1f777fa3-26db-4237-98d5-075abc07a84f-5992356ea8c0c05485388623218e134e-975ec17bbf8206762df7cfb24a5cd85e-97468bdaf0accef718118a2b742d5cc0', 'score': 0.628708, 'source': None}], 'title': '多轮改写prompt_带机器人回复.txt', 'tokens': 0, 'type': 'engine', 'word_count': 188}]}, 'token_usage': {'prompt_tokens': 910, 'completion_tokens': 3, 'total_tokens': 913}}\n",
      "2024-07-30 15:02:21.551493\n",
      "2024-07-30 15:02:21.551529\n",
      "0\n",
      "5cd9d7ef-e26f-48ca-bd55-de2861cd4e84\n",
      "b2c9d058-4475-4258-ad90-4334f3d024d5\n",
      "5eb09e91-6496-44d9-9303-a4790e97f61c\n",
      "answer\n",
      "{'content': '百度公司是中国最大的互联网搜索引擎提供商之一,也是全球领先的AI公司。以下是对百度的详细介绍:\\n\\n一、公司概况\\n\\n百度(BIDU)是一家提供中文搜索引擎的公司,由李彦宏于2000年1月在北京中关村创立。经过多年的发展,百度已经从单一的搜索引擎服务商成功转型为内容生态与人工智能(AI)融合的互联网公司。百度的使命是“用科技让复杂的世界更简单”,其核心价值观包括“简单可依赖”。\\n\\n二、主要业务与产品\\n\\n1. 搜索业务:百度搜索是中国最大的中文搜索引擎,每天响应来自全球各地的搜索请求。除了传统的网页、图片、视频等搜索结果外,还提供了知识图谱、语音搜索等创新功能。\\n2. 移动生态业务:百度APP是百度移动生态的核心产品,围绕看、搜、听、问、购等核心场景为用户提供服务。此外,百度还拥有信息流、智能小程序、百度知道、百度文库等一系列移动生态产品。\\n3. 智能云业务:百度智能云是百度提供的云计算服务平台,为企业提供计算、存储、网络等基础设施服务以及人工智能、大数据等中间件服务。\\n4. 智能驾驶业务:百度在自动驾驶领域具有领先地位,其Apollo自动驾驶平台已经发展出多种商业模式,包括自动驾驶技术解决方案、百度造车以及共享无人车等。\\n\\n三、财务状况与业绩表现\\n\\n根据百度发布的财报显示,其业绩表现亮眼。例如,在2023年,百度总营收达到了显著的水平,其中百度核心收入同比增长。这主要得益于公司在广告市场的持续领先地位以及非在线营销收入的增长。同时,百度在研发投入方面也保持了较高水平,以推动其AI技术的持续创新和发展。\\n\\n四、AI技术与创新\\n\\n百度在AI技术方面取得了显著成果。其文心大模型已经升级到4.0版本,用户规模超过了1亿。这一技术使得百度具备了与全球领先的AI产品相媲美的能力。此外,百度还在文字生成视频等领域进行了战略投资,以进一步拓展其业务范围并加强在AI领域的领先地位。\\n\\n综上所述,百度公司作为中国最大的互联网搜索引擎提供商和全球领先的AI公司之一,凭借其强大的技术实力和创新能力,在搜索、移动生态、智能云和智能驾驶等领域取得了显著的成果。', 'name': 'msg', 'mtype': 'dict', 'id': 'c4f02188-1206-4c02-be8e-1c5481428003', 'extra': {}, 'token_usage': {'prompt_tokens': 4, 'completion_tokens': 456, 'total_tokens': 460}}\n",
      "2024-07-30 15:02:21.557667\n",
      "2024-07-30 15:02:21.557671\n",
      "0\n"
     ]
    }
   ],
   "source": [
    "cursor.execute(\"SELECT * FROM appbuilder_session_messages WHERE session_id = 'b2c9d058-4475-4258-ad90-4334f3d024d5';\")  \n",
    "for tuple in cursor.fetchall():\n",
    "    for message in tuple:\n",
    "        try: \n",
    "            message = json.loads(message)\n",
    "            print(message)\n",
    "        except:\n",
    "            print(message)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}


================================================
FILE: cookbooks/components/asr.ipynb
================================================
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# 短语音识别组件\n",
    "\n",
    "## 目标\n",
    "使用短语音识别组件对输入的语音文件进行识别,返回识别的文字。\n",
    "\n",
    "## 准备工作\n",
    "### 平台注册\n",
    "1.先在appbuilder平台注册,获取token\n",
    "\n",
    "2.安装appbuilder-sdk"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "!pip install appbuilder-sdk"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 基本用法\n",
    "\n",
    "### 快速开始\n",
    "\n",
    "下面是短语音识别的代码示例:"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "import os\n",
    "import requests\n",
    "import appbuilder\n",
    "# 设置环境变量和初始化\n",
    "# 请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = \"...\"\n",
    "\n",
    "asr = appbuilder.ASR()\n",
    "\n",
    "audio_file_url = \"https://bj.bcebos.com/v1/appbuilder/asr_test.pcm?authorization=bce-auth-v1\" \\\n",
    "                   \"%2FALTAKGa8m4qCUasgoljdEDAzLm%2F2024-01-11T10%3A56%3A41Z%2F-1%2Fhost\" \\\n",
    "                   \"%2Fa6c4d2ca8a3f0259f4cae8ae3fa98a9f75afde1a063eaec04847c99ab7d1e411\"\n",
    "audio_data = requests.get(audio_file_url).content\n",
    "content_data = {\"audio_format\": \"pcm\", \"raw_audio\": audio_data, \"rate\": 16000}\n",
    "msg = appbuilder.Message(content_data)\n",
    "out = asr.run(msg)\n",
    "print(out.content)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 参数说明\n",
    "\n",
    "### 鉴权配置\n",
    "使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)。\n",
    "```python\n",
    "# 设置环境中的TOKEN,以下示例略\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = \"bce-YOURTOKEN\"\n",
    "```\n",
    "\n",
    "### 初始化参数\n",
    "\n",
    "无\n",
    "\n",
    "### 调用参数\n",
    "\n",
    "|参数名称 |参数类型 |是否必须 |描述 | 示例值    |\n",
    "|--------|--------|--------|----|--------|\n",
    "|message |String  |是 |输入的消息,用于模型的主要输入内容。这是一个必需的参数| Message(content={\"raw_audio\": b\"...\"}) |\n",
    "|audio_format|String|是 |定义语言文件的格式,包括\"pcm\"、\"wav\"、\"amr\"、\"m4a\",默认值为\"pcm\"| pcm    |\n",
    "|rate|Integer|是 |定义录音采样率,固定值16000| 16000  |\n",
    "|timeout| Float   | 否    | HTTP超时时间,单位:秒               |1|\n",
    "|retry|Integer|是 |HTTP重试次数| 3      |\n",
    "\n",
    "### 响应参数\n",
    "|参数名称 | 参数类型         |描述 |示例值|\n",
    "|--------|--------------|----|------|\n",
    "|result  | List[String] |返回结果|[\"北京科技馆。\"]|\n",
    "\n",
    "### 响应示例\n",
    "```json\n",
    "{\"result\": [\"北京科技馆。\"]}\n",
    "```\n",
    "### 错误码\n",
    "| 错误码 |描述|\n",
    "|---|---|\n",
    "| 0 |success|\n",
    "| 2000  |data empty|"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}


================================================
FILE: cookbooks/components/gbi.ipynb
================================================
{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "f802e64d-4eaa-445d-a48a-1042a91bc394",
   "metadata": {
    "tags": []
   },
   "source": [
    "# GBI\n",
    "\n",
    "## 目标\n",
    "通过 GBI sdk 接口完成选表和问表的能力。 \n",
    "\n",
    "## 准备工作\n",
    "### 平台注册\n",
    "1.先在appbuilder平台注册,获取token\n",
    "2.安装appbuilder-sdk"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "2939356f-61c2-42e9-9e0c-fc6729c193f6",
   "metadata": {},
   "outputs": [],
   "source": [
    "# !pip install appbuilder-sdk"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "4ccff03b-1567-4e8b-8e1f-9a5032690406",
   "metadata": {},
   "outputs": [],
   "source": [
    "import logging\n",
    "import os\n",
    "\n",
    "#  设置环境变量\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = \"***\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "aeb2fa55-075f-48df-a9fb-8b40d9900684",
   "metadata": {},
   "source": [
    "## 开发过程"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1c3c5cee",
   "metadata": {},
   "source": [
    "### 设置表的 schema"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d7d6440c",
   "metadata": {},
   "outputs": [],
   "source": [
    "SUPER_MARKET_SCHEMA = \"\"\"\n",
    "```\n",
    "CREATE TABLE `supper_market_info` (\n",
    "  `订单编号` varchar(32) DEFAULT NULL,\n",
    "  `订单日期` date DEFAULT NULL,\n",
    "  `邮寄方式` varchar(32) DEFAULT NULL,\n",
    "  `地区` varchar(32) DEFAULT NULL,\n",
    "  `省份` varchar(32) DEFAULT NULL,\n",
    "  `客户类型` varchar(32) DEFAULT NULL,\n",
    "  `客户名称` varchar(32) DEFAULT NULL,\n",
    "  `商品类别` varchar(32) DEFAULT NULL,\n",
    "  `制造商` varchar(32) DEFAULT NULL,\n",
    "  `商品名称` varchar(32) DEFAULT NULL,\n",
    "  `数量` int(11) DEFAULT NULL,\n",
    "  `销售额` int(11) DEFAULT NULL,\n",
    "  `利润` int(11) DEFAULT NULL\n",
    ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4\n",
    "```\n",
    "\"\"\"\n",
    "\n",
    "PRODUCT_SALES_INFO = \"\"\"\n",
    "现有 mysql 表 product_sales_info, \n",
    "该表的用途是: 产品收入表\n",
    "```\n",
    "CREATE TABLE `product_sales_info` (\n",
    "  `年` int,\n",
    "  `月` int,\n",
    "  `产品名称` varchar,\n",
    "  `收入` decimal,\n",
    "  `非交付成本` decimal,\n",
    "  `含交付毛利` decimal\n",
    ")\n",
    "```\n",
    "\"\"\"\n",
    "\n",
    "# schema 和表名的映射\n",
    "SCHEMA_MAPPING = {\n",
    "    \"supper_market_info\": SUPER_MARKET_SCHEMA,\n",
    "    \"PRODUCT_SALES_INFO\": PRODUCT_SALES_INFO\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "463254a1",
   "metadata": {},
   "source": [
    "设置表的描述用于选表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "7fefcae1",
   "metadata": {},
   "outputs": [],
   "source": [
    "table_descriptions = {\n",
    "    \"supper_market_info\": \"超市营收明细表,包含超市各种信息等\",\n",
    "    \"product_sales_info\": \"产品销售表\"\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a0aff843",
   "metadata": {},
   "source": [
    "### 选表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "41559341-fd7a-478c-a08b-1477d79e9d41",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-12-18T06:24:26.982459Z",
     "start_time": "2023-12-18T06:23:53.771345Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "选的表是: ['supper_market_info']\n"
     ]
    }
   ],
   "source": [
    "import appbuilder\n",
    "from appbuilder.core.message import Message\n",
    "from appbuilder.core.components.gbi.basic import SessionRecord\n",
    "\n",
    "# 生成问表对象\n",
    "select_table = appbuilder.SelectTable(model_name=\"ERNIE-Bot 4.0\", table_descriptions=table_descriptions)\n",
    "query = \"列出超市中的所有数据\"\n",
    "msg = Message({\"query\": query})\n",
    "select_table_result_message = select_table(msg)\n",
    "print(f\"选的表是: {select_table_result_message.content}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "16a8aa38-7a33-4e27-bca4-00900cfe1641",
   "metadata": {},
   "source": [
    "### 问表\n",
    "基于上面选出的表,通过获取表的 schema 进行问表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "9f45ef5f-6206-4b31-83c4-3c8eb2c86925",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sql: SELECT * FROM supper_market_info;\n",
      "-----------------\n",
      "llm result: ```sql\n",
      "SELECT * FROM supper_market_info;\n",
      "```\n"
     ]
    }
   ],
   "source": [
    "table_schemas = [SCHEMA_MAPPING[table_name] for table_name in select_table_result_message.content]\n",
    "gbi_nl2sql = appbuilder.NL2Sql(model_name=\"ERNIE-Bot 4.0\", table_schemas=table_schemas)\n",
    "nl2sql_result_message = gbi_nl2sql(Message({\"query\": \"列出超市中的所有数据\"}))\n",
    "print(f\"sql: {nl2sql_result_message.content.sql}\")\n",
    "print(\"-----------------\")\n",
    "print(f\"llm result: {nl2sql_result_message.content.llm_result}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b0409c46-e8c7-403a-a827-fcdc8e717be6",
   "metadata": {},
   "source": [
    "设置 session"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "a23b8cad-f426-4074-9311-c2c33aaea07b",
   "metadata": {},
   "outputs": [],
   "source": [
    "session = list()\n",
    "session.append(SessionRecord(query=query, answer=nl2sql_result_message.content))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "22b3d877-f61f-4958-a084-7507a3017e17",
   "metadata": {},
   "source": [
    "再次问表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "2adcb091-fb53-4364-b4d8-20564439ff51",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sql: SELECT * FROM supper_market_info WHERE 商品类别 = '水果'\n",
      "-----------------\n",
      "llm result: ```sql\n",
      "SELECT * FROM supper_market_info WHERE 商品类别 = '水果'\n",
      "```\n"
     ]
    }
   ],
   "source": [
    "nl2sql_result_message2 = gbi_nl2sql(Message({\"query\": \"查看商品类别是水果的所有数据\", \n",
    "                                             \"session\": session}))\n",
    "print(f\"sql: {nl2sql_result_message2.content.sql}\")\n",
    "print(\"-----------------\")\n",
    "print(f\"llm result: {nl2sql_result_message2.content.llm_result}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9e0609ae-f2bc-43d3-9023-14e9f8618158",
   "metadata": {},
   "source": [
    "### 增加列选优化\n",
    "实际上数据中 \"商品类别\" 存储的是 \"新鲜水果\", 那么就可以通过列选的限制来优化 sql."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "2a7c7923-019e-4660-9e36-4431e9d2f3a6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sql: SELECT * FROM supper_market_info WHERE 商品类别 = '新鲜水果'\n",
      "-----------------\n",
      "llm result: ```sql\n",
      "SELECT * FROM supper_market_info WHERE 商品类别 = '新鲜水果'\n",
      "```\n"
     ]
    }
   ],
   "source": [
    "from appbuilder.core.components.gbi.basic import ColumnItem\n",
    "\n",
    "\n",
    "column_constraint = [ColumnItem(ori_value=\"水果\", \n",
    "                               column_name=\"商品类别\", \n",
    "                               column_value=\"新鲜水果\", \n",
    "                               table_name=\"supper_market_info\", \n",
    "                               is_like=False)]\n",
    "\n",
    "nl2sql_result_message2 = gbi_nl2sql(Message({\"query\": \"查看商品类别是水果的所有数据\",\n",
    "                                    \"column_constraint\": column_constraint}))\n",
    "\n",
    "print(f\"sql: {nl2sql_result_message2.content.sql}\")\n",
    "print(\"-----------------\")\n",
    "print(f\"llm result: {nl2sql_result_message2.content.llm_result}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8385312c-aea1-42cd-b61b-a8d36f4f0665",
   "metadata": {},
   "source": [
    "从上面我们看到,商品类别不在是 \"水果\" 而是 修订为 \"新鲜水果\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6e98c414-8b2b-4187-a270-3117a4f431ff",
   "metadata": {},
   "source": [
    "### 增加知识优化\n",
    "当计算某些特殊知识的时候,大模型是不知道的,所以需要告诉大模型具体的知识,比如:\n",
    "利润率的计算方式: 利润/销售额\n",
    "可以将该知识注入。具体示例如下:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "cade4693-29dc-431c-bf84-c6dc09104294",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 注入知识\n",
    "gbi_nl2sql.knowledge[\"利润率\"] = \"计算方式: 利润/销售额\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "1dc181e8-47a1-4b82-8bb5-ce3339be53f6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sql: SELECT 商品类别, SUM(利润)/SUM(销售额) AS 利润率\n",
      "FROM supper_market_info\n",
      "WHERE 商品类别 = '日用品'\n",
      "GROUP BY 商品类别\n",
      "-----------------\n",
      "llm result: ```sql\n",
      "SELECT 商品类别, SUM(利润)/SUM(销售额) AS 利润率\n",
      "FROM supper_market_info\n",
      "WHERE 商品类别 = '日用品'\n",
      "GROUP BY 商品类别\n",
      "```\n"
     ]
    }
   ],
   "source": [
    "nl2sql_result_message3 = gbi_nl2sql(Message({\"query\": \"列出商品类别是日用品的利润率\"}))\n",
    "print(f\"sql: {nl2sql_result_message3.content.sql}\")\n",
    "print(\"-----------------\")\n",
    "print(f\"llm result: {nl2sql_result_message3.content.llm_result}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c5570cd9-dbaf-45cd-ab03-1a7f92e7d0d4",
   "metadata": {},
   "source": [
    "## 调整 prompt 模版\n",
    "有时候,我们希望定义自己的prompt, 选表和问表两个环节都支持 prompt 模版的定制化,但是必须遵循对应的 prompt 模版的格式。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6e3d4967-2b4c-437d-9d72-fb1b94bdcf59",
   "metadata": {},
   "source": [
    "### 选表 prompt 调整\n",
    "选表的 prompt template, 必须包含 \n",
    "1. {num} - 表的数量, 注意 {num} 有两个地方出现\n",
    "2. {table_desc} - 表的描述\n",
    "3. {query} - query\n",
    "\n",
    "注意: {num}, {table_desc}, {query} 表示的是占位符,**用户不需要在自定义的 prompt template 中将这些值填充上**,gbi 系统会自动根据 SelectTable 构造函数中提交的参数进行填充这些占位符,从而产生最后的给大模型的 prompt。注意 prompt template 和 prompt 的区别。\n",
    "\n",
    "* prompt template - 是带有占位符的 prompt, gbi 会根据具体参数填充到这些占位符,形成最终的 prompt\n",
    "* promt - 是将 prompt template 填充完占位符的结果。\n",
    "\n",
    "用户可以使用这些占位符重新设置自己的 prompt 模版,从而达到修改 prompt 的目的。\n",
    "具体请参考下面的 prompt template 示例:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "2ae6ffbc-4237-4fb2-8168-480b81bfd873",
   "metadata": {},
   "outputs": [],
   "source": [
    "SELECT_TABLE_PROMPT_TEMPLATE = \"\"\"\n",
    "你是一个专业的业务人员,下面有{num}张表,具体表名如下:\n",
    "{table_desc}\n",
    "请根据问题帮我选择上述1-{num}种的其中相关表并返回,可以为多表,也可以为单表,\n",
    "返回多张表请用“,”隔开\n",
    "返回格式请参考如下示例:\n",
    "问题:有多少个审核通过的投运单?\n",
    "回答: ```DWD_MAT_OPERATION```\n",
    "请严格参考示例只不要返回无关内容,直接给出最终答案后面的内容,分析步骤不要输出\n",
    "问题:{query}\n",
    "回答:\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "2bbbb375-6659-4ef0-82ff-a4ace9fdd4f0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "选的表是: ['supper_market_info']\n"
     ]
    }
   ],
   "source": [
    "select_table4 = appbuilder.SelectTable(model_name=\"ERNIE-Bot 4.0\", \n",
    "                                          table_descriptions=table_descriptions,\n",
    "                                          prompt_template=SELECT_TABLE_PROMPT_TEMPLATE)\n",
    "\n",
    "select_table_result_message4 = select_table4(Message({\"query\":\"列出超市中的所有数据\"}))\n",
    "print(f\"选的表是: {select_table_result_message4.content}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4f3fd089-613b-4bdd-95ac-c87f89c0fc61",
   "metadata": {},
   "source": [
    "## 问表 prompt 调整\n",
    "问表的 prompt template 必须包含:\n",
    "1. {schema} - 表的 schema 信息, gbi系统使用构建 NL2Sql 对象的 table_schemas 成员来填充该占位符,在构造函数中需要填充该参数。\n",
    "2. {instrument} - 列选限制的信息, gbi系统会使用 `NL2Sql.__call__` 函数的 Message 中的 column_constraint 参数来填充该占位符\n",
    "3. {kg} - 知识, gbi系统使用构建 NL2Sql 对象的 knowledge  成员来填充该占位符,在构造函数中需要填充该参数。\n",
    "4. {date} - 时间, gbi系统会自动填充该占位符, 用户不需要提供\n",
    "5. {history_prompt} - 历史, gbi系统会使用 `NL2Sql.__call__` 函数的  Message 中的 session 参数来填充该占位符\n",
    "6. {query} - 当前问题,  gbi系统会使用 `NL2Sql.__call__` 函数的 Message 中的 query 参数来填充该占位符\n",
    "\n",
    "\n",
    "注意: {schema}, {instrument}, {kg}, {date}, {history_prompt}, {query} 表示的是占位符,**用户不需要在自定义的 prompt template 中将这些值填充上**,gbi 系统会自动根据 `NL2Sql.__call__` 函数中提交的参数 或者 Nl2sql 的成员变量 进行填充这些占位符,从而产生最后的给大模型的 prompt。注意 prompt template 和 prompt 的区别。\n",
    "\n",
    "* prompt template - 是带有占位符的 prompt, gbi 会根据具体参数填充到这些占位符,形成最终的 prompt\n",
    "* promt - 是将 prompt template 填充完占位符的结果。\n",
    "\n",
    "用户可以使用这些占位符重新设置自己的 prompt 模版,从而达到修改 prompt 的目的。\n",
    "具体请参考下面的 prompt template 示例:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "323fbe75-62ca-44ab-9ca2-9f747939a2b5",
   "metadata": {},
   "outputs": [],
   "source": [
    "NL2SQL_PROMPT_TEMPLATE = \"\"\"\n",
    "  MySql 表 Schema 如下:\n",
    "  {schema}\n",
    "  请根据用户当前问题,联系历史信息,仅编写1个sql,其中 sql 语句需要使用```sql ```这种 markdown 形式给出。\n",
    "  请参考列选信息:\n",
    "  {instrument}\n",
    "  请参考知识:\n",
    "  {kg}\n",
    "  当前时间:{date}\n",
    "  历史信息如下:\n",
    "  {history_prompt}\n",
    "  当前问题:\"{query}\"\n",
    "  回答:\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "52436f03-e01c-456a-aaa0-5a7f1afcd9d2",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "sql: SELECT * FROM supper_market_info WHERE 商品类别 = '水果'\n",
      "-----------------\n",
      "llm result: ```sql\n",
      "SELECT * FROM supper_market_info WHERE 商品类别 = '水果'\n",
      "```\n"
     ]
    }
   ],
   "source": [
    "\n",
    "gbi_nl2sql5 = appbuilder.NL2Sql(model_name=\"ERNIE-Bot 4.0\", table_schemas=table_schemas, prompt_template=NL2SQL_PROMPT_TEMPLATE)\n",
    "nl2sql_result_message5 = gbi_nl2sql5(Message({\"query\": \"查看商品类别是水果的所有数据\"}))\n",
    "print(f\"sql: {nl2sql_result_message5.content.sql}\")\n",
    "print(\"-----------------\")\n",
    "print(f\"llm result: {nl2sql_result_message5.content.llm_result}\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}


================================================
FILE: cookbooks/components/general_ocr.ipynb
================================================
{
 "cells": [
  {
   "cell_type": "markdown",
   "source": [
    "# 通用文字识别-高精度版组件\n",
    "\n",
    "## 目标\n",
    "使用通用文字识别-高精度版组件对图片上的全部文字内容进行检测识别。\n",
    "\n",
    "## 准备工作\n",
    "### 平台注册\n",
    "1.先在appbuilder平台注册,获取token\n",
    "\n",
    "2.安装appbuilder-sdk"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "!pip install appbuilder-sdk"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 基本用法\n",
    "\n",
    "### 快速开始\n",
    "\n",
    "以下是一个简单的例子来演示如何开始使用GeneralOCR组件:"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "import os\n",
    "import appbuilder\n",
    "import requests\n",
    "\n",
    "# 请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = '...'\n",
    "# 从BOS读取样例图片\n",
    "image_url = \"https://bj.bcebos.com/v1/appbuilder/general_ocr_test.png?\"\\\n",
    "    \"authorization=bce-auth-v1%2FALTAKGa8m4qCUasgoljdEDAzLm%2F2024-01-\"\\\n",
    "    \"11T10%3A59%3A17Z%2F-1%2Fhost%2F081bf7bcccbda5207c82a4de074628b04ae\"\\\n",
    "    \"857a27513734d765495f89ffa5f73\"\n",
    "raw_image = requests.get(image_url).content\n",
    "general_ocr = appbuilder.GeneralOCR()\n",
    "out = general_ocr.run(appbuilder.Message(content={\"raw_image\": raw_image}))\n",
    "print(out.content)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "##  参数说明\n",
    "\n",
    "### 鉴权说明\n",
    "使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)。\n",
    "```python\n",
    "# 设置环境中的TOKEN,以下示例略\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = \"bce-YOURTOKEN\"\n",
    "```\n",
    "\n",
    "### 初始化参数\n",
    "\n",
    "无\n",
    "\n",
    "### 调用参数\n",
    "\n",
    "| 参数名称    | 参数类型    | 是否必须 | 描述                          | 示例值                                            |\n",
    "|---------|---------|------|-----------------------------|------------------------------------------------|\n",
    "| message | String  | 是    | 输入的消息,用于模型的主要输入内容。这是一个必需的参数 | Message(content={\"raw_image\": b\"待识别的图片字节流数据\"}) |\n",
    "|timeout| Float   | 否    | HTTP超时时间,单位:秒               |1|\n",
    "| retry   | Integer | 否    | HTTP重试次数                    | 3                                              |\n",
    "\n",
    "### 响应参数\n",
    "| 参数名称         | 参数类型    | 描述      | 示例值                                               |\n",
    "|--------------|---------|---------|---------------------------------------------------|\n",
    "| words_result | Array[] | 返回结果    | [{\"words\":\"一站式企业级大模型平台,提供先进的生成式AI生产及应用全流程开发工具链\"}] |\n",
    "| + words      | String  | 识别结果字符串 | \"百度智能云千帆大模型平台\"                                    |\n",
    "\n",
    "### 响应示例\n",
    "#### 示例图片\n",
    "![示例图片](./image/general_ocr示例.png)\n",
    "#### 识别结果\n",
    "```json\n",
    "{\n",
    "    \"words_result\":[\n",
    "        {\n",
    "            \"words\":\"一站式企业级大模型平台,提供先进的生成式AI生产及应用全流程开发工具链\"\n",
    "        },\n",
    "        {\n",
    "            \"words\":\"百度智能云千帆大模型平台\"\n",
    "        },\n",
    "        {\n",
    "            \"words\":\"文心大模型4.0已正式发布,个人和企业客户可通过百度智能云千帆大模型平台接入使用\"\n",
    "        },\n",
    "        {\n",
    "            \"words\":\"立即使用\"\n",
    "        },\n",
    "        {\n",
    "            \"words\":\"在线体验\"\n",
    "        },\n",
    "        {\n",
    "            \"words\":\"使用文档\"\n",
    "        },\n",
    "        {\n",
    "            \"words\":\"定价说明\"\n",
    "        },\n",
    "        {\n",
    "            \"words\":\"千帆社区\"\n",
    "        },\n",
    "        {\n",
    "            \"words\":\"常见概念、使用指导\"\n",
    "        },\n",
    "        {\n",
    "            \"words\":\"定价、计费方式、计量说明\"\n",
    "        },\n",
    "        {\n",
    "            \"words\":\"大模型开发学习、交流社区\"\n",
    "        }\n",
    "    ]\n",
    "}\n",
    "```\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}


================================================
FILE: cookbooks/components/object_recognize.ipynb
================================================
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# 通用物体和场景识别-高级版组件\n",
    "\n",
    "## 目标\n",
    "使用通用物体和场景识别-高级版组件对图片上的物品或场景进行识别。\n",
    "\n",
    "## 准备工作\n",
    "### 平台注册\n",
    "1.先在appbuilder平台注册,获取token\n",
    "\n",
    "2.安装appbuilder-sdk"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "!pip install appbuilder-sdk"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 基本用法\n",
    "\n",
    "### 快速开始\n",
    "\n",
    "以下是一个简单的例子来演示如何开始使用ObjectRecognition组件:"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "import os\n",
    "import appbuilder\n",
    "import requests\n",
    "\n",
    "# 请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = '...'\n",
    "\n",
    "# 从BOS读取样例图片\n",
    "image_url = \"https://bj.bcebos.com/v1/appbuilder/object_recognize_test.png?\"\\\n",
    "    \"authorization=bce-auth-v1%2FALTAKGa8m4qCUasgoljdEDAzLm%2F2024-01-\"\\\n",
    "    \"11T11%3A00%3A19Z%2F-1%2Fhost%2F2c31bf29205f61e58df661dc80af31a1dc\"\\\n",
    "    \"1ba1de0a8f072bc5a87102bd32f9e3\"\n",
    "raw_image = requests.get(image_url).content\n",
    "# 创建物体识别组件实例\n",
    "object_recognition = appbuilder.ObjectRecognition()\n",
    "# 执行识别操作并获取结果\n",
    "out = object_recognition.run(appbuilder.Message(content={\"raw_image\": raw_image}))\n",
    "print(out.content)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 参数说明\n",
    "\n",
    "### 鉴权说明\n",
    "使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)。\n",
    "```python\n",
    "# 设置环境中的TOKEN,以下示例略\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = \"bce-YOURTOKEN\"\n",
    "```\n",
    "\n",
    "### 初始化参数\n",
    "无\n",
    "\n",
    "### 调用参数\n",
    "\n",
    "| 参数名称    | 参数类型    | 是否必须 | 描述                          | 示例值                                            |\n",
    "|---------|---------|------|-----------------------------|------------------------------------------------|\n",
    "| message | String  | 是    | 输入的消息,用于模型的主要输入内容。这是一个必需的参数 | Message(content={\"raw_image\": b\"待识别的图片字节流数据\"}) |\n",
    "|timeout| Float   | 否    | HTTP超时时间,单位:秒               |1|\n",
    "| retry   | Integer | 否    | HTTP重试次数                    | 3                                              |\n",
    "\n",
    "### 响应参数\n",
    "| 参数名称     | 参数类型    | 描述          | 示例值                                                 |\n",
    "|----------|---------|-------------|-----------------------------------------------------|\n",
    "| result   | Array[] | 返回结果        | [{\"keyword\":\"苹果\",\"score\":0.961247,\"root\":\"植物-蔷薇科\"}] |\n",
    "| +keyword | String  | 图片中的物体或场景名称 | \"苹果\"                                                |\n",
    "| +score\t  | Float   | 置信度         | 0.961247                                            |\n",
    "| +root\t   | String  | 识别结果的上层标签   | \"植物-蔷薇科\"                                            |\n",
    "\n",
    "\n",
    "### 响应示例\n",
    "#### 示例图片\n",
    "![示例图片](./image/object_recognize示例.png)\n",
    "#### 识别结果\n",
    "```json\n",
    "{\n",
    "    \"result\":[\n",
    "        {\n",
    "            \"keyword\":\"苹果\",\n",
    "            \"score\":0.961247,\n",
    "            \"root\":\"植物-蔷薇科\"\n",
    "        },\n",
    "        {\n",
    "            \"keyword\":\"姬娜果\",\n",
    "            \"score\":0.740838,\n",
    "            \"root\":\"植物-其它\"\n",
    "        },\n",
    "        {\n",
    "            \"keyword\":\"梨子\",\n",
    "            \"score\":0.392218,\n",
    "            \"root\":\"商品-水果\"\n",
    "        },\n",
    "        {\n",
    "            \"keyword\":\"车厘子\",\n",
    "            \"score\":0.193986,\n",
    "            \"root\":\"植物-其它\"\n",
    "        },\n",
    "        {\n",
    "            \"keyword\":\"石榴\",\n",
    "            \"score\":0.000239,\n",
    "            \"root\":\"植物-千屈菜科\"\n",
    "        }\n",
    "    ]\n",
    "}\n",
    "```\n",
    "\n",
    "\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}


================================================
FILE: cookbooks/components/rag_with_baidusearch.ipynb
================================================
{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "f802e64d-4eaa-445d-a48a-1042a91bc394",
   "metadata": {
    "tags": []
   },
   "source": [
    "# 百度搜索通用问答机器人\n",
    "\n",
    "## 目标\n",
    "使用百度搜索,无需自建知识库,对用户的请求进行回答。\n",
    "\n",
    "用户可通过自定义人设来创建自己的问答机器人服务,并可通过开关配置拒答、澄清反问、重点强调、友好度提升、溯源等能力。\n",
    "\n",
    "## 准备工作\n",
    "### 平台注册\n",
    "\n",
    "1.先在appbuilder平台注册,获取token\n",
    "\n",
    "2.安装appbuilder-sdk"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2939356f-61c2-42e9-9e0c-fc6729c193f6",
   "metadata": {},
   "outputs": [],
   "source": [
    "!pip install appbuilder-sdk"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4ccff03b-1567-4e8b-8e1f-9a5032690406",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "\n",
    "#  设置环境变量\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = \"...\"\n",
    "\n",
    "print(\"init done\")\n"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "aeb2fa55-075f-48df-a9fb-8b40d9900684",
   "metadata": {},
   "source": [
    "## 开发过程\n",
    "### 配置 RAGWithBaiduSearch 组件"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "41559341-fd7a-478c-a08b-1477d79e9d41",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-12-18T06:24:26.982459Z",
     "start_time": "2023-12-18T06:23:53.771345Z"
    }
   },
   "outputs": [],
   "source": [
    "import appbuilder\n",
    "\n",
    "# 人设指令\n",
    "instruction = appbuilder.Message(\"你是问答助手,在回答问题前需要加上“很高兴为您解答“\")\n",
    "\n",
    "# 能力开关\n",
    "reject = False # 拒答\n",
    "clarify = False # 澄清反问\n",
    "highlight = True # 重点强调\n",
    "friendly = False # 友好度提升\n",
    "cite = True # 溯源\n",
    "\n",
    "# 使用 DeepSeek-V3.1 模型\n",
    "component = appbuilder.RAGWithBaiduSearch(model=\"DeepSeek-V3.1\")\n",
    "query = appbuilder.Message(\"海淀区的面积是多少\")\n",
    "\n",
    "answer = component.run(\n",
    "    query, instruction=instruction, reject=reject, clarify=clarify, highlight=highlight, friendly=friendly, cite=cite, stream=False)\n",
    "\n",
    "print(f\"问答结果: {answer.content}\")\n",
    "print(f\"检索返回: {answer.extra}\")"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "5fc5bc38-6bc5-4187-a8fd-f802d77d89fa",
   "metadata": {},
   "source": [
    "### (可选) 使用 AgentRuntime 启动 chainlit 页面调试\n",
    "这部分代码依赖 `appbuilder-sdk[serve]`,如果没有安装,可以执行下面的命令安装:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a10737ec",
   "metadata": {},
   "outputs": [],
   "source": [
    "!pip install 'appbuilder-sdk[serve]'"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "16a3abb2",
   "metadata": {},
   "source": [
    "执行下面的代码,会启动一个 chainlit 页面,页面地址:0.0.0.0:8091"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d514a628-5ae3-4269-aada-eaf8b21c3793",
   "metadata": {},
   "outputs": [],
   "source": [
    "agent = appbuilder.AgentRuntime(component=component)\n",
    "# 启动 chainlit 服务\n",
    "agent.chainlit_demo(port=8091)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "16a8aa38-7a33-4e27-bca4-00900cfe1641",
   "metadata": {},
   "source": [
    "### (可选) 使用 AgentRuntime 启动 HTTP 服务\n",
    "这部分代码依赖 `appbuilder-sdk[serve]`,如果没有安装,可以执行下面的命令安装:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f449fcb6",
   "metadata": {},
   "outputs": [],
   "source": [
    "!pip install 'appbuilder-sdk[serve]'"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "d795f905",
   "metadata": {},
   "source": [
    "执行下面的代码,会启动一个 HTTP 服务"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9f45ef5f-6206-4b31-83c4-3c8eb2c86925",
   "metadata": {},
   "outputs": [],
   "source": [
    "agent.serve(port=8092)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "ccd4c48f",
   "metadata": {},
   "source": [
    "测试服务"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7313e122-5199-4c90-bc6c-ad04e206ccc9",
   "metadata": {
    "vscode": {
     "languageId": "shellscript"
    }
   },
   "outputs": [],
   "source": [
    "curl --location 'http://0.0.0.0:8092/chat' \\\n",
    "--header 'Content-Type: application/json' \\\n",
    "--data '{\n",
    "    \"message\": \"海淀区的面积是多少\",\n",
    "    \"stream\": false\n",
    "}'"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}


================================================
FILE: cookbooks/components/text_generation.ipynb
================================================
{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 文本生成\n",
    "\n",
    "## 说明\n",
    "本文展示了如何使用appbuilder内置组件以及如何快速构建全新的文本生成组件。以下是一个在营销场景下生成各种文本内容的样例。\n",
    "\n",
    "## 概览\n",
    "具体地,本样例按照以下流程进行文本生成:\n",
    "1. 使用**空模板**构建一个全新的文本生成组件:商品信息生成组件。\n",
    "2. 输入一个商品,使用新构建的商品信息生成组件生成该商品的商品信息。\n",
    "3. 基于生成的商品信息,使用内置的**问答对挖掘**组件生成问答对。生成的问答对可用于客服等。\n",
    "4. 基于生成的商品信息,使用内置的**风格写作**组件为该商品生成一份【小红书】文案。\n",
    "5. 使用内置的**标签抽取**组件对生成的文案进行标签抽取。抽取出的标签可用于检索文案。\n",
    "\n",
    "以下我们会演示如何实现我们自己的定制化能力。"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 流程演示\n",
    "### Step 0: 安装Python SDK\n",
    "我们的appbuilder支持使用pip安装(要求Python >= 3.8):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "vscode": {
     "languageId": "shellscript"
    }
   },
   "outputs": [],
   "source": [
    "pip install appbuilder-sdk"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "代码中需要配置用户的`APPBUILDER_TOKEN`。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "\n",
    "# 设置环境变量\n",
    "os.environ['APPBUILDER_TOKEN'] = '...'"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "安装成功后,我们就可以搭建我们自己的能力了。"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 1: 商品信息生成\n",
    "基于appbuilder提供的**空模板**,用户可以自定义文本生成组件以解决多样化的需求。这里我们构建一个**商品信息生成**组件以生成商品信息:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from appbuilder import Message, Playground\n",
    "\n",
    "# 输入到大模型中的prompt的模板\n",
    "prompt_template = \\\n",
    "'''输入商品名,我需要你为我生成该商品的商品信息。\n",
    "\n",
    "要求:\n",
    "- 你生成的商品信息应该包含多方面信息。\n",
    "- 开头和结尾不需要有其他与商品信息无关的内容。\n",
    "\n",
    "商品名:{product_name}\n",
    "商品信息:\n",
    "'''\n",
    "# 创建商品信息生成组件\n",
    "product_information_generation = Playground(prompt_template=prompt_template, model='DeepSeek-V3.1')\n",
    "\n",
    "# 获取商品信息\n",
    "# 填充prompt_template参数的参数映射表,需要与prompt_template对应\n",
    "prompt_template_kwargs = {\n",
    "    'product_name': '特斯拉Model Y'\n",
    "}\n",
    "response = product_information_generation(Message(prompt_template_kwargs), stream=False, temperature=0.5)\n",
    "product_information = response.content\n",
    "print(f'商品信息:\\n{product_information}')"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "输出结果:\n",
    "\n",
    "```\n",
    "商品信息:\n",
    "特斯拉Model Y是一款电动汽车,它拥有许多独特的功能和特性。以下是它的主要特点和优势:\n",
    "\n",
    "特斯拉Model Y是一款电动汽车,它采用纯电力驱动,没有排放和噪音污染,具有零启动加速、零延迟、零维护的特性。\n",
    "特斯拉Model Y拥有先进的自动驾驶技术,可以自动识别交通状况并做出相应的反应,大大提高了驾驶安全性。\n",
    "特斯拉Model Y的电池寿命长,充电效率高,可以在短时间内将电池充满,同时支持快速充电和慢充两种方式。\n",
    "特斯拉Model Y的外观设计独特,线条流畅,充满未来感,内部空间宽敞,乘坐舒适。\n",
    "特斯拉Model Y的价格相对较高,但性价比高,是一款非常值得购买的汽车。\n",
    "\n",
    "总之,特斯拉Model Y是一款集未来科技、安全性、舒适性和实用性于一体的电动汽车。\n",
    "```"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 2: 问答对生成\n",
    "基于Step 1生成的商品信息我们生成一些问答对,这里我们使用内置的**问答对生成**组件。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from appbuilder import QAPairMining\n",
    "\n",
    "# 初始化问答对生成组件\n",
    "qa_pair_mining = QAPairMining(model='DeepSeek-V3.1')\n",
    "\n",
    "# 获取问答对\n",
    "response = qa_pair_mining(Message(product_information), stream=False, temperature=1e-10)\n",
    "qa_pairs = response.content\n",
    "print(f'问答对:\\n{qa_pairs}')"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "输出结果:\n",
    "\n",
    "```\n",
    "问答对:\n",
    "问题:特斯拉Model Y有什么特点?\n",
    "答案:特斯拉Model Y是一款电动汽车,它采用纯电力驱动,没有排放和噪音污染,具有零启动加速、零延迟、零维护的特性。\n",
    "\n",
    "问题:特斯拉Model Y有什么优势?\n",
    "答案:特斯拉Model Y拥有先进的自动驾驶技术,可以自动识别交通状况并做出相应的反应,大大提高了驾驶安全性。\n",
    "\n",
    "问题:特斯拉Model Y的电池寿命如何?\n",
    "答案:特斯拉Model Y的电池寿命长,充电效率高,可以在短时间内将电池充满,同时支持快速充电和慢充两种方式。\n",
    "\n",
    "问题:特斯拉Model Y的外观设计如何?\n",
    "答案:特斯拉Model Y的外观设计独特,线条流畅,充满未来感,内部空间宽敞,乘坐舒适。\n",
    "\n",
    "问题:特斯拉Model Y的价格是多少?\n",
    "答案:特斯拉Model Y的价格相对较高,但性价比高,是一款非常值得购买的汽车。\n",
    "```"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 3: 营销文案生成\n",
    "基于Step 1生成的商品信息生成【小红书】文案,这里我们使用内置的**风格写作**组件。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from appbuilder import StyleWriting\n",
    "\n",
    "# 构造query\n",
    "query = \\\n",
    "f'''请你基于以下商品信息生成文案:\n",
    "{product_information}\n",
    "'''\n",
    "\n",
    "# 初始化风格写作组件\n",
    "style_writing = StyleWriting(model='DeepSeek-V3.1')\n",
    "\n",
    "# 获取小红书文案\n",
    "response = style_writing(Message(query), style_query='小红书', length=300)\n",
    "copywriting = response.content\n",
    "print(f'文案:\\n{copywriting}')"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "输出结果:\n",
    "\n",
    "```\n",
    "【特斯拉Model Y,一款值得拥有的未来科技之车!🚀】\n",
    "\n",
    "🚗Model Y作为一款电动汽车,具有许多独特的功能和特性。它采用纯电力驱动,没有排放和噪音污染,具有零启动加速、零延迟、零维护的特性。在城市道路上行驶,它就像是一阵清风,让你轻松应对各种交通状况。💨\n",
    "\n",
    "🚗特斯拉Model Y还拥有先进的自动驾驶技术,可以自动识别交通状况并做出相应的反应,大大提高了驾驶安全性。在行驶过程中,它就像是一位智能助手,为你提供安全、舒适的驾驶体验。🛡️\n",
    "\n",
    "🚗Model Y的电池寿命长,充电效率高,可以在短时间内将电池充满,同时支持快速充电和慢充两种方式。无论是长途旅行还是城市代步,它都能满足你的需求。⚡\n",
    "\n",
    "🚗Model Y的外观设计独特,线条流畅,充满未来感,内部空间宽敞,乘坐舒适。无论是驾驶还是乘坐,都能感受到它的豪华与舒适。🌟\n",
    "\n",
    "💰虽然价格相对较高,但性价比高,是一款非常值得购买的汽车。它不仅是一款车,更是一种生活方式的体现。🚗\n",
    "\n",
    "#未来科技 #特斯拉 #安全性 #舒适性 #实用性 #电动汽车\n",
    "```"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Step 4: 标签抽取\n",
    "基于Step 3生成的文案进行标签抽取,这里我们使用内置的**标签抽取**组件。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from appbuilder import TagExtraction\n",
    "\n",
    "# 初始化标签抽取组件\n",
    "tag_extraction = TagExtraction(model='DeepSeek-V3.1')\n",
    "\n",
    "# 获取标签\n",
    "response = tag_extraction(Message(copywriting), stream=False, temperature=1e-10)\n",
    "tags = response.content\n",
    "print(f'标签:\\n{tags}')"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "输出结果:\n",
    "\n",
    "```\n",
    "标签:\n",
    "1.特斯拉\n",
    "2.Model Y\n",
    "3.未来科技\n",
    "4.纯电力驱动\n",
    "5.自动驾驶\n",
    "6.电池寿命\n",
    "7.充电效率\n",
    "8.外观设计\n",
    "9.内部空间\n",
    "10.性价比\n",
    "```"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "bf58028eab835c8b5fcb0ca40b311fc21e6cba5ccf47f1b42d31ca2545cde380"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}


================================================
FILE: cookbooks/components/translate.ipynb
================================================
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "name": "#%% md\n"
    }
   },
   "source": [
    "# 文本翻译-通用版组件\n",
    "\n",
    "## 目标\n",
    "使用文本翻译组件将文本翻译成目标语言。\n",
    "\n",
    "## 准备工作\n",
    "### 平台注册\n",
    "1.先在appbuilder平台注册,获取token\n",
    "\n",
    "2.安装appbuilder-sdk"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "!pip install appbuilder-sdk"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 基本用法\n",
    "\n",
    "### 快速开始\n",
    "\n",
    "通过如下示例代码可以快速开始使用文本翻译组件:"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "import os\n",
    "import appbuilder\n",
    "\n",
    "# 请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = '...'\n",
    "\n",
    "translate = appbuilder.Translation()\n",
    "resp = translate(appbuilder.Message(\"你好\\n中国\"), from_lang=\"zh\", to_lang=\"en\")\n",
    "# 输出{'from_lang': 'zh', 'to_lang': 'en', 'trans_result': [{'src': '你好', 'dst': 'hello'}, {'src': '中国', 'dst': 'China'}]}\n",
    "print(resp.content)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "## 参数说明\n",
    "\n",
    "### 鉴权配置\n",
    "\n",
    "使用组件之前,请首先申请并设置鉴权参数,可参考[组件使用流程](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)。\n",
    "\n",
    "```python\n",
    "# 设置环境中的TOKEN,以下示例略\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = \"bce-YOURTOKEN\"\n",
    "```\n",
    "\n",
    "### 初始化参数说明\n",
    "\n",
    "无\n",
    "\n",
    "### 调用参数说明\n",
    "\n",
    "|参数名称 |参数类型 |是否必须 |描述 | 示例值    |\n",
    "|--------|--------|--------|----|--------|\n",
    "|message |obj:Message  |是 |输入的请求翻译文本| Message(\"你好\") |\n",
    "|from_lang|String|否 |翻译的源语言,默认为`auto`,表示自动检测语言。| zh    |\n",
    "|to_lang|Integer|否 |需要翻译的目标语言,默认为`en`,表示英语。| en  |\n",
    "|timeout| Float   | 否    | HTTP超时时间,单位:秒               |1|\n",
    "|retry|Integer|否 |HTTP重试次数| 3      |\n",
    "\n",
    "### 响应参数\n",
    "\n",
    "|参数名称 |参数类型 |描述 |示例值|\n",
    "|--------|--------|----|------|\n",
    "|from_lang  |String  |翻译源语言| zh|\n",
    "|to_lang  |String  |翻译目标语言|en|\n",
    "|trans_result  |List[Object]  |返回结果|[{'src': '你好', 'dst': 'hello'}]|\n",
    "|trans_result[0].src  |String  |源文本|你好|\n",
    "|trans_result[0].dst  |String  |目标文本|hello|\n",
    "\n",
    "### 响应示例\n",
    "\n",
    "```json\n",
    "{\n",
    "  \"from_lang\": \"zh\",\n",
    "  \"to_lang\": \"en\",\n",
    "  \"trans_result\": [\n",
    "    {\n",
    "      \"src\": \"你好\",\n",
    "      \"dst\": \"hello\"\n",
    "    }\n",
    "  ]\n",
    "}\n",
    "```\n",
    "## 语种列表\n",
    "\n",
    "|名称 |代码 |语种检测|\n",
    "|----|-----|------|\n",
    "| 阿拉伯语           | ara  | 是   |\n",
    "| 爱尔兰语           | gle  | 是   |\n",
    "| 奥克语             | oci  | 是   |\n",
    "| 阿尔巴尼亚语        | alb  | 是   |\n",
    "| 阿尔及利亚阿拉伯语   | arq  | 否   |\n",
    "| 阿肯语             | aka  | 否   |\n",
    "| 阿拉贡语           | arg  | 否   |\n",
    "| 阿姆哈拉语          | amh  | 是   |\n",
    "| 阿萨姆语           | asm  | 是   |\n",
    "| 艾马拉语           | aym  | 否   |\n",
    "| 阿塞拜疆语          | aze  | 是   |\n",
    "| 阿斯图里亚斯语       | ast  | 是   |\n",
    "| 奥塞梯语            | oss  | 否   |\n",
    "| 爱沙尼亚语          | est  | 是   |\n",
    "| 奥杰布瓦语          | oji  | 否   |\n",
    "| 奥里亚语            | ori  | 是   |\n",
    "| 奥罗莫语            | orm  | 否   |\n",
    "| 波兰语              | pl   | 是   |\n",
    "| 波斯语              | per  | 是   |\n",
    "| 布列塔尼语          | bre  | 是   |\n",
    "| 巴什基尔语          | bak  | 否   |\n",
    "| 巴斯克语            | baq  | 是   |\n",
    "| 巴西葡萄牙语        | pot  | 否   |\n",
    "| 白俄罗斯语          | bel  | 是   |\n",
    "| 柏柏尔语            | ber  | 是   |\n",
    "| 邦板牙语            | pam  | 否   |\n",
    "| 保加利亚语          | bul  | 是   |\n",
    "| 北方萨米语          | sme  | 否   |\n",
    "| 北索托语           | ped  | 否   |\n",
    "| 本巴语             | bem  | 否   |\n",
    "| 比林语             | bli  | 否   |\n",
    "| 比斯拉马语          | bis  | 否   |\n",
    "| 俾路支语            | bal  | 否   |\n",
    "| 冰岛语              | ice  | 是   |\n",
    "| 波斯尼亚语          | bos  | 是   |\n",
    "| 博杰普尔语          | bho  | 否   |\n",
    "| 楚瓦什语            | chv  | 否   |\n",
    "| 聪加语             | tso  | 否   |\n",
    "| 丹麦语             | dan  | 是   |\n",
    "| 德语               | de   | 是   |\n",
    "| 鞑靼语              | tat  | 是   |\n",
    "| 掸语               | sha  | 否   |\n",
    "| 德顿语              | tet  | 否   |\n",
    "| 迪维希语            | div  | 否   |\n",
    "| 低地德语            | log  | 是   |\n",
    "| 俄语               | ru   | 是   |\n",
    "| 法语               | fra  | 是   |\n",
    "| 菲律宾语            | fil  | 是   |\n",
    "| 芬兰语              | fin  | 是   |\n",
    "| 梵语               | san  | 否   |\n",
    "| 弗留利语            | fri  | 否   |\n",
    "| 富拉尼语            | ful  | 否   |\n",
    "| 法罗语              | fao  |   否   |\n",
    "| 盖尔语              | gla  | 否   |\n",
    "| 刚果语              | kon  | 否   |\n",
    "| 高地索布语          | ups  | 否   |\n",
    "| 高棉语             | hkm  | 是   |\n",
    "| 格陵兰语           | kal  | 否   |\n",
    "| 格鲁吉亚语         | geo  | 是   |\n",
    "| 古吉拉特语         | guj  | 是   |\n",
    "| 古希腊语           | gra  | 否   |\n",
    "| 古英语             | eno  | 否   |\n",
    "| 瓜拉尼语           | grn  | 否   |\n",
    "| 韩语               | kor  | 是   |\n",
    "| 荷兰语             | nl   | 是   |\n",
    "| 胡帕语             | hup  | 否   |\n",
    "| 哈卡钦语           | hak  | 否   |\n",
    "| 海地语             | ht   | 否   |\n",
    "| 豪萨语             | hau  | 否   |\n",
    "| 黑山语             | mot  | 否   |\n",
    "| 吉尔吉斯语          | kir  | 否   |\n",
    "| 加利西亚语          | glg  | 是   |\n",
    "| 加拿大法语          | frn  | 否   |\n",
    "| 加泰罗尼亚语        | cat  | 是   |\n",
    "| 捷克语             | cs   | 是   |\n",
    "| 卡拜尔语           | kab  | 是   |\n",
    "| 卡纳达语           | kan  | 是   |\n",
    "| 卡努里语           | kau  | 否   |\n",
    "| 卡舒比语           | kah  | 否   |\n",
    "| 康瓦尔语           | cor  | 否   |\n",
    "| 科萨语             | xho  | 是   |\n",
    "| 科西嘉语           | cos  | 否   |\n",
    "| 克里克语           | cre  | 否   |\n",
    "| 克里米亚鞑靼语      | cri  | 否   |\n",
    "| 克林贡语           | kli  | 否   |\n",
    "| 克罗地亚语         | hrv  | 是   |\n",
    "| 克丘亚语           | que  | 否   |\n",
    "| 克什米尔语         | kas  | 否   |\n",
    "| 孔卡尼语           | kok  | 否   |\n",
    "| 库尔德语           | kur  | 是   |\n",
    "| 拉丁语             | lat  | 是   |\n",
    "| 老挝语             | lao  | 否   |\n",
    "| 罗马尼亚语          | rom  | 是   |\n",
    "| 拉特加莱语          | lag  | 否   |\n",
    "| 拉脱维亚语          | lav  | 是   |\n",
    "| 林堡语             | lim  | 否   |\n",
    "| 林加拉语           | lin  | 否   |\n",
    "| 卢干达语           | lug  | 否   |\n",
    "| 卢森堡语           | ltz  | 否   |\n",
    "| 卢森尼亚语         | ruy  | 否   |\n",
    "| 卢旺达语           | kin  | 是   |\n",
    "| 立陶宛语           | lit  | 是   |\n",
    "| 罗曼什语           | roh  | 否   |\n",
    "| 罗姆语             | ro   | 否   |\n",
    "| 逻辑语             | loj  | 否   |\n",
    "| 马来语             | may  | 是   |\n",
    "| 缅甸语             | bur  | 是   |\n",
    "| 马拉地语           | mar  | 否   |\n",
    "| 马拉加斯语          | mg   | 是   |\n",
    "| 马拉雅拉姆语         | mal  | 是   |\n",
    "| 马其顿语            | mac  | 是   |\n",
    "| 马绍尔语            | mah  | 否   |\n",
    "| 迈蒂利语            | mai  | 是   |\n",
    "| 曼克斯语            | glv  | 否   |\n",
    "| 毛里求斯克里奥尔语    | mau  | 否   |\n",
    "| 毛利语              | mao  | 否   |\n",
    "| 孟加拉语            | ben  | 是   |\n",
    "| 马耳他语            | mlt  | 是   |\n",
    "| 苗语               | hmn  | 否   |\n",
    "| 挪威语              | nor  | 是   |\n",
    "| 那不勒斯语           | nea  | 否   |\n",
    "| 南恩德贝莱语         | nbl  | 否   |\n",
    "| 南非荷兰语           | afr  | 是   |\n",
    "| 南索托语             | sot  | 否   |\n",
    "| 尼泊尔语             | nep  | 是   |\n",
    "| 葡萄牙语             | pt   | 是   |\n",
    "| 旁遮普语             | pan  | 是   |\n",
    "| 帕皮阿门托语          | pap  | 否   |\n",
    "| 普什图语             | pus  | 否   |\n",
    "| 齐切瓦语             | nya  | 否   |\n",
    "| 契维语               | twi  | 否   |\n",
    "| 切罗基语             | chr  | 否   |\n",
    "| 日语                 | jp   | 是   |\n",
    "| 瑞典语               | swe  | 是   |\n",
    "| 萨丁尼亚语            | srd  | 否   |\n",
    "| 萨摩亚语              | sm   | 否   |\n",
    "| 塞尔维亚-克罗地亚语     | sec  | 否   |\n",
    "| 塞尔维亚语             | srp  | 是   |\n",
    "| 桑海语                | sol  | 否   |\n",
    "| 僧伽罗语              | sin  | 是   |\n",
    "| 世界语                | epo  | 是   |\n",
    "| 书面挪威语             | nob  | 是   |\n",
    "| 斯洛伐克语             | sk   | 是   |\n",
    "| 斯洛文尼亚语           | slo  | 是   |\n",
    "| 斯瓦希里语             | swa  | 是   |\n",
    "| 索马里语               | som  | 是   |\n",
    "| 塞尔维亚语(西里尔)     | src  | 否   |\n",
    "| 泰语                  | th   | 是   |\n",
    "| 土耳其语               | tr   | 是   |\n",
    "| 塔吉克语               | tgk  | 是   |\n",
    "| 泰米尔语               | tam  | 是   |\n",
    "| 他加禄语               | tgl  | 是   |\n",
    "| 提格利尼亚语            | tir  | 否   |\n",
    "| 泰卢固语               | tel  | 是   |\n",
    "| 突尼斯阿拉伯语          | tua  | 否   |\n",
    "| 土库曼语               | tuk  | 否   |\n",
    "| 乌克兰语               | ukr  | 是   |\n",
    "| 瓦隆语                 | wln  | 是   |\n",
    "| 威尔士语               | wel  | 是   |\n",
    "| 文达语                 | ven  | 否   |\n",
    "| 沃洛夫语               | wol  | 否   |\n",
    "| 乌尔都语               | urd  | 是   |\n",
    "| 西班牙语               | spa  | 是   |\n",
    "| 希伯来语               | heb  | 是   |\n",
    "| 希腊语                 | el   | 是   |\n",
    "| 匈牙利语               | hu   | 是   |\n",
    "| 西弗里斯语              | fry  | 是   |\n",
    "| 西里西亚语              | sil  | 否   |\n",
    "| 希利盖农语              | hil  | 否   |\n",
    "| 下索布语                | los  | 否   |\n",
    "| 夏威夷语                | haw  | 否   |\n",
    "| 新挪威语                | nno  | 是   |\n",
    "| 西非书面语              | nqo  | 否   |\n",
    "| 信德语                 | snd  | 否   |\n",
    "| 修纳语                 | sna  | 否   |\n",
    "| 宿务语                 | ceb  | 否   |\n",
    "| 叙利亚语               | syr  | 否   |\n",
    "| 巽他语                 | sun  | 否   |\n",
    "| 英语                   | en   | 是   |\n",
    "| 印地语                 | hi   | 是   |\n",
    "| 印尼语                 | id   | 是   |\n",
    "| 意大利语               | it   | 是   |\n",
    "| 越南语                 | vie  | 是   |\n",
    "| 意第绪语               | yid  | 否   |\n",
    "| 因特语                 | ina  | 否   |\n",
    "| 亚齐语                 | ach  | 否   |\n",
    "| 印古什语               | ing  | 否   |\n",
    "| 伊博语                 | ibo  | 否   |\n",
    "| 伊多语                 | ido  | 否   |\n",
    "| 约鲁巴语               | yor  | 否   |\n",
    "| 亚美尼亚语             | arm  | 是   |\n",
    "| 伊努克提图特语          | iku  | 否   |\n",
    "| 中文(简体)             | zh   | 是   |\n",
    "| 中文(繁体)             | cht  | 是   |\n",
    "| 中文(文言文)           | wyw  | 是   |\n",
    "| 中文(粤语)             | yue  | 是   |\n",
    "| 扎扎其语               | zaz  | 否   |\n",
    "| 中古法语               | frm  | 否   |\n",
    "| 祖鲁语                 | zul  | 否   |\n",
    "| 爪哇语                 | jav  | 否   |\n",
    "\n",
    "\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}


================================================
FILE: cookbooks/components/vdb_retriever.ipynb
================================================
{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# VectorDB\n",
    "\n",
    "## 概述\n",
    "\n",
    "VectorDB产品基于百度自研的“莫愁”向量数据库内核构建,充分利用了百度内部在分布式存储&数据库领域的成熟经验,实现了高可靠、高可用、强扩展和大规模的能力。详细介绍可以参考文档 [VectorDB](https://cloud.baidu.com/doc/VDB/s/Llrsoaz3l)\n",
    "\n",
    "## 应用场景\n",
    "\n",
    "### 场景一:信息相似度检索\n",
    "\n",
    "在当今的信息时代,快速而准确地检索文本和图片数据成为了一个重要挑战。我们的向量数据库针对这一挑战,提供了一个高效、安全且智能的解决方案。\n",
    "\n",
    "### 场景二:大模型问答记忆\n",
    "\n",
    "在利用大型语言模型进行问答交互时,保持模型与用户之间的会话连贯性是提高回答质量和相关性的关键。我们的解决方案通过实时存储和检索会话数据,有效地降低了幻觉情况的发生,提升了问答的准确性和用户体验。\n",
    "\n",
    "\n",
    "### 场景三:大模型私域知识库\n",
    "\n",
    "在私有云环境中,构建专属的私域知识库是提升业务决策效率和精确性的关键。我们的向量数据库解决方案充分利用大模型的推理能力,针对私域数据提供定制化、高效的知识管理和检索服务。"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 开发上手\n",
    "\n",
    "### 第一步:环境准备,安装依赖"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "!pip install appbuilder-sdk"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 第二步:平台注册,设置Token\n",
    "\n",
    "- 2.1、注册AppBuilder平台账户,并申请Token,可参考文档:[AppBuilder官网创建密钥](https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# AppBuilder平台注册后获取密钥\n",
    "import os\n",
    "import appbuilder\n",
    "\n",
    "# 请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = '...'"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- 2.2、同时您需要申请并开通VectorDB,并创建实例,具体操作请参考[VectorDB文档](https://cloud.baidu.com/doc/VDB/s/hlrsoazuf)\n",
    "\n",
    "\n",
    "### 第三步:创建并运行VectorDB,初始化构建索引\n",
    "\n",
    "补充说明:\n",
    "- `you_vdb_instance_id` 为VectorDB 实例ID,请替换为您的实例ID,在VectorDB控制台界面上可以查看\n",
    "- `your_api_key` 为您在VectorDB上申请的账户密钥,请替换为您自己的root账户密钥,在VectorDB控制台界面上可以查看"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "segments = appbuilder.Message([\"文心一言大模型\", \"百度在线科技有限公司\"])\n",
    "# 初始化构建索引\n",
    "vector_index = appbuilder.BaiduVDBVectorStoreIndex.from_params(\n",
    "    instance_id=\"your_instance_id\",\n",
    "    api_key=\"your_api_key\",\n",
    "    drop_exists=True,\n",
    ")\n",
    "vector_index.add_segments(segments)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 第四步:构建完毕索引后,可以通过retriever进行检索"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "query = appbuilder.Message(\"文心一言\")\n",
    "retriever = vector_index.as_retriever()\n",
    "res = retriever(query)\n",
    "print(res)\n",
    "\n",
    "# Message(name=msg, content=[{'text': '文心一言大模型', 'meta': '', 'score': 1.0}], mtype=list)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "以上,便完成了VDB作为检索工具参与Appbuilder运行的流程使用,更多的VDB使用方式,请参考[VDB官方文档](https://cloud.baidu.com/doc/VDB/index.html) 与 [AppBuilder-retriever-baidu_vdb 文档](../appbuilder/core/components/retriever/baidu_vdb/README.md)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}


================================================
FILE: cookbooks/end2end_application/agent/appbuilder_client.ipynb
================================================
{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "42eace26869295fb",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# Console AppBuilderClient使用示例\n",
    "\n",
    "整体使用流程包括以下两个环节:\n",
    "\n",
    "1. 在[百度智能云千帆AppBuilder官网](https://cloud.baidu.com/product/AppBuilder)创建并发布应用、获取应用ID、获取密钥\n",
    "2. 引用AppBuilderSDK代码,初始化AppBuilderClient实例、创建会话、上传文档(可选)、执行对话\n",
    "\n",
    "以下分别提供三个样例,快递查询小助手、植物识别小助手、篮球教练来说明使用流程,并提供了一个异步调用示例加速调用流程。注意以下流程用到的密钥可在图示位置中获取:\n",
    "<img src=\"./app_builder_resources/secret.png\" alt=\"drawing\" width=\"1000\"/>\n",
    "\n",
    "\n",
    "## 1. 快递查询小助手\n",
    "\n",
    "[<span style=\"font-size:1.3em;\"> 快递查询小助手</span>](https://appbuilder.baidu.com/s/KVSXK)一键体验\n",
    "\n",
    "### 1.1 Console端应用配置与发布\n",
    "1 进入[百度智能云千帆AppBuilder官网](https://cloud.baidu.com/product/AppBuilder),配置智能体指令、选择相应的工具组件、发布应用\n",
    "\n",
    "<img src=\"./app_builder_resources/express_assistant.png\" alt=\"drawing\" width=\"1200\"/>\n",
    "\n",
    "2 获取应用ID\n",
    "<img src=\"./app_builder_resources/app_id.png\" alt=\"drawing\" width=\"1200\"/>\n",
    "\n",
    "### 1.2 SDK代码调用示例"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a6a9e2ba6159a8e4",
   "metadata": {
    "collapsed": false,
    "is_executing": true
   },
   "outputs": [],
   "source": [
    "import appbuilder\n",
    "import os\n",
    "# 注意以下示例正确运行依赖的条件包括:\n",
    "# 1. 在百度智能云千帆AppBuilder官网使用AppBuilderClient创建应用且应用已发布\n",
    "# 2. 密钥正确有效\n",
    "# 3. 密钥需要与发布应用正确对应,即需要使用发布应用的账户下的密钥\n",
    "\n",
    "# 配置密钥与应用ID\n",
    "os.environ[\"APPBUILDER_TOKEN\"] =\"secret_key\"\n",
    "app_id = \"35f4fed3-d530-4dad-bc8e-f2150a4450be\"\n",
    "\n",
    "# 初始化Agent\n",
    "builder = appbuilder.AppBuilderClient(app_id)\n",
    "\n",
    "# 创建会话ID\n",
    "conversation_id = builder.create_conversation()\n",
    "\n",
    "# 执行对话\n",
    "msg = builder.run(conversation_id, \"我的快递单号是:9858485940100; 请查询下此快递的状态\")\n",
    "print(\"快递查询助理回答内容:\", msg.content.answer)\n",
    "\n",
    "# 执行流式对话\n",
    "msg = builder.run(conversation_id, \"使用语音播报快递当前状态\", stream=True)\n",
    "for content in msg.content:\n",
    "    for ev in content.events:\n",
    "        if ev.content_type == \"audio\":\n",
    "            print(\"快递查询助理生成的音频播放地址:\", ev.detail[\"audio\"])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3e462991dab3283d",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "## 2. 植物识别小助手\n",
    "[<span style=\"font-size:1.3em;\">植物识别小助手</span>](https://appbuilder.baidu.com/s/50zyD)一键体验\n",
    "\n",
    "### 2.1 Console端应用配置与发布\n",
    "1 进入[百度智能云千帆AppBuilder官网](https://cloud.baidu.com/product/AppBuilder),配置智能体指令、选择相应的工具组件、发布应用\n",
    "<img src=\"./app_builder_resources/plant_recog_assistant.png\" alt=\"drawing\" width=\"1200\"/>\n",
    "\n",
    "2 获取应用ID, 同1.1\n",
    "\n",
    "### 2.2 SDK代码调用示例"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4d051395a2aa1d11",
   "metadata": {
    "collapsed": false,
    "is_executing": true
   },
   "outputs": [],
   "source": [
    "import os\n",
    "import appbuilder\n",
    "\n",
    "# 注意以下示例正确运行依赖的条件包括:\n",
    "# 1. 在百度智能云千帆AppBuilder官网使用AppBuilderClient创建应用且应用已发布\n",
    "# 2. 密钥正确有效\n",
    "# 3. 密钥需要与发布的应用正确对应,即需要使用发布应用的账户下的密钥\n",
    "\n",
    "# 配置密钥与应用ID\n",
    "os.environ[\"APPBUILDER_TOKEN\"] =\"...\"\n",
    "app_id = \"7016e0d3-451b-4a47-a818-dc0a16d4b496\" \n",
    "\n",
    "# 初始化Agent实例\n",
    "builder = appbuilder.AppBuilderClient(app_id)\n",
    "\n",
    "# 创建会话ID\n",
    "conversation_id = builder.create_conversation()\n",
    "\n",
    "# 上传植物图片\n",
    "file_id = builder.upload_local_file(conversation_id, \"./app_builder_resources/tree.png\" )\n",
    "\n",
    "# 植物识别\n",
    "msg = builder.run(conversation_id, \"请识别图中的植物类别\", file_ids=[file_id])\n",
    "print(\"植物识别助理回答内容:\", msg.content.answer)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c112f09d6ce35d10",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "## 3. 篮球教练\n",
    "[<span style=\"font-size:1.3em;\">篮球教练知识增强检索</span>](https://appbuilder.baidu.com/s/RCVEn)一键体验\n",
    "\n",
    "### 3.1 Console端应用配置与发布\n",
    "1 进入[百度智能云千帆AppBuilder官网](https://cloud.baidu.com/product/AppBuilder),配置智能体指令、上传文档并关联知识库、发布应用\n",
    "<img src=\"./app_builder_resources/agent_builder_rag.png\" alt=\"drawing\" width=\"1200\"/>\n",
    "\n",
    "2 获取应用ID, 同1.1\n",
    "\n",
    "### 3.2 SDK代码调用示例"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "65e488aa883cf94e",
   "metadata": {
    "collapsed": false,
    "is_executing": true
   },
   "outputs": [],
   "source": [
    "import os\n",
    "import appbuilder\n",
    "\n",
    "# 注意以下示例正确运行依赖的条件包括:\n",
    "# 1. 在百度智能云千帆AppBuilder官网使用AppBuilderClient创建应用且应用已发布\n",
    "# 2. 密钥正确有效\n",
    "# 3. 密钥需要与发布的应用正确对应,即需要使用发布应用的账户下的密钥\n",
    "\n",
    "# 配置密钥与应用ID\n",
    "os.environ[\"APPBUILDER_TOKEN\"] =\"...\"\n",
    "app_id = \"4316a7cb-b6b2-4448-b6fa-ff131c484ec9\" \n",
    "\n",
    "# 初始化Agent实例\n",
    "builder = appbuilder.AppBuilderClient(app_id)\n",
    "\n",
    "# 创建会话ID\n",
    "conversation_id = builder.create_conversation()\n",
    "\n",
    "# 执行对话\n",
    "msg = builder.run(conversation_id, \"突破技巧中如何运用胯下变向?\", )\n",
    "print(\"篮球教练回答内容:\", msg.content.answer)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7acaf6bb",
   "metadata": {},
   "source": [
    "## 4. 使用异步调用加速AppBuilderClient并发执行\n",
    "SDK提供异步调用工作流Agent的接口。下面以3章节的“篮球教练”为例,演示如何使用异步调用加速AppBuilderClient并发执行。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fa87ffcb",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import appbuilder\n",
    "import asyncio\n",
    "\n",
    "# 注意以下示例正确运行依赖的条件包括:\n",
    "# 1. 在百度智能云千帆AppBuilder官网使用AppBuilderClient创建应用且应用已发布\n",
    "# 2. 密钥正确有效\n",
    "# 3. 密钥需要与发布的应用正确对应,即需要使用发布应用的账户下的密钥\n",
    "\n",
    "# 配置密钥与应用ID\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = \"...\"\n",
    "app_id = \"4316a7cb-b6b2-4448-b6fa-ff131c484ec9\"\n",
    "\n",
    "async def agent_run(client, conversation_id, text):\n",
    "    ans = await client.run(conversation_id, text, stream=True)\n",
    "    async for data in ans.content:\n",
    "        print(data)\n",
    "\n",
    "\n",
    "async def agent_sample():\n",
    "    client = appbuilder.AsyncAppBuilderClient(app_id)\n",
    "    conversation_id = await client.create_conversation()\n",
    "    file_id = await client.upload_local_file(\n",
    "        conversation_id, \"./python/tests/data/qa_appbuilder_client_demo.pdf\"\n",
    "    )\n",
    "    print(\"file_id is {}\".format(file_id))\n",
    "    task1 = asyncio.create_task(\n",
    "        agent_run(client, conversation_id, \"篮球技巧中如何三步上篮?\")\n",
    "    )\n",
    "    task2 = asyncio.create_task(\n",
    "        agent_run(client, conversation_id, \"突破技巧中如何运用胯下变向?\")\n",
    "    )\n",
    "    await asyncio.gather(task1, task2)\n",
    "    await client.http_client.session.close()\n",
    "\n",
    "if __name__ == \"__main__\":\n",
    "    loop = asyncio.get_event_loop()\n",
    "    loop.run_until_complete(agent_sample())"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}


================================================
FILE: cookbooks/end2end_application/agent/chatflow.ipynb
================================================
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 前言 - 学习本项目你可以获得什么\n",
    "- 入门百度智能云千帆AppBuilder,搭建一个工作流Agent应用\n",
    "- 使用AppBuilder-SDK进行工作流Agent对话\n",
    "- 了解如何使用AppBuilder-SDK简化多轮对话的开发"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. 项目背景\n",
    "\n",
    "### 1.1、 什么是AppBuilder\n",
    "[百度智能云千帆AppBuilder](https://appbuilder.cloud.baidu.com/)(以下简称AppBuilder)是基于大模型搭建AI原生应用的工作台,旨在降低AI原生应用的开发门槛,赋能开发者和企业快速实现应用搭建。\n",
    "\n",
    "平台提供了RAG(检索增强生成)、Agent(智能体)等应用框架,内置了文档问答、表格问答、多轮对话、生成创作等多种应用组件,还包括百度搜索和百度地图等特色组件,以及文本处理、图像处理和语音处理等传统AI组件,支持零代码、低代码、全代码三种开发方式,满足不同开发能力的开发者和企业的场景需求。\n",
    "\n",
    "### 1.2、 什么是AppBuilder-SDK\n",
    "\n",
    "[百度智能云千帆AppBuilder-SDK](https://github.com/baidubce/app-builder)(以下简称AB-SDK),百度智能云千帆AppBuilder-SDK是百度智能云千帆AppBuilder面向AI原生应用开发者提供的一站式开发平台的客户端SDK。\n",
    "\n",
    "<img src=\"https://chengmo-dev1.bj.bcebos.com/page2.png\" alt=\"drawing\" width=\"1000\"/>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2. 创建工作流Agent应用并对话\n",
    "\n",
    "## 2.1 什么是工作流Agent?\n",
    "通过工作流编排的形式还原业务流程,每轮对话均严格按照工作流执行,提高了AI应用的可控性,并可编排出复杂业务流程,适用于客服、营销、生成、办公等高可控及高复杂度等场景。\n",
    "\n",
    "**工作流Agent无需设置角色人设,通过工作流编排的形式实现应用功能。**\n",
    "\n",
    "用户的所有对话均会触发此工作流处理,适用于严格按照流程执行的任务,例如:\n",
    "\n",
    "* 客服对话智能体,判断终端用户的意图后严格按照任务分支自动执行,无需大模型思考选择。\n",
    "* MBTI小助手,根据开发者编排的问题逐个提问,严格按照任务分支和结果执行后续的流程。\n",
    "\n",
    "工作流Agent支持用户配置工作流完成整个应用的对话过程,通过开始节点的Rawquery传入首轮对话,利用信息收集节点可以进行一组工作流中的多轮对话,最后以结束节点作为整个工作流结束的标志。开始节点和结束节点之前的完整流程构成一组工作流,每个信息收集节点都可以支持终端用户和应用的一次交互。\n",
    "\n",
    "## 2.2 创建工作流Agent应用-飞行客服小助手\n",
    "\n",
    "参考产品文档[飞行客服小助手](https://cloud.baidu.com/doc/AppBuilder/s/cm38k8nqr)创建示例应用。通过阅读本篇最佳实践,读者可以深度理解问答节点、信息处理节点、全局跳转节点的功能点和使用方式,搭建自己的工作流agent。对话效果如下:\n",
    "\n",
    "<p float=\"left\">\n",
    "  <img src=\"https://bce.bdstatic.com/doc/ai-cloud-share/AppBuilder/image_f11055c.png\" width=\"33%\" />\n",
    "  <img src=\"https://bce.bdstatic.com/doc/ai-cloud-share/AppBuilder/image_a680834.png\" width=\"33%\" /> \n",
    "  <img src=\"https://bce.bdstatic.com/doc/ai-cloud-share/AppBuilder/image_b602fef.png\" width=\"33%\" />\n",
    "</p>\n",
    "\n",
    "## 2.3 使用AppBuilder-SDK进行对话\n",
    "### 2.3.1 方式一:使用SDK直接对话(不推荐)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import appbuilder\n",
    "import os\n",
    "from appbuilder.core.console.appbuilder_client import data_class\n",
    "\n",
    "# 请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5\n",
    "# 设置环境变量\n",
    "os.environ[\"APPBUILDER_TOKEN\"] = \"...\"\n",
    "appbuilder.logger.setLoglevel(\"ERROR\")\n",
    "\n",
    "# 飞行客服小助手的应用id\n",
    "app_id = \"...\"\n",
    "# 初始化智能体\n",
    "client = appbuilder.AppBuilderClient(app_id)\n",
    "# 创建会话\n",
    "conversation_id = client.create_conversation()\n",
    "interrupt_ids = []\n",
    "\n",
    "msg = client.run(conversation_id, \"查天气\", stream=True)\n",
    "interrupt_event_id = None\n",
    "for ans in msg.content:\n",
    "    for event in ans.events:\n",
    "        if event.content_type == \"publish_message\":\n",
    "            print(event.detail.get(\"message\"))\n",
    "        if event.content_type == \"chatflow_interrupt\":\n",
    "            interrupt_event_id = event.detail.get(\"interrupt_event_id\")\n",
    "            break\n",
    "interrupt_ids.append(interrupt_event_id)\n",
    "\n",
    "msg2 = client.run(\n",
    "    conversation_id,\n",
    "    \"查航班\",\n",
    "    stream=True,\n",
    "    action=data_class.Action.create_resume_action(interrupt_event_id),\n",
    ")\n",
    "interrupt_event_id = None\n",
    "for ans in msg2.content:\n",
    "    for event in ans.events:\n",
    "        if event.content_type == \"publish_message\":\n",
    "            print(event.detail.get(\"message\"))\n",
    "        if event.content_type == \"chatflow_interrupt\":\n",
    "            interrupt_event_id = event.detail.get(\"interrupt_event_id\")\n",
    "            break\n",
    "        interrupt_ids.append(interrupt_event_id)\n",
    "\n",
    "msg3 = client.run(\n",
    "    conversation_id=conversation_id,\n",
    "    query=\"CA1234\",\n",
    "    stream=True,\n",
    "    action=data_class.Action.create_resume_action(interrupt_ids.pop()),\n",
    ")\n",
    "interrupt_event_id = None\n",
    "for ans in msg3.content:\n",
    "    for event in ans.events:\n",
    "        if event.content_type == \"text\":\n",
    "            print(event.detail.get(\"text\"))\n",
    "        if event.content_type == \"chatflow_interrupt\":\n",
    "            interrupt_event_id = event.detail.get(\"interrupt_event_id\")\n",
    "            break\n",
    "interrupt_ids.append(interrupt_event_id)\n",
    "\n",
    "msg4 = client.run(\n",
    "    conversation_id=conversation_id,\n",
    "    query=\"北京的\",\n",
    "    stream=True,\n",
    "    action=data_class.Action.create_resume_action(interrupt_ids.pop()),\n",
    ")\n",
    "has_multiple_dialog_event = False\n",
    "for ans in msg4.content:\n",
    "    for event in ans.events:\n",
    "        if event.content_type == \"text\":\n",
    "            print(event.detail.get(\"text\"))\n",
    "        if event.content_type == \"multiple_dialog_event\":\n",
    "            has_multiple_dialog_event = True\n",
    "            break"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.3.2 方式二 实现自己的EventHandler,更方便地进行对话(推荐)\n",
    "直接调用处理较为繁琐。SDK提供了使用AppBuilderEventHandler简化tool_call操作的功能。**继承AppBuilderEventHandler类,并实现针对各类型event的处理方法。**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import appbuilder\n",
    "from appbuilder.core.console.appbuilder_client.event_handler import (\n",
    "    AppBuilderEventHandler,\n",
    ")\n",
    "\n",
    "\n",
    "class MyEventHandler(AppBuilderEventHandler):\n",
    "    def __init__(self):\n",
    "        super().__init__()\n",
    "        self.interrupt_ids = []\n",
    "\n",
    "    def handle_content_type(self, run_context, run_response):\n",
    "        interrupt_event_id = None\n",
    "        event = run_response.events[-1]\n",
    "        if event.content_type == \"chatflow_interrupt\":\n",
    "            interrupt_event_id = event.detail.get(\"interrupt_event_id\")\n",
    "        if interrupt_event_id is not None:\n",
    "            self.interrupt_ids.append(interrupt_event_id)\n",
    "\n",
    "    def _create_action(self):\n",
    "        if len(self.interrupt_ids) == 0:\n",
    "            return None\n",
    "        event_id = self.interrupt_ids.pop()\n",
    "        return {\n",
    "            \"action_type\": \"resume\",\n",
    "            \"parameters\": {\"interrupt_event\": {\"id\": event_id, \"type\": \"chat\"}},\n",
    "        }\n",
    "\n",
    "    def run(self, query=None):\n",
    "        super().new_dialog(\n",
    "            query=query,\n",
    "            action=self._create_action(),\n",
    "        )\n",
    "\n",
    "\n",
    "def main():\n",
    "    # 请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5\n",
    "    # 设置环境变量\n",
    "    os.environ[\"APPBUILDER_TOKEN\"] = \"...\"\n",
    "    appbuilder.logger.setLoglevel(\"DEBUG\")\n",
    "\n",
    "    # 飞行客服小助手的应用id\n",
    "    app_id = \"...\"\n",
    "    # 初始化智能体\n",
    "    client = appbuilder.AppBuilderClient(app_id)\n",
    "    conversation_id = client.create_conversation()\n",
    "\n",
    "    event_handler = MyEventHandler()\n",
    "    event_handler.init(\n",
    "        appbuilder_client=client,\n",
    "        conversation_id=conversation_id,\n",
    "        stream=True,\n",
    "        query=\"查天气\",\n",
    "    )\n",
    "    for data in event_handler:\n",
    "        pass\n",
    "    event_handler.run(\n",
    "        query=\"查航班\",\n",
    "    )\n",
    "    for data in event_handler:\n",
    "        pass\n",
    "    event_handler.run(\n",
    "        query=\"CA1234\",\n",
    "    )\n",
    "    for data in event_handler:\n",
    "        pass\n",
    "    event_handler.run(\n",
    "        query=\"北京的\",\n",
    "    )\n",
    "    for data in event_handler:\n",
    "        pass\n",
    "\n",
    "\n",
    "if __name__ == \"__main__\":\n",
    "    main()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.3.3 方式三、实现自己的EventHandler,更方便地进行多轮对话(推荐)\n",
    "SDK提供了run_multiple_dialog_with_handler方法来进行多轮对话,按需传入iterable对象(queries、actions等参数),即可一次调用完成多轮对话。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import appbuilder\n",
    "from appbuilder.core.console.appbuilder_client.event_handler import (\n",
    "    AppBuilderEventHandler,\n",
    ")\n",
    "\n",
    "\n",
    "class MyEventHandler(AppBuilderEventHandler):\n",
    "    def __init__(self):\n",
    "        super().__init__()\n",
    "        self.interrupt_ids = []\n",
    "\n",
    "    def handle_content_type(self, run_context, run_response):\n",
    "        interrupt_event_id = None\n",
    "        event = run_response.events[-1]\n",
    "        if event.content_type == \"chatflow_interrupt\":\n",
    "            interrupt_event_id = event.detail.get(\"interrupt_event_id\")\n",
    "        if interrupt_event_id is not None:\n",
    "            self.interrupt_ids.append(interrupt_event_id)\n",
    "\n",
    "    def _create_action(self):\n",
    "        if len(self.interrupt_ids) == 0:\n",
    "            return None\n",
    "        event_id = self.interrupt_ids.pop()\n",
    "        return {\n",
    "            \"action_type\": \"resume\",\n",
    "            \"parameters\": {\"interrupt_event\": {\"id\": event_id, \"type\": \"chat\"}},\n",
    "        }\n",
    "\n",
    "    def gen_action(self):\n",
    "        while True:\n",
    "            yield self._create_action()\n",
    "\n",
    "\n",
    "def main():\n",
    "    # 请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5\n",
    "    # 设置环境变量\n",
    "    os.environ[\"APPBUILDER_TOKEN\"] = \"...\"\n",
    "    appbuilder.logger.setLoglevel(\"DEBUG\")\n",
    "\n",
    "    # 飞行客服小助手的应用id\n",
    "    app_id = \"...\"\n",
    "    # 初始化智能体\n",
    "    client = appbuilder.AppBuilderClient(app_id)\n",
    "    conversation_id = client.create_conversation()\n",
    "\n",
    "    queries = [\"查天气\", \"查航班\", \"CA1234\", \"北京的\"]\n",
    "    event_handler = MyEventHandler()\n",
    "    event_handler = client.run_multiple_dialog_with_handler(\n",
    "        conversation_id=conversation_id,\n",
    "        queries=queries,\n",
    "        event_handler=event_handler,\n",
    "        stream=True,\n",
    "        actions=event_handler.gen_action(),\n",
    "    )\n",
    "    for data in event_handler:\n",
    "        for ans in data:\n",
    "            pass\n",
    "\n",
    "\n",
    "if __name__ == \"__main__\":\n",
    "    main()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 2.3.4 异步调用工作流Agent\n",
    "SDK提供异步调用工作流Agent的接口,下面是一个异步调用工作流Agent的实例。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n",
    "#\n",
    "# Licensed under the Apache License, Version 2.0 (the \"License\");\n",
    "# you may not use this file except in compliance with the License.\n",
    "# You may obtain a copy of the License at\n",
    "#\n",
    "#     http://www.apache.org/licenses/LICENSE-2.0\n",
    "#\n",
    "# Unless required by applicable law or agreed to in writing, software\n",
    "# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
    "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
    "# See the License for the specific language governing permissions and\n",
    "# limitations under the License.\n",
    "import os\n",
    "import asyncio\n",
    "import appbuilder\n",
    "from appbuilder.core.console.appbuilder_client.async_event_handler import (\n",
    "    AsyncAppBuilderEventHandler,\n",
    ")\n",
    "\n",
    "class MyEventHandler(AsyncAppBuilderEventHandler):\n",
    "    def __init__(self):\n",
    "        super().__init__()\n",
    "        self.interrupt_ids = []\n",
    "\n",
    "    async def handle_content_type(self, run_context, run_response):\n",
    "        interrupt_event_id = None\n",
    "        event = run_response.events[-1]\n",
    "        if event.content_type == \"chatflow_interrupt\":\n",
    "            interrupt_event_id = event.detail.get(\"interrupt_event_id\")\n",
    "        if interrupt_event_id is not None:\n",
    "            self.interrupt_ids.append(interrupt_event_id)\n",
    "\n",
    "    def _create_action(self):\n",
    "        if len(self.interrupt_ids) == 0:\n",
    "            return None\n",
    "        event_id = self.interrupt_ids.pop()\n",
    "        return {\n",
    "            \"action_type\": \"resume\",\n",
    "            \"parameters\": {\"interrupt_event\": {\"id\": event_id, \"type\": \"chat\"}},\n",
    "        }\n",
    "\n",
    "    async def run(self, query=None):\n",
    "        await super().new_dialog(\n",
    "            query=query,\n",
    "            action=self._create_action(),\n",
    "        )\n",
    "\n",
    "    def gen_action(self):\n",
    "        while True:\n",
    "            yield self._create_action()\n",
    "\n",
    "\n",
    "async def agent_run():\n",
    "    # 请前往千帆AppBuilder官网创建密钥,流程详见:https://cloud.baidu.com/doc/AppBuilder/s/Olq6grrt6#1%E3%80%81%E5%88%9B%E5%BB%BA%E5%AF%86%E9%92%A5\n",
    "    # 设置环境变量\n",
    "    os.environ[\"APPBUILDER_TOKEN\"] = \"...\"\n",
    "    appbuilder.logger.setLoglevel(\"DEBUG\")\n",
    "\n",
    "    # 飞行客服小助手的应用id\n",
    "    app_id = \"...\"\n",
    "    client = appbuilder.AsyncAppBuilderClient(app_id)\n",
    "    conversation_id = await client.create_conversation()\n",
    "    event_handler = MyEventHandler()\n",
    "    queries = [\"查天气\", \"查航班\", \"CA1234\", \"北京的\"]\n",
    "    event_handler = client.run_multiple_dialog_with_handler(\n",
    "        conversation_id=conversation_id,\n",
    "        queries=queries,\n",
    "        event_handler=event_handler,\n",
    "        stream=False,\n",
    "        actions=event_handler.gen_action(),\n",
    "    )\n",
    "    async for data in event_handler:\n",
    "        async for answer in data:\n",
    "            print(answer)\n",
    "\n",
    "    await client.http_client.session.close()\n",
    "\n",
    "if __name__ == \"__main__\":\n",
    "    loop = asyncio.get_event_loop()\n",
    "    loop.run_until_complete(agent_run())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3、项目总结\n",
    "\n",
    "本项目最终完成了一个工作流Agent应用的创建,并使用Appbuilder-SDK进行对话功能。\n",
    "\n",
    "希望您可以不吝`Star`,给`AppBuilder-SDK`一些鼓励,期待您的`PR`,一起共建AIAgent生态。\n",
    "\n",
    "Github地址:https://github.com/baidubce/app-builder\n",
    "\n",
    "<img src=\"https://chengmo-dev1.bj.bcebos.com/page10.png\" alt=\"drawing\" width=\"1000\"/>\n",
    "\n",
    "最后,您也可以进入`AppBuilder-SDK`的WX交流群,和大家一起交流AppBuilder使用及开发心得。\n",
    "\n",
    "<img src=\"https://chengmo-dev1.bj.bcebos.com/wechat_group.png\" alt=\"drawing\" width=\"1000\"/>"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "testenv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.20"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}


================================================
FILE: cookbooks/end2end_application/agent/tool_call.ipynb
================================================
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<img src=\"https://chengmo-dev1.bj.bcebos.com/page1.png\" alt=\"drawing\" width=\"1000\"/>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 前言 - 学习本项目你可以获得什么\n",
    "- 理论学习:了解AIAgent的基础知识\n",
    "- 上手实操:深入了解Agent中的FunctionCall运行流程\n",
    "- 上手实操:入门百度智能云千帆AppBuilder,在十分钟内打造一个个性化AIAgent\n",
    "- 上手实操:使用AppBuilder-SDK打造一个端云组件联动的进阶Agent"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. 项目背景\n",
    "\n",
    "### 1.1、 什么是AppBuilder\n",
    "[百度智能云千帆AppBuilder](https://appbuilder.cloud.baidu.com/)(以下简称AppBuilder)是基于大模型搭建AI原生应用的工作台,旨在降低AI原生应用的开发门槛,赋能开发者和企业快速实现应用搭建。\n",
    "\n",
    "平台提供了RAG(检索增强生成)、Agent(智能体)等应用框架,内置了文档问答、表格问答、多轮对话、生成创作等多种应用组件,还包括百度搜索和百度地图等特色组件,以及文本处理、图像处理和语音处理等传统AI组件,支持零代码、低代码、全代码三种开发方式,满足不同开发能力的开发者和企业的场景需求。\n",
    "\n",
    "### 1.2、 什么是AppBuilder-SDK\n",
    "\n",
    "[百度智能云千帆AppBuilder-SDK](https://github.com/baidubce/app-builder)(以下简称AB-SDK),百度智能云千帆AppBuilder-SDK是百度智能云千帆AppBuilder面向AI原生应用开发者提供的一站式开发平台的客户端SDK。\n",
    "\n",
    "<img src=\"https://chengmo-dev1.bj.bcebos.com/page2.png\" alt=\"drawing\" width=\"1000\"/>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2. 项目介绍 - 通过ToolCall实现端云组件联动的Agent\n",
    "### 2.1、 什么是Agent\n",
    "\n",
    "AIAgent是能够感知环境,基于目标进行决策并执行动作的智能化应用。不同于传统人工智能应用(主要指以规则引擎、机器学习、深度学习等技术为核心)和RPA机器人,AIAgent能够基于目标和对现状能力的认知,在环境约束中,依赖特定资源和现有工具,找到行动规则并将行动拆解为必要的步骤,自主执行步骤,达成目标。\n",
    "\n",
    "AIAgent具备三个核心能力:独立思考、自主执行、持续迭代。\n",
    "- 独立思考是指AlAgent能够根据给定任务目标和约束条件,进行任务规划和问题拆解,形成执行步骤(即工作流);\n",
    "- 自主执行是指AlAgent能够调取各类组件和工具,按照执行步骤依次执行,实现任务目标;\n",
    "- 持续选代是指AlAgent能够自动记录任务目标、工作流和执行结果,基于结果反馈,沉淀专家知识和案例。\n",
    "\n",
    "AICopilot、AIAgent、大模型等名词在各类文章上经常混淆,此处简要说明下三者的区别。大模型一般是指大模型技术,AlAgent和Al Copilot是基于大模型技术的智能化应用,AlAgent和AlCopilot在功能和场景上存在差别。\n",
    "\n",
    "自主性是AIAgent和AI Copilot之间最大的区别。AI Copilot是“副驾驶”,只是提供建议而非决策,AIAgent是“主驾驶”,需要真正做出决策并开展行动。\n",
    "\n",
    "<img src=\"https://chengmo-dev1.bj.bcebos.com/page3.png\" alt=\"drawing\" width=\"1000\"/>\n",
    "\n",
    "### 2.2、 什么是ToolCall\n",
    "\n",
    "解释该问题,需要了解以下的知识点:`Agent工具` -> `FunctionCall` - `ToolCall`\n",
    "\n",
    "AIAgent 有四大核心组件:记忆、规划、工具和执行。其中工具部分,与我们的开发关系最密切,在各类Agent开发平台/工具中,常被称为“组件”、\"插件\"、\"能力\"等.\n",
    "\n",
    "关于Agent的工具的定义与分类,如下图~\n",
    "\n",
    "<img src=\"https://chengmo-dev1.bj.bcebos.com/page4.png\" alt=\"drawing\" width=\"1000\"/>\n",
    "\n",
    "Agent使用工具的流程,一般称为`FunctionCall`,最早由OpenAI提出,并在[Assistant API](https://platform.openai.com/docs/assistants/overview)中广泛应用。\n",
    "\n",
    "\n",
    "ToolCall,则是AppBuilder平台提出的一种进阶的FunctionCall,本质与OpenAI的FunctionCall一致,但具有以下两个特点:\n",
    "\n",
    "- **端云组件联动**: Agent 调用工具时,可以同时调用云端和本地组件。\n",
    "\n",
    "- **组件类型泛化**: AppBuilder在未来会支持多种类型组件,已经超出了Function的含义,例如数据库、记忆库、工作流等等\n",
    "\n",
    "\n",
    "\n",
    "### 2.3、 什么是端云组件联动,要解决什么问题\n",
    "\n",
    "我们首先从工具的执行位置出发展开~ 在使用如AppBuilder / Coze 等平台开发Agent时,我们可以使用很多平台组件广场中,官方提供的组件,这里组件开箱即用,非常方便。\n",
    "\n",
    "<img src=\"https://chengmo-dev1.bj.bcebos.com/page5.png\" alt=\"drawing\" width=\"1000\"/>\n",
    "\n",
    "但是存在一个问题,基于平台云端组件开发的应用,无法调用内网/局域网/私域的知识与能力,也无法与本地的工具进行联动,限制了Agent的灵活性。\n",
    "\n",
    "我们在解决实际业务问题时,常遇到需要访问内网链接API或本地/硬件功能的FunctionCall需求,AppBuilder ToolCall可以解决这个问题:\n",
    "\n",
    "* 1、用户可注册一个本地运行的组件到已发布的应用\n",
    "* 2、由AppBuilder-Agent的云端思考模型进行规划和参数生成\n",
    "* 3、用户基于生成的参数调用本地组件,并再上传运行结果\n",
    "* 4、以此实现将本地组件能力嵌入到应用整体流程\n",
    "\n",
    "\n",
    "<img src=\"https://chengmo-dev1.bj.bcebos.com/page6.png\" alt=\"drawing\" width=\"1000\"/>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3、ToolCall(FunctionCall)基础知识介绍\n",
    "\n",
    "### 3.1、Agent是如何调用Tool的\n",
    "\n",
    "我们可以将Agent的黑箱拆解为以下几个部分:\n",
    "1. Agent的背景信息\n",
    "2. Agent的输入信息\n",
    "3. Agent的思考过程\n",
    "4. Agent触发组件调用\n",
    "5. Agent基于组件输出反思总结\n",
    "\n",
    "#### Agent的背景信息包含以下几个部分\n",
    "- 角色定义描述(Prompt):定义Agent的角色\n",
    "- 能力描述(Prompt):定义Agent可以干什么\n",
    "- 工具描述(JsonSchema/Str):将工具的输入和输出,按照规范,定义为一段字符串,作为最终大模型Prompt的一部分\n",
    "\n",
    "#### Agent的输入信息包含以下几个部分\n",
    "- 用户输入(Query/Prompt):用户输入的文本\n",
    "- 对话相关的文件(File/Url):与本地对话相关的文件路径\n",
    "\n",
    "#### Agent的思考过程\n",
    "AppBuilder-Agent会将背景信息与输入信息,拼接为最终的Prompt,然后调用大模型推理。\n",
    "\n",
    "Prompt的一个简单且直观的例子是:\n",
    "\n",
    "你是`{角色定义描述}`,你可以做以下事情:`{能力描述}`,你可以使用这些工具:`{工具描述-description}`,工具依赖的输入是:`{工具描述-paramters-properties-name}`,这些输入的格式分别是`{工具描述-paramters-properties-type}`。现在用户的问题是`{用户输入}`,与该问题相关的文件是`{对话相关的文件}`,请你解决用户的这个问题。\n",
    "\n",
    "#### Agent触发组件调用\n",
    "\n",
    "如果用户的query和组件能够解决的问题匹配,那么大模型就会尝试根据prompt里给出的工具的描述,从query中提炼出该次调用工具所需的参数,生成一个ToolCall命令,交给执行组件的模块去执行。\n",
    "\n",
    "例如,我们给出的组件能力是\"查找公司内指定人员的信息\",函数的参数名为\"name\"。当用户输入\"查找张三的信息\",大模型会从query中提炼出参数\"name=张三\"这个信息。\n",
    "\n",
    "<img src=\"https://chengmo-dev1.bj.bcebos.com/page7.png\" alt=\"drawing\" width=\"1000\"/>\n",
    "\n",
    "#### Agent基于组件输出反思总结\n",
    "\n",
    "组件运行模块执行组件后,会给出字符串形式的结果给到Agent,Agent会再次将结果拼接为Prompt,然后调用大模型推理。判断用户的需求是否已经解决。如果解决了,则经过一个对话模块,总结用户的需求,并生成一个对话记录。如果未解决,则继续调用大模型推理,尝试调用更多的工具,直到用户的需求被解决。\n",
    "\n",
    "### 3.2、开发者如何命令Agent调用本地Tool\n",
    "\n",
    "我们以AppBuilder-SDK中的AppBuilder-Client的基础代码为例,介绍开发者应该如何使用ToolCall功能\n",
    "\n",
    "\n",
    "```python\n",
    "import appbuilder\n",
    "\n",
    "# 实例化AppBuilderClient\n",
    "app_client = appbuilder.AppBuilderClient(app_id)\n",
    "conversation_id = app_client.create_conversation()\n",
    "\n",
    "# 第一次对话,输入原始的query 和 工具描述\n",
    "message_1 = app_client.run(\n",
    "    conversation_id=conversation_id,\n",
    "    query=\"请问张三同学的生日是哪天?\",\n",
    "    tools=tools\n",
    ")\n",
    "tool_call = message_1.content.events[-1].tool_calls[-1]\n",
    "tool_call_id = tool_call.id\n",
    "\n",
    "# 第二次对话,在本地执行组件后,上传组件的运行结果\n",
    "tool_c
Download .txt
gitextract_900dxzul/

├── .env_template
├── .github/
│   └── workflows/
│       └── python-package.yml
├── CONTRIBUTING.md
├── LICENSE
├── NEW_README.md
├── README.md
├── cookbooks/
│   ├── README.md
│   ├── advanced_application/
│   │   ├── agent_speech.ipynb
│   │   └── cloud_deploy.ipynb
│   ├── agent_builder.ipynb
│   ├── appbuilder_trace/
│   │   └── trace.ipynb
│   ├── components/
│   │   ├── agent_runtime.ipynb
│   │   ├── asr.ipynb
│   │   ├── gbi.ipynb
│   │   ├── general_ocr.ipynb
│   │   ├── object_recognize.ipynb
│   │   ├── rag_with_baidusearch.ipynb
│   │   ├── text_generation.ipynb
│   │   ├── translate.ipynb
│   │   └── vdb_retriever.ipynb
│   ├── end2end_application/
│   │   ├── agent/
│   │   │   ├── appbuilder_client.ipynb
│   │   │   ├── chatflow.ipynb
│   │   │   ├── tool_call.ipynb
│   │   │   └── tool_choice.ipynb
│   │   └── rag/
│   │       ├── console_dataset.ipynb
│   │       ├── console_rag.ipynb
│   │       ├── qa_system_1_dataset.ipynb
│   │       ├── qa_system_2_dialogue.ipynb
│   │       └── rag.ipynb
│   ├── live_broadcast_material/
│   │   ├── 2024_05_16/
│   │   │   ├── agent_run.py
│   │   │   ├── chatbot.py
│   │   │   ├── service_deploy.py
│   │   │   └── two_agent.py
│   │   ├── 2024_08_22/
│   │   │   ├── README.md
│   │   │   ├── knowledgebase.ipynb
│   │   │   ├── tool_call_1.ipynb
│   │   │   ├── tool_call_2.ipynb
│   │   │   ├── tool_call_3.ipynb
│   │   │   ├── tool_call_4.ipynb
│   │   │   └── trace.ipynb
│   │   └── 2024_12_18/
│   │       └── rag_knowledgebase_01.ipynb
│   ├── mcp/
│   │   ├── app_mcp_server.ipynb
│   │   ├── baidu_map.ipynb
│   │   ├── client.ipynb
│   │   ├── knowledge_base_mcp_server.ipynb
│   │   └── server.ipynb
│   └── pipeline/
│       ├── assistant.ipynb
│       ├── assistant_function_call.ipynb
│       ├── file.ipynb
│       ├── message.ipynb
│       ├── run.ipynb
│       └── thread.ipynb
├── docs/
│   ├── Application/
│   │   ├── Agent/
│   │   │   ├── BasicKnowledge/
│   │   │   │   └── agent.md
│   │   │   ├── ToolCall/
│   │   │   │   └── tool_call.md
│   │   │   ├── ToolChoice/
│   │   │   │   └── tool_choice.md
│   │   │   └── UseOfficialComponents/
│   │   │       └── use_official_components.md
│   │   └── RAG/
│   │       ├── BasicKnowledge/
│   │       │   └── rag.md
│   │       └── DatasetManage/
│   │           └── dataset_manage.md
│   ├── BasisModule/
│   │   ├── Components/
│   │   │   ├── Components.md
│   │   │   ├── animal_recognize/
│   │   │   │   └── README.md
│   │   │   ├── asr/
│   │   │   │   └── README.md
│   │   │   ├── dish_recognize/
│   │   │   │   └── README.md
│   │   │   ├── doc_crop_enhance/
│   │   │   │   └── README.md
│   │   │   ├── doc_format_converter/
│   │   │   │   └── README.md
│   │   │   ├── doc_parser/
│   │   │   │   └── README.md
│   │   │   ├── doc_splitter/
│   │   │   │   └── README.md
│   │   │   ├── document_understanding/
│   │   │   │   └── README.md
│   │   │   ├── embeddings/
│   │   │   │   └── README.md
│   │   │   ├── extract_table/
│   │   │   │   └── README.md
│   │   │   ├── gbi/
│   │   │   │   ├── nl2sql/
│   │   │   │   │   └── README.md
│   │   │   │   └── select_table/
│   │   │   │       └── README.md
│   │   │   ├── general_ocr/
│   │   │   │   └── README.md
│   │   │   ├── handwrite_ocr/
│   │   │   │   └── README.md
│   │   │   ├── image_understand/
│   │   │   │   └── README.md
│   │   │   ├── landmark_recognize/
│   │   │   │   └── README.md
│   │   │   ├── llms/
│   │   │   │   ├── dialog_summary/
│   │   │   │   │   └── README.md
│   │   │   │   ├── hallucination_detection/
│   │   │   │   │   └── README.md
│   │   │   │   ├── is_complex_query/
│   │   │   │   │   └── README.md
│   │   │   │   ├── mrc/
│   │   │   │   │   └── README.md
│   │   │   │   ├── nl2pandas/
│   │   │   │   │   └── README.md
│   │   │   │   ├── oral_query_generation/
│   │   │   │   │   └── README.md
│   │   │   │   ├── playground/
│   │   │   │   │   └── README.md
│   │   │   │   ├── qa_pair_mining/
│   │   │   │   │   └── README.md
│   │   │   │   ├── query_decomposition/
│   │   │   │   │   └── README.md
│   │   │   │   ├── query_rewrite/
│   │   │   │   │   └── README.md
│   │   │   │   ├── similar_question/
│   │   │   │   │   └── README.md
│   │   │   │   ├── style_rewrite/
│   │   │   │   │   └── README.md
│   │   │   │   ├── style_writing/
│   │   │   │   │   └── README.md
│   │   │   │   └── tag_extraction/
│   │   │   │       └── README.md
│   │   │   ├── matching/
│   │   │   │   └── README.md
│   │   │   ├── mix_card_ocr/
│   │   │   │   └── README.md
│   │   │   ├── object_recognize/
│   │   │   │   └── README.md
│   │   │   ├── plant_recognize/
│   │   │   │   └── README.md
│   │   │   ├── ppt_generation_from_file/
│   │   │   │   └── README.md
│   │   │   ├── ppt_generation_from_instruction/
│   │   │   │   └── README.md
│   │   │   ├── ppt_generation_from_paper/
│   │   │   │   └── README.md
│   │   │   ├── qrcode_ocr/
│   │   │   │   └── README.md
│   │   │   ├── rag_with_baidu_search/
│   │   │   │   └── README.md
│   │   │   ├── rag_with_baidu_search_pro/
│   │   │   │   └── README.md
│   │   │   ├── retriever/
│   │   │   │   ├── README.md
│   │   │   │   ├── baidu_vdb/
│   │   │   │   │   └── README.md
│   │   │   │   ├── bes/
│   │   │   │   │   └── README.md
│   │   │   │   └── reranker/
│   │   │   │       └── README.md
│   │   │   ├── table_ocr/
│   │   │   │   └── README.md
│   │   │   ├── text_to_image/
│   │   │   │   └── README.md
│   │   │   ├── translate/
│   │   │   │   └── README.md
│   │   │   ├── tree_mind/
│   │   │   │   └── README.md
│   │   │   └── tts/
│   │   │       └── README.md
│   │   ├── Deployment/
│   │   │   ├── AgentChainlit.md
│   │   │   ├── agentruntime.md
│   │   │   ├── cloud.md
│   │   │   ├── flask.md
│   │   │   └── usersession.md
│   │   ├── Model/
│   │   │   └── get_model_list.md
│   │   ├── Platform/
│   │   │   ├── Application/
│   │   │   │   ├── appbuilder_client.md
│   │   │   │   └── get_app_list.md
│   │   │   ├── CustomComponents/
│   │   │   │   ├── component_client.md
│   │   │   │   └── components.md
│   │   │   └── KnowledgeBase/
│   │   │       └── knowledgebase.md
│   │   └── Trace/
│   │       ├── Debug.md
│   │       ├── README.md
│   │       ├── basic.md
│   │       └── phoenix_method.md
│   ├── DevelopGuide/
│   │   ├── AdvancedDevelopment/
│   │   │   └── README.md
│   │   ├── ChangeLog/
│   │   │   └── changelog.md
│   │   ├── EnvironmentalParameters/
│   │   │   └── env.md
│   │   ├── ErrorMessage/
│   │   │   └── error_message.md
│   │   └── HowToContributeCode/
│   │       └── README.md
│   ├── QuickStart/
│   │   ├── CurrentlySupportedProgrammingLanguages/
│   │   │   └── README.md
│   │   ├── ExamplesOfIndustrialPracticeApplications/
│   │   │   └── README.md
│   │   └── StartFirstAINativeApplication/
│   │       ├── README.md
│   │       └── install.md
│   ├── README.md
│   ├── README_en.md
│   ├── README_ja.md
│   └── Tools/
│       ├── DocPass/
│       │   └── DocPass.md
│       ├── JavaAPI/
│       │   ├── JavaAPI.md
│       │   ├── READEME.md
│       │   └── java_api_update.sh
│       ├── MarkdownSh/
│       │   ├── markdown2rst.py
│       │   └── markdown_parse.py
│       └── SphinxSh/
│           ├── Makefile
│           ├── PythonAPI.md
│           ├── READEME.md
│           ├── appbuilder.core.rst
│           ├── get_components_md.py
│           ├── make.bat
│           ├── requirements.txt
│           ├── source/
│           │   ├── conf.py
│           │   └── index.rst
│           ├── update_doc.sh
│           ├── update_lib.py
│           └── update_rst.py
├── go/
│   ├── appbuilder/
│   │   ├── agent_builder.go
│   │   ├── agent_builder_data.go
│   │   ├── agent_builder_data_test.go
│   │   ├── agent_builder_test.go
│   │   ├── app_builder_client.go
│   │   ├── app_builder_client_data.go
│   │   ├── app_builder_client_test.go
│   │   ├── component_client.go
│   │   ├── component_client_data.go
│   │   ├── component_client_test.go
│   │   ├── config.go
│   │   ├── dataset.go
│   │   ├── dataset_data.go
│   │   ├── dataset_test.go
│   │   ├── go.mod
│   │   ├── go.sum
│   │   ├── knowledge_base.go
│   │   ├── knowledge_base_data.go
│   │   ├── knowledge_base_test.go
│   │   ├── rag.go
│   │   ├── rag_data.go
│   │   ├── rag_test.go
│   │   └── util.go
│   └── run_go_test.sh
├── java/
│   ├── parse_tests_and_coverage.py
│   ├── pom.xml
│   ├── print_coverage.sh
│   └── src/
│       ├── main/
│       │   └── java/
│       │       └── com/
│       │           └── baidubce/
│       │               └── appbuilder/
│       │                   ├── base/
│       │                   │   ├── component/
│       │                   │   │   └── Component.java
│       │                   │   ├── config/
│       │                   │   │   └── AppBuilderConfig.java
│       │                   │   ├── exception/
│       │                   │   │   └── AppBuilderServerException.java
│       │                   │   └── utils/
│       │                   │       ├── http/
│       │                   │       │   ├── HttpClient.java
│       │                   │       │   └── HttpResponse.java
│       │                   │       ├── iterator/
│       │                   │       │   └── StreamIterator.java
│       │                   │       └── json/
│       │                   │           └── JsonUtils.java
│       │                   ├── console/
│       │                   │   ├── agentbuilder/
│       │                   │   │   └── AgentBuilder.java
│       │                   │   ├── aisearch/
│       │                   │   │   └── AISearch.java
│       │                   │   ├── appbuilderclient/
│       │                   │   │   ├── App.java
│       │                   │   │   ├── AppBuilderClient.java
│       │                   │   │   └── AppList.java
│       │                   │   ├── componentclient/
│       │                   │   │   └── ComponentClient.java
│       │                   │   ├── dataset/
│       │                   │   │   └── Dataset.java
│       │                   │   ├── knowledgebase/
│       │                   │   │   └── Knowledgebase.java
│       │                   │   └── rag/
│       │                   │       └── RAG.java
│       │                   └── model/
│       │                       ├── agentbuilder/
│       │                       │   ├── AgentBuilderIterator.java
│       │                       │   ├── AgentBuilderResponse.java
│       │                       │   ├── AgentBuilderResult.java
│       │                       │   ├── ConversationResponse.java
│       │                       │   ├── Event.java
│       │                       │   ├── EventContent.java
│       │                       │   └── FileUploadResponse.java
│       │                       ├── aisearch/
│       │                       │   ├── AISearchIterator.java
│       │                       │   ├── AISearchRequest.java
│       │                       │   └── AISearchResponse.java
│       │                       ├── appbuilderclient/
│       │                       │   ├── App.java
│       │                       │   ├── AppBuilderClientFeedbackRequest.java
│       │                       │   ├── AppBuilderClientFeedbackResponse.java
│       │                       │   ├── AppBuilderClientIterator.java
│       │                       │   ├── AppBuilderClientResponse.java
│       │                       │   ├── AppBuilderClientResult.java
│       │                       │   ├── AppBuilderClientRunRequest.java
│       │                       │   ├── AppDescribeRequest.java
│       │                       │   ├── AppDescribeResponse.java
│       │                       │   ├── AppListRequest.java
│       │                       │   ├── AppListResponse.java
│       │                       │   ├── AppsDescribeRequest.java
│       │                       │   ├── AppsDescribeResponse.java
│       │                       │   ├── ConversationResponse.java
│       │                       │   ├── Event.java
│       │                       │   ├── EventContent.java
│       │                       │   ├── FileUploadResponse.java
│       │                       │   └── ToolCall.java
│       │                       ├── componentclient/
│       │                       │   ├── ComponentClientIterator.java
│       │                       │   ├── ComponentClientRunRequest.java
│       │                       │   └── ComponentClientRunResponse.java
│       │                       ├── dataset/
│       │                       │   ├── DatasetCreateResponse.java
│       │                       │   ├── DatasetCreateResult.java
│       │                       │   ├── DocumentAddResponse.java
│       │                       │   ├── DocumentAddResult.java
│       │                       │   ├── DocumentDeleteResponse.java
│       │                       │   ├── DocumentListData.java
│       │                       │   ├── DocumentListResponse.java
│       │                       │   ├── DocumentListResult.java
│       │                       │   ├── FileUploadResponse.java
│       │                       │   └── FileUploadResult.java
│       │                       ├── knowledgebase/
│       │                       │   ├── ChunkCreateRequest.java
│       │                       │   ├── ChunkCreateResponse.java
│       │                       │   ├── ChunkDeleteRequest.java
│       │                       │   ├── ChunkDescribeRequest.java
│       │                       │   ├── ChunkDescribeResponse.java
│       │                       │   ├── ChunkModifyRequest.java
│       │                       │   ├── ChunksDescribeRequest.java
│       │                       │   ├── ChunksDescribeResponse.java
│       │                       │   ├── Document.java
│       │                       │   ├── DocumentAddRequest.java
│       │                       │   ├── DocumentAddResponse.java
│       │                       │   ├── DocumentDeleteRequest.java
│       │                       │   ├── DocumentDeleteResponse.java
│       │                       │   ├── DocumentDescribeResponse.java
│       │                       │   ├── DocumentListRequest.java
│       │                       │   ├── DocumentListResponse.java
│       │                       │   ├── DocumentsCreateRequest.java
│       │                       │   ├── DocumentsCreateResponse.java
│       │                       │   ├── DocumentsDescribeRequest.java
│       │                       │   ├── DocumentsDescribeResponse.java
│       │                       │   ├── DocumentsUploadResponse.java
│       │                       │   ├── FileUploadResponse.java
│       │                       │   ├── KnowledgeBaseConfig.java
│       │                       │   ├── KnowledgeBaseDetail.java
│       │                       │   ├── KnowledgeBaseDetailRequest.java
│       │                       │   ├── KnowledgeBaseListRequest.java
│       │                       │   ├── KnowledgeBaseListResponse.java
│       │                       │   ├── KnowledgeBaseModifyRequest.java
│       │                       │   ├── QueryKnowledgeBaseRequest.java
│       │                       │   └── QueryKnowledgeBaseResponse.java
│       │                       └── rag/
│       │                           ├── EventContent.java
│       │                           ├── RAGIterator.java
│       │                           ├── RAGResponse.java
│       │                           └── RAGResult.java
│       └── test/
│           └── java/
│               └── com/
│                   └── baidubce/
│                       └── appbuilder/
│                           ├── AISearchTest.java
│                           ├── AgentBuilderTest.java
│                           ├── AppBuilderClientTest.java
│                           ├── ComponentClientTest.java
│                           ├── DatasetTest.java
│                           ├── KnowledgebaseTest.java
│                           ├── RAGTest.java
│                           ├── base/
│                           │   ├── exception/
│                           │   │   └── AppBuilderServerExceptionTest.java
│                           │   └── utils/
│                           │       └── json/
│                           │           └── JsonUtilsTest.java
│                           ├── files/
│                           │   ├── query_knowledgebase.json
│                           │   └── toolcall.json
│                           └── model/
│                               ├── agentbuilder/
│                               │   ├── AgentBuilderResponseTest.java
│                               │   ├── AgentBuilderResultTest.java
│                               │   ├── ConversationResponseTest.java
│                               │   ├── EventContentTest.java
│                               │   ├── EventTest.java
│                               │   └── FileUploadResponseTest.java
│                               ├── appbuilderclient/
│                               │   ├── AppBuilderClientResponseTest.java
│                               │   ├── AppBuilderClientRunRequestTest.java
│                               │   ├── AppListRequestTest.java
│                               │   ├── AppListResponseTest.java
│                               │   ├── AppTest.java
│                               │   ├── ConversationResponseTest.java
│                               │   ├── EventContentTest.java
│                               │   ├── EventTest.java
│                               │   ├── FileUploadResponseTest.java
│                               │   └── ToolCallTest.java
│                               ├── dataset/
│                               │   ├── DatasetCreateResultTest.java
│                               │   ├── DocumentAddResultTest.java
│                               │   ├── DocumentListDataTest.java
│                               │   ├── DocumentListResponseTest.java
│                               │   ├── DocumentListResultTest.java
│                               │   ├── FileUploadResponseTest.java
│                               │   ├── FileUploadResultTest.java
│                               │   └── ResponseTest.java
│                               ├── knowledgebase/
│                               │   ├── ChunkCreateRequestTest.java
│                               │   ├── ChunkCreateResponseTest.java
│                               │   ├── ChunkDeleteRequestTest.java
│                               │   ├── ChunkDescribeRequestTest.java
│                               │   ├── ChunkDescribeResponseTest.java
│                               │   ├── ChunkModifyRequestTest.java
│                               │   ├── ChunksDescribeRequestTest.java
│                               │   ├── ChunksDescribeResponseTest.java
│                               │   ├── DocumentAddRequestTest.java
│                               │   ├── DocumentDeleteRequestTest.java
│                               │   ├── DocumentDeleteResponseTest.java
│                               │   ├── DocumentListRequestTest.java
│                               │   ├── DocumentListResponseTest.java
│                               │   ├── DocumentTest.java
│                               │   ├── DocumentsCreateRequestTest.java
│                               │   ├── FileUploadResponseTest.java
│                               │   ├── KnowledgeBaseConfigTest.java
│                               │   ├── KnowledgeBaseDetailRequestTest.java
│                               │   ├── KnowledgeBaseDetailTest.java
│                               │   ├── KnowledgeBaseListRequestTest.java
│                               │   ├── KnowledgeBaseListResponseTest.java
│                               │   └── KnowledgeBaseModifyRequestTest.java
│                               └── rag/
│                                   ├── EventContentTest.java
│                                   ├── RAGResponseTest.java
│                                   └── RAGResultTest.java
├── mkdocs.yml
├── python/
│   ├── __init__.py
│   ├── core/
│   │   ├── __init__.py
│   │   ├── _client.py
│   │   ├── _exception.py
│   │   ├── _session.py
│   │   ├── agent.py
│   │   ├── assistant/
│   │   │   ├── __init__.py
│   │   │   ├── assistants/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── assistants.py
│   │   │   │   └── files.py
│   │   │   ├── base.py
│   │   │   ├── threads/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── messages/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── messages.py
│   │   │   │   ├── runs/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── runs.py
│   │   │   │   │   ├── steps.py
│   │   │   │   │   └── stream_helper.py
│   │   │   │   └── threads.py
│   │   │   └── type/
│   │   │       ├── __init__.py
│   │   │       ├── assistant_type.py
│   │   │       ├── public_type.py
│   │   │       └── thread_type.py
│   │   ├── component.py
│   │   ├── components/
│   │   │   ├── __init__.py
│   │   │   ├── animal_recognize/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── asr/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── dish_recognize/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── doc_crop_enhance/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── doc_format_converter/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── doc_parser/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   └── component.py
│   │   │   ├── doc_splitter/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   └── component.py
│   │   │   ├── document_understanding/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   └── component.py
│   │   │   ├── embeddings/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   └── component.py
│   │   │   ├── extract_table/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   └── component.py
│   │   │   ├── gbi/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── basic.py
│   │   │   │   ├── nl2sql/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   └── select_table/
│   │   │   │       ├── README.md
│   │   │   │       ├── __init__.py
│   │   │   │       ├── base.py
│   │   │   │       └── component.py
│   │   │   ├── general_ocr/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── handwrite_ocr/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── image_understand/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── landmark_recognize/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── llms/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   ├── dialog_summary/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── hallucination_detection/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── is_complex_query/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── mrc/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── nl2pandas/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── oral_query_generation/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── playground/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── qa_pair_mining/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── query_decomposition/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── query_rewrite/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── similar_question/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── style_rewrite/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   ├── style_writing/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── base.py
│   │   │   │   │   └── component.py
│   │   │   │   └── tag_extraction/
│   │   │   │       ├── README.md
│   │   │   │       ├── __init__.py
│   │   │   │       ├── base.py
│   │   │   │       └── component.py
│   │   │   ├── matching/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   └── component.py
│   │   │   ├── mix_card_ocr/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── object_recognize/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── plant_recognize/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── ppt_generation_from_file/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   └── component.py
│   │   │   ├── ppt_generation_from_instruction/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   └── component.py
│   │   │   ├── ppt_generation_from_paper/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── base.py
│   │   │   │   └── component.py
│   │   │   ├── qrcode_ocr/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── rag_with_baidu_search/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── rag_with_baidu_search_pro/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── retriever/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── baidu_vdb/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── component.py
│   │   │   │   │   └── model.py
│   │   │   │   ├── bes/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── component.py
│   │   │   │   └── reranker/
│   │   │   │       ├── README.md
│   │   │   │       ├── __init__.py
│   │   │   │       ├── component.py
│   │   │   │       └── model.py
│   │   │   ├── table_ocr/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── text_to_image/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── translate/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── tree_mind/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   ├── tts/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component.py
│   │   │   │   └── model.py
│   │   │   └── v2/
│   │   │       ├── __init__.py
│   │   │       ├── animal_recognize/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── asr/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── general_ocr/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── handwrite_ocr/
│   │   │       │   ├── __init__.py
│   │   │       │   ├── component.py
│   │   │       │   └── model.py
│   │   │       ├── image_understand/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── llms/
│   │   │       │   ├── __init__.py
│   │   │       │   ├── dialog_summary/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── hallucination_detection/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── is_complex_query/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── mrc/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── nl2pandas/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── oral_query_generation/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── qa_pair_mining/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── query_decomposition/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── query_rewrite/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── similar_question/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── style_rewrite/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   ├── style_writing/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   └── component.py
│   │   │       │   └── tag_extraction/
│   │   │       │       ├── __init__.py
│   │   │       │       └── component.py
│   │   │       ├── mix_card_ocr/
│   │   │       │   ├── __init__.py
│   │   │       │   ├── component.py
│   │   │       │   └── model.py
│   │   │       ├── object_recognize/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── plant_recognize/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── qrcode_ocr/
│   │   │       │   ├── __init__.py
│   │   │       │   ├── component.py
│   │   │       │   └── model.py
│   │   │       ├── table_ocr/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── text_to_image/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       ├── translate/
│   │   │       │   ├── __init__.py
│   │   │       │   └── component.py
│   │   │       └── tree_mind/
│   │   │           ├── __init__.py
│   │   │           ├── component.py
│   │   │           └── model.py
│   │   ├── console/
│   │   │   ├── __init__.py
│   │   │   ├── ai_search/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── ai_search.py
│   │   │   │   └── data_class.py
│   │   │   ├── appbuilder_client/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── appbuilder_client.py
│   │   │   │   ├── async_appbuilder_client.py
│   │   │   │   ├── async_event_handler.py
│   │   │   │   ├── data_class.py
│   │   │   │   └── event_handler.py
│   │   │   ├── base.py
│   │   │   ├── component_client/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── component_client.py
│   │   │   │   └── data_class.py
│   │   │   ├── dataset/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── dataset.py
│   │   │   │   └── model.py
│   │   │   ├── knowledge_base/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── data_class.py
│   │   │   │   └── knowledge_base.py
│   │   │   └── rag/
│   │   │       ├── __init__.py
│   │   │       └── rag.py
│   │   ├── constants.py
│   │   ├── context.py
│   │   ├── functional.py
│   │   ├── manifest/
│   │   │   ├── __init__.py
│   │   │   ├── manifest_decorator.py
│   │   │   ├── manifest_signature.py
│   │   │   └── models.py
│   │   ├── message.py
│   │   ├── session_message.py
│   │   ├── user_session.py
│   │   └── utils.py
│   ├── mcp_server/
│   │   ├── README.md
│   │   ├── __init__.py
│   │   ├── ai_search/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   └── ai_search_server.py
│   │   ├── app/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   └── app_server.py
│   │   ├── client.py
│   │   ├── http_client.py
│   │   ├── knowledge_base/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   └── knowledge_base_server.py
│   │   ├── openapi.py
│   │   ├── server.py
│   │   └── sse.py
│   ├── tests/
│   │   ├── __init__.py
│   │   ├── component_check.py
│   │   ├── component_collector.py
│   │   ├── component_schemas.py
│   │   ├── component_tool_eval_cases.py
│   │   ├── data/
│   │   │   ├── ghes-3.0.json
│   │   │   ├── ghes-3.0.yaml
│   │   │   ├── mcp_component_server_sample.py
│   │   │   ├── mcp_knowledge_base_case.txt
│   │   │   ├── mcp_official_server_sample.py
│   │   │   └── qa_demo.xlsx
│   │   ├── parallel_ut_run.py
│   │   ├── print_components_error_info.py
│   │   ├── pytest_config.py
│   │   ├── pytest_utils.py
│   │   ├── run_python_test.sh
│   │   ├── sed_str.py
│   │   ├── test_agent.py
│   │   ├── test_ai_search.py
│   │   ├── test_ai_search_stream.py
│   │   ├── test_all_components.py
│   │   ├── test_animal_recognize.py
│   │   ├── test_appbuilder_assistant_trace.py
│   │   ├── test_appbuilder_client.py
│   │   ├── test_appbuilder_client_app_detail.py
│   │   ├── test_appbuilder_client_app_list.py
│   │   ├── test_appbuilder_client_chatflow.py
│   │   ├── test_appbuilder_client_chatflow_event_handler.py
│   │   ├── test_appbuilder_client_chatflow_event_handler_v2.py
│   │   ├── test_appbuilder_client_custom_metadata.py
│   │   ├── test_appbuilder_client_feedback.py
│   │   ├── test_appbuilder_client_follow_up_query.py
│   │   ├── test_appbuilder_client_mcp.py
│   │   ├── test_appbuilder_client_mcp_component.py
│   │   ├── test_appbuilder_client_mcp_official.py
│   │   ├── test_appbuilder_client_parameters.py
│   │   ├── test_appbuilder_client_run_with_handler.py
│   │   ├── test_appbuilder_client_toolcall.py
│   │   ├── test_appbuilder_client_toolcall_event_handler.py
│   │   ├── test_appbuilder_client_toolcall_event_handler_error.py
│   │   ├── test_appbuilder_client_toolcall_event_handler_stream.py
│   │   ├── test_appbuilder_client_toolcall_event_handler_v2.py
│   │   ├── test_appbuilder_client_toolcall_event_handler_v3.py
│   │   ├── test_appbuilder_client_toolcall_stream.py
│   │   ├── test_appbuilder_client_toolcall_v2.py
│   │   ├── test_appbuilder_client_toolcall_v3.py
│   │   ├── test_appbuilder_client_trace.py
│   │   ├── test_appbuilder_components_trace.py
│   │   ├── test_appbuilder_core_components_retriever.py
│   │   ├── test_appbuilder_sentry_trace_off.py
│   │   ├── test_appbuilder_sentry_trace_on.py
│   │   ├── test_appbuilder_trace_raise_error.py
│   │   ├── test_asr.py
│   │   ├── test_assistant_basic_import.py
│   │   ├── test_assistant_class_assistans.py
│   │   ├── test_assistant_class_files.py
│   │   ├── test_assistant_class_messages.py
│   │   ├── test_assistant_class_runs.py
│   │   ├── test_assistant_class_runs_v2.py
│   │   ├── test_assistant_class_threads.py
│   │   ├── test_assistant_e2e_funccall.py
│   │   ├── test_assistant_e2e_funccall_component.py
│   │   ├── test_assistant_e2e_run.py
│   │   ├── test_assistant_e2e_stream_cancel.py
│   │   ├── test_assistant_e2e_stream_event_handler.py
│   │   ├── test_assistant_e2e_stream_event_handler_v2.py
│   │   ├── test_assistant_e2e_stream_funccall.py
│   │   ├── test_assistant_e2e_stream_run.py
│   │   ├── test_async_appbuilder_client.py
│   │   ├── test_async_appbuilder_client_chatflow.py
│   │   ├── test_async_appbuilder_client_custom_metadata.py
│   │   ├── test_async_appbuilder_client_follow_up_query.py
│   │   ├── test_async_appbuilder_client_parameters.py
│   │   ├── test_async_appbuilder_client_toolcall.py
│   │   ├── test_base_component.py
│   │   ├── test_bes_retriever.py
│   │   ├── test_component_client.py
│   │   ├── test_component_is_async.py
│   │   ├── test_console_dataset.py
│   │   ├── test_console_rag.py
│   │   ├── test_core_agent.py
│   │   ├── test_core_client.py
│   │   ├── test_core_components_baidu_vdb_retriever.py
│   │   ├── test_core_components_doc.py
│   │   ├── test_core_components_embedding.py
│   │   ├── test_core_components_table.py
│   │   ├── test_core_components_tts.py
│   │   ├── test_core_console_base.py
│   │   ├── test_core_session.py
│   │   ├── test_core_user_session.py
│   │   ├── test_core_utils.py
│   │   ├── test_dialog_summary.py
│   │   ├── test_dish_recognize.py
│   │   ├── test_doc_crop_enhance.py
│   │   ├── test_doc_format_converter.py
│   │   ├── test_doc_parser.py
│   │   ├── test_doc_splitter.py
│   │   ├── test_document_understanding.py
│   │   ├── test_embedding.py
│   │   ├── test_extract_table.py
│   │   ├── test_gbi_nl2sql.py
│   │   ├── test_gbi_select_table.py
│   │   ├── test_general_ocr.py
│   │   ├── test_get_app_list.py
│   │   ├── test_get_model_list.py
│   │   ├── test_hallucination_detection.py
│   │   ├── test_handwrite_ocr.py
│   │   ├── test_image_understand.py
│   │   ├── test_is_complex_query.py
│   │   ├── test_knowledge_base.py
│   │   ├── test_landmark_recognize.py
│   │   ├── test_langchain_adapter_run.py
│   │   ├── test_langchain_adapter_tool_eval.py
│   │   ├── test_langchain_error.py
│   │   ├── test_llm_base.py
│   │   ├── test_log_set_log_config.py
│   │   ├── test_manifest.py
│   │   ├── test_manifest_decorator.py
│   │   ├── test_manifest_signature.py
│   │   ├── test_matching.py
│   │   ├── test_mcp_ai_search_stdio.py
│   │   ├── test_mcp_app_server_stdio.py
│   │   ├── test_mcp_rag_stdio.py
│   │   ├── test_message.py
│   │   ├── test_mix_card_ocr.py
│   │   ├── test_mrc.py
│   │   ├── test_nl2pandas.py
│   │   ├── test_object_recognize.py
│   │   ├── test_openapi_convert.py
│   │   ├── test_oral_query_generation.py
│   │   ├── test_plant_recognize.py
│   │   ├── test_playground.py
│   │   ├── test_ppt_generation_from_file.py
│   │   ├── test_ppt_generation_from_instruction.py
│   │   ├── test_ppt_generation_from_paper.py
│   │   ├── test_private_llm_component.py
│   │   ├── test_qa_aicape_animal_rec.py
│   │   ├── test_qa_aicape_doc_crop_enhance.py
│   │   ├── test_qa_aicape_handwriting_ocr.py
│   │   ├── test_qa_aicape_image_understand.py
│   │   ├── test_qa_aicape_mixcard_ocr.py
│   │   ├── test_qa_aicape_plant_rec.py
│   │   ├── test_qa_aicape_qrcode_orc.py
│   │   ├── test_qa_aicape_table_ocr.py
│   │   ├── test_qa_doc_parser_extract_table_from_doc.py
│   │   ├── test_qa_llm_dialog_summary.py
│   │   ├── test_qa_llm_get_qianfan_model_list.py
│   │   ├── test_qa_llm_is_complex_query.py
│   │   ├── test_qa_llm_matching.py
│   │   ├── test_qa_llm_oral_query_generation.py
│   │   ├── test_qa_llm_paddle_speech_tts.py
│   │   ├── test_qa_llm_pandas.py
│   │   ├── test_qa_llm_query_decomposition.py
│   │   ├── test_qa_llm_style_rewrite.py
│   │   ├── test_qa_pair_mining.py
│   │   ├── test_qrcode_ocr.py
│   │   ├── test_query_decomposition.py
│   │   ├── test_query_rewrite.py
│   │   ├── test_rag_baidu_search.py
│   │   ├── test_rag_baidu_search_pro.py
│   │   ├── test_rerank.py
│   │   ├── test_similar_question.py
│   │   ├── test_style_rewrite.py
│   │   ├── test_style_writing.py
│   │   ├── test_table_ocr.py
│   │   ├── test_tag_extraction.py
│   │   ├── test_text_to_image.py
│   │   ├── test_trace.py
│   │   ├── test_trace_skip_raise_error.py
│   │   ├── test_translate.py
│   │   ├── test_treemind.py
│   │   ├── test_tts.py
│   │   ├── test_utils.py
│   │   ├── test_utils_collector.py
│   │   ├── test_utils_logger.py
│   │   ├── test_utils_logging_util.py
│   │   ├── test_v2_animal_recognize.py
│   │   ├── test_v2_asr.py
│   │   ├── test_v2_component_trace.py
│   │   ├── test_v2_dialog_summary.py
│   │   ├── test_v2_general_ocr.py
│   │   ├── test_v2_hallucination_detection.py
│   │   ├── test_v2_handwrite_ocr.py
│   │   ├── test_v2_image_understand.py
│   │   ├── test_v2_is_complex_query.py
│   │   ├── test_v2_mix_card_ocr.py
│   │   ├── test_v2_mrc.py
│   │   ├── test_v2_nl2pandas.py
│   │   ├── test_v2_object_recognition.py
│   │   ├── test_v2_oral_query_generat.py
│   │   ├── test_v2_plant_recognize.py
│   │   ├── test_v2_qa_pair_mining.py
│   │   ├── test_v2_qrcode_ocr.py
│   │   ├── test_v2_query_decomposition.py
│   │   ├── test_v2_query_rewrite.py
│   │   ├── test_v2_similar_question.py
│   │   ├── test_v2_style_rewrite.py
│   │   ├── test_v2_style_writing.py
│   │   ├── test_v2_table_ocr.py
│   │   ├── test_v2_tag_extraction.py
│   │   ├── test_v2_text_to_image.py
│   │   ├── test_v2_translate.py
│   │   ├── test_v2_treemind.py
│   │   ├── test_vdb_retriever.py
│   │   └── title_splitter.docx
│   └── utils/
│       ├── __init__.py
│       ├── _bcc.py
│       ├── bce_deploy.py
│       ├── chainlit.md
│       ├── collector.py
│       ├── func_utils.py
│       ├── json_schema_to_model.py
│       ├── logger_file_headler.py
│       ├── logger_util.py
│       ├── model_util.py
│       ├── sse_util.py
│       └── trace/
│           ├── __init__.py
│           ├── _function.py
│           ├── phoenix_wrapper.py
│           ├── tracer.py
│           └── tracer_wrapper.py
├── requirements.txt
└── setup.py
Download .txt
Showing preview only (423K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (5162 symbols across 559 files)

FILE: cookbooks/live_broadcast_material/2024_05_16/chatbot.py
  class Chatbot (line 34) | class Chatbot:
    method __init__ (line 35) | def __init__(self):
    method run (line 41) | def run(self):
    method record_audio (line 72) | def record_audio(self, path):
    method run_tts_and_play_audio (line 108) | def run_tts_and_play_audio(self, text: str):
    method run_asr (line 121) | def run_asr(self, audio_path: str):
    method run_agent (line 129) | def run_agent(self, query):

FILE: cookbooks/live_broadcast_material/2024_05_16/two_agent.py
  class IdiomSolitaire (line 21) | class IdiomSolitaire:
    method __init__ (line 22) | def __init__(self, real_player, app_id1, app_id2):
    method run (line 27) | def run(self):
  function main1 (line 54) | def main1():
  function main2 (line 61) | def main2():

FILE: docs/Tools/MarkdownSh/markdown2rst.py
  function parse_options (line 90) | def parse_options():
  class RestBlockGrammar (line 95) | class RestBlockGrammar(mistune.BlockGrammar):
  class RestBlockLexer (line 108) | class RestBlockLexer(mistune.BlockLexer):
    method parse_directive (line 117) | def parse_directive(self, m):
    method parse_oneline_directive (line 124) | def parse_oneline_directive(self, m):
    method parse_rest_code_block (line 132) | def parse_rest_code_block(self, m):
  class RestInlineGrammar (line 137) | class RestInlineGrammar(mistune.InlineGrammar):
    method no_underscore_emphasis (line 155) | def no_underscore_emphasis(self):
  class RestInlineLexer (line 165) | class RestInlineLexer(mistune.InlineLexer):
    method __init__ (line 175) | def __init__(self, *args, **kwargs):
    method output_double_emphasis (line 192) | def output_double_emphasis(self, m):
    method output_emphasis (line 198) | def output_emphasis(self, m):
    method output_image_link (line 204) | def output_image_link(self, m):
    method output_rest_role (line 209) | def output_rest_role(self, m):
    method output_rest_link (line 213) | def output_rest_link(self, m):
    method output_inline_math (line 217) | def output_inline_math(self, m):
    method output_eol_literal_marker (line 221) | def output_eol_literal_marker(self, m):
  class RestRenderer (line 227) | class RestRenderer(mistune.Renderer):
    method __init__ (line 242) | def __init__(self, *args, **kwargs):
    method _indent_block (line 253) | def _indent_block(self, block):
    method _raw_html (line 257) | def _raw_html(self, html):
    method block_code (line 261) | def block_code(self, code, lang=None):
    method block_quote (line 273) | def block_quote(self, text):
    method block_html (line 278) | def block_html(self, html):
    method header (line 285) | def header(self, text, level, raw=None):
    method hrule (line 295) | def hrule(self):
    method list (line 299) | def list(self, body, ordered=True):
    method list_item (line 313) | def list_item(self, text):
    method paragraph (line 317) | def paragraph(self, text):
    method table (line 321) | def table(self, header, body):
    method table_row (line 336) | def table_row(self, content):
    method table_cell (line 350) | def table_cell(self, content, **flags):
    method double_emphasis (line 359) | def double_emphasis(self, text):
    method emphasis (line 366) | def emphasis(self, text):
    method codespan (line 373) | def codespan(self, text):
    method linebreak (line 387) | def linebreak(self):
    method strikethrough (line 393) | def strikethrough(self, text):
    method text (line 400) | def text(self, text):
    method autolink (line 407) | def autolink(self, link, is_email=False):
    method link (line 415) | def link(self, link, title, text):
    method image (line 457) | def image(self, src, title, text):
    method inline_html (line 474) | def inline_html(self, html):
    method newline (line 481) | def newline(self):
    method footnote_ref (line 485) | def footnote_ref(self, key, index):
    method footnote_item (line 493) | def footnote_item(self, key, text):
    method footnotes (line 501) | def footnotes(self, text):
    method image_link (line 513) | def image_link(self, url, target, alt):
    method rest_role (line 523) | def rest_role(self, text):
    method rest_link (line 527) | def rest_link(self, text):
    method inline_math (line 531) | def inline_math(self, math):
    method eol_literal_marker (line 536) | def eol_literal_marker(self, marker):
    method directive (line 540) | def directive(self, text):
    method rest_code_block (line 544) | def rest_code_block(self):
  class M2R (line 549) | class M2R(mistune.Markdown):
    method __init__ (line 552) | def __init__(self,
    method parse (line 562) | def parse(self, text):
    method output_directive (line 567) | def output_directive(self):
    method output_rest_code_block (line 571) | def output_rest_code_block(self):
    method post_process (line 575) | def post_process(self, text):
  class M2RParser (line 586) | class M2RParser(rst.Parser, object):
    method parse (line 591) | def parse(self, inputstrings, document):
  class MdInclude (line 605) | class MdInclude(rst.Directive):
    method run (line 618) | def run(self):
  function setup (line 678) | def setup(app):
  function convert (line 695) | def convert(text, **kwargs):
  function parse_from_file (line 700) | def parse_from_file(file, encoding='utf-8', **kwargs):
  function save_to_file (line 710) | def save_to_file(target, src, encoding='utf-8', **kwargs):
  function main (line 723) | def main():

FILE: docs/Tools/MarkdownSh/markdown_parse.py
  function parse_markdown (line 81) | def parse_markdown(markdown):
  function read_markdown (line 149) | def read_markdown(file_path):
  function check_parse_result (line 155) | def check_parse_result(result):
  function parse_file (line 171) | def parse_file(file_path):

FILE: docs/Tools/SphinxSh/get_components_md.py
  function find_readme_files (line 3) | def find_readme_files(base_path):
  function extract_first_line (line 11) | def extract_first_line(readme_path):
  function update_mkdocs_yml (line 22) | def update_mkdocs_yml(results, mkdocs_path='../../../mkdocs.yml'):
  function main (line 55) | def main():

FILE: docs/Tools/SphinxSh/update_lib.py
  function mv_new_md (line 3) | def mv_new_md(input_filename, output_filename):
  function process_line_for_assistant (line 20) | def process_line_for_assistant(line):
  function process_line_for_components (line 53) | def process_line_for_components(line):
  function process_line_for_console (line 81) | def process_line_for_console(line):
  function process_file_for_assistant (line 112) | def process_file_for_assistant(input_filename, output_filename):
  function process_file_for_components (line 139) | def process_file_for_components(input_filename, output_filename):
  function process_file_for_console (line 167) | def process_file_for_console(input_filename, output_filename):

FILE: docs/Tools/SphinxSh/update_rst.py
  function process_rst_file (line 3) | def process_rst_file(filepath):
  function main (line 49) | def main():

FILE: go/appbuilder/agent_builder.go
  function NewAgentBuilder (line 32) | func NewAgentBuilder(appID string, config *SDKConfig) (*AgentBuilder, er...
  type AgentBuilder (line 46) | type AgentBuilder struct
    method CreateConversation (line 52) | func (t *AgentBuilder) CreateConversation() (string, error) {
    method UploadLocalFile (line 91) | func (t *AgentBuilder) UploadLocalFile(conversationID string, filePath...
    method Run (line 143) | func (t *AgentBuilder) Run(conversationID string, query string, fileID...

FILE: go/appbuilder/agent_builder_data.go
  method transform (line 25) | func (t *AgentBuilderAnswer) transform(inp *AgentBuilderRawResponse) {
  type AgentBuilderIterator (line 48) | type AgentBuilderIterator interface
  type AgentBuilderStreamIterator (line 53) | type AgentBuilderStreamIterator struct
    method Next (line 59) | func (t *AgentBuilderStreamIterator) Next() (*AgentBuilderAnswer, erro...
  type AgentBuilderOnceIterator (line 85) | type AgentBuilderOnceIterator struct
    method Next (line 90) | func (t *AgentBuilderOnceIterator) Next() (*AgentBuilderAnswer, error) {

FILE: go/appbuilder/agent_builder_data_test.go
  function TestAgentBuilderAnswerTransformWithInvalidContentType (line 12) | func TestAgentBuilderAnswerTransformWithInvalidContentType(t *testing.T) {
  function TestAgentBuilderStreamIterator_Next_ReadError (line 34) | func TestAgentBuilderStreamIterator_Next_ReadError(t *testing.T) {
  function TestAgentBuilderStreamIterator_Next_JSONUnmarshalError (line 55) | func TestAgentBuilderStreamIterator_Next_JSONUnmarshalError(t *testing.T) {
  function TestAgentBuilderStreamIterator_Next_NonSSEFormat (line 76) | func TestAgentBuilderStreamIterator_Next_NonSSEFormat(t *testing.T) {
  function TestAgentBuilderStreamIterator_Next_ValidSSE (line 94) | func TestAgentBuilderStreamIterator_Next_ValidSSE(t *testing.T) {

FILE: go/appbuilder/agent_builder_test.go
  type MockHTTPClient (line 29) | type MockHTTPClient struct
    method Do (line 31) | func (m *MockHTTPClient) Do(req *http.Request) (*http.Response, error) {
  type FaultyHTTPClient (line 39) | type FaultyHTTPClient struct
    method Do (line 41) | func (f *FaultyHTTPClient) Do(req *http.Request) (*http.Response, erro...
  type FaultyBody (line 49) | type FaultyBody struct
    method Read (line 51) | func (f *FaultyBody) Read(p []byte) (n int, err error) {
    method Close (line 55) | func (f *FaultyBody) Close() error {
  type InvalidJSONHTTPClient (line 60) | type InvalidJSONHTTPClient struct
    method Do (line 62) | func (m *InvalidJSONHTTPClient) Do(req *http.Request) (*http.Response,...
  type MissingIDHTTPClient (line 70) | type MissingIDHTTPClient struct
    method Do (line 72) | func (m *MissingIDHTTPClient) Do(req *http.Request) (*http.Response, e...
  function TestNewAgentBuilderError (line 78) | func TestNewAgentBuilderError(t *testing.T) {
  function TestNewAgentBuilderUploadLocalFileError1 (line 149) | func TestNewAgentBuilderUploadLocalFileError1(t *testing.T) {
  function TestNewAgentBuilderUploadLocalFileError2 (line 184) | func TestNewAgentBuilderUploadLocalFileError2(t *testing.T) {
  function TestNewAgentBuilderRunError (line 225) | func TestNewAgentBuilderRunError(t *testing.T) {
  function TestNewAgentBuilder (line 261) | func TestNewAgentBuilder(t *testing.T) {

FILE: go/appbuilder/app_builder_client.go
  function GetAppList (line 35) | func GetAppList(req GetAppListRequest, config *SDKConfig) ([]App, error) {
  function DescribeApps (line 91) | func DescribeApps(req DescribeAppsRequest, config *SDKConfig) (DescribeA...
  function DescribeApp (line 130) | func DescribeApp(appID string, config *SDKConfig) (DescribeAppResponse, ...
  function NewAppBuilderClient (line 169) | func NewAppBuilderClient(appID string, config *SDKConfig) (*AppBuilderCl...
  type AppBuilderClient (line 183) | type AppBuilderClient struct
    method GetSdkConfig (line 190) | func (t *AppBuilderClient) GetSdkConfig() *SDKConfig {
    method GetClient (line 194) | func (t *AppBuilderClient) GetClient() HTTPClient {
    method CreateConversation (line 202) | func (t *AppBuilderClient) CreateConversation() (string, error) {
    method UploadLocalFile (line 241) | func (t *AppBuilderClient) UploadLocalFile(conversationID string, file...
    method UploadFile (line 293) | func (t *AppBuilderClient) UploadFile(req *AppBuilderClientUploadFileR...
    method Run (line 364) | func (t *AppBuilderClient) Run(param ...interface{}) (AppBuilderClient...
    method buildAppBuilderClientRunRequest (line 420) | func (t *AppBuilderClient) buildAppBuilderClientRunRequest(param ...in...
    method Feedback (line 452) | func (t *AppBuilderClient) Feedback(req AppBuilderClientFeedbackReques...
    method RunWithToolCall (line 490) | func (t *AppBuilderClient) RunWithToolCall(req AppBuilderClientRunRequ...
  type HTTPClient (line 198) | type HTTPClient interface

FILE: go/appbuilder/app_builder_client_data.go
  constant CodeContentType (line 26) | CodeContentType              = "code"
  constant TextContentType (line 27) | TextContentType              = "text"
  constant ImageContentType (line 28) | ImageContentType             = "image"
  constant RAGContentType (line 29) | RAGContentType               = "rag"
  constant FunctionCallContentType (line 30) | FunctionCallContentType      = "function_call"
  constant AudioContentType (line 31) | AudioContentType             = "audio"
  constant VideoContentType (line 32) | VideoContentType             = "video"
  constant StatusContentType (line 33) | StatusContentType            = "status"
  constant ChatflowInterruptContentType (line 34) | ChatflowInterruptContentType = "chatflow_interrupt"
  constant PublishMessageContentType (line 35) | PublishMessageContentType    = "publish_message"
  constant JsonContentType (line 36) | JsonContentType              = "json"
  constant ChatReasoningContentType (line 37) | ChatReasoningContentType     = "chat_reasoning"
  constant ChatflowEventType (line 41) | ChatflowEventType      = "chatflow"
  constant FollowUpQueryEventType (line 42) | FollowUpQueryEventType = "FollowUpQuery"
  type AppBuilderClientRunRequest (line 60) | type AppBuilderClientRunRequest struct
  type AppBuilderClientUploadFileRequest (line 76) | type AppBuilderClientUploadFileRequest struct
  type AppBuilderClientFeedbackRequest (line 83) | type AppBuilderClientFeedbackRequest struct
  type Tool (line 92) | type Tool struct
  type Function (line 97) | type Function struct
  type ToolOutput (line 103) | type ToolOutput struct
  type ToolChoice (line 108) | type ToolChoice struct
  type ToolChoiceFunction (line 113) | type ToolChoiceFunction struct
  type Action (line 118) | type Action struct
  type ActionParamters (line 123) | type ActionParamters struct
  type ActionInterruptEvent (line 127) | type ActionInterruptEvent struct
  type CustomMetadata (line 132) | type CustomMetadata struct
  function NewResumeAction (line 136) | func NewResumeAction(eventId string) *Action {
  function NewAction (line 140) | func NewAction(actionType string, eventId string, eventType string) *Act...
  type AgentBuilderRawResponse (line 152) | type AgentBuilderRawResponse struct
  type RawEventDetail (line 162) | type RawEventDetail struct
  type Usage (line 174) | type Usage struct
  type AgentBuilderAnswer (line 181) | type AgentBuilderAnswer struct
  type Event (line 186) | type Event struct
  type ToolCall (line 197) | type ToolCall struct
  type FunctionCallOption (line 203) | type FunctionCallOption struct
  type TextDetail (line 208) | type TextDetail struct
  type CodeDetail (line 212) | type CodeDetail struct
  type RAGDetail (line 218) | type RAGDetail struct
  type Reference (line 223) | type Reference struct
  type FunctionCallDetail (line 235) | type FunctionCallDetail struct
  type ImageDetail (line 242) | type ImageDetail struct
  type AudioDetail (line 246) | type AudioDetail struct
  type VideoDetail (line 250) | type VideoDetail struct
  type StatusDetail (line 254) | type StatusDetail struct
  type ChatflowInterruptDetail (line 256) | type ChatflowInterruptDetail struct
  type PublishMessageDetail (line 261) | type PublishMessageDetail struct
  type ChatReasoningDetail (line 266) | type ChatReasoningDetail struct
  type JsonDetail (line 270) | type JsonDetail struct
  type FollowUpQueries (line 274) | type FollowUpQueries struct
  type DefaultDetail (line 278) | type DefaultDetail struct
  type AppBuilderClientRawResponse (line 287) | type AppBuilderClientRawResponse struct
  type GetAppListRequest (line 299) | type GetAppListRequest struct
  type GetAppListResponse (line 305) | type GetAppListResponse struct
  type DescribeAppsRequest (line 312) | type DescribeAppsRequest struct
  type DescribeAppsResponse (line 317) | type DescribeAppsResponse struct
  type DescribeAppRequest (line 326) | type DescribeAppRequest struct
  type DescribeAppResponse (line 330) | type DescribeAppResponse struct
  type AppFollowUpQueries (line 344) | type AppFollowUpQueries struct
  type Component (line 349) | type Component struct
  type KnowledgeBaseConfig (line 354) | type KnowledgeBaseConfig struct
  type AppKnowledgeBase (line 358) | type AppKnowledgeBase struct
  type RetrievalConfig (line 363) | type RetrievalConfig struct
  type ModelConfig (line 370) | type ModelConfig struct
  type PlanConfig (line 374) | type PlanConfig struct
  type ChatConfig (line 380) | type ChatConfig struct
  type ModelParams (line 386) | type ModelParams struct
  type Background (line 390) | type Background struct
  type MobileConfig (line 396) | type MobileConfig struct
  type PCConfig (line 402) | type PCConfig struct
  type App (line 409) | type App struct
  type AppBuilderClientAnswer (line 418) | type AppBuilderClientAnswer struct
    method transform (line 427) | func (t *AppBuilderClientAnswer) transform(inp *AppBuilderClientRawRes...
  type AppBuilderClientIterator (line 458) | type AppBuilderClientIterator interface
  type AppBuilderClientStreamIterator (line 463) | type AppBuilderClientStreamIterator struct
    method Next (line 469) | func (t *AppBuilderClientStreamIterator) Next() (*AppBuilderClientAnsw...
  type AppBuilderClientOnceIterator (line 495) | type AppBuilderClientOnceIterator struct
    method Next (line 500) | func (t *AppBuilderClientOnceIterator) Next() (*AppBuilderClientAnswer...

FILE: go/appbuilder/app_builder_client_test.go
  function TestNewAppBuilderClientError (line 26) | func TestNewAppBuilderClientError(t *testing.T) {
  function TestClientUploadLocalFile (line 147) | func TestClientUploadLocalFile(t *testing.T) {
  function TestClientRun (line 211) | func TestClientRun(t *testing.T) {
  function TestClientRunWithToolCallError (line 255) | func TestClientRunWithToolCallError(t *testing.T) {
  function TestDescribeApp (line 349) | func TestDescribeApp(t *testing.T) {
  function TestNewAppBuilderClient (line 379) | func TestNewAppBuilderClient(t *testing.T) {
  function TestAppBuilderClientRunWithToolCall (line 468) | func TestAppBuilderClientRunWithToolCall(t *testing.T) {
  function TestAppBuilderClientRunToolChoice (line 582) | func TestAppBuilderClientRunToolChoice(t *testing.T) {
  function TestAppBuilderClientRunChatflow (line 651) | func TestAppBuilderClientRunChatflow(t *testing.T) {
  function TestAppbuilderClientFeedback (line 806) | func TestAppbuilderClientFeedback(t *testing.T) {
  function TestAppBuilderClientUploadFile (line 872) | func TestAppBuilderClientUploadFile(t *testing.T) {
  function TestAppBuilderClientRunParameters (line 927) | func TestAppBuilderClientRunParameters(t *testing.T) {
  function TestAppBuilderClientRunCustomMetadata (line 967) | func TestAppBuilderClientRunCustomMetadata(t *testing.T) {

FILE: go/appbuilder/component_client.go
  type ComponentClient (line 28) | type ComponentClient struct
    method Run (line 44) | func (t *ComponentClient) Run(component, version, action string, strea...
  function NewComponentClient (line 33) | func NewComponentClient(config *SDKConfig) (*ComponentClient, error) {

FILE: go/appbuilder/component_client_data.go
  constant SysOriginQuery (line 25) | SysOriginQuery    = "_sys_origin_query"
  constant SysFileUrls (line 26) | SysFileUrls       = "_sys_file_urls"
  constant SysConversationID (line 27) | SysConversationID = "_sys_conversation_id"
  constant SysEndUserID (line 28) | SysEndUserID      = "_sys_end_user_id"
  constant SysChatHistory (line 29) | SysChatHistory    = "_sys_chat_history"
  type ComponentRunRequest (line 32) | type ComponentRunRequest struct
  type Message (line 37) | type Message struct
  type ComponentRunResponse (line 42) | type ComponentRunResponse struct
  type Content (line 56) | type Content struct
  type ComponentEvent (line 67) | type ComponentEvent struct
  type Text (line 76) | type Text struct
  type Code (line 80) | type Code struct
  type Files (line 84) | type Files struct
  type Urls (line 89) | type Urls struct
  type OralText (line 93) | type OralText struct
  type References (line 97) | type References struct
  type Image (line 106) | type Image struct
  type Chart (line 112) | type Chart struct
  type Audio (line 117) | type Audio struct
  type PlanStep (line 123) | type PlanStep struct
  type Plan (line 129) | type Plan struct
  type FunctionCall (line 134) | type FunctionCall struct
  type Json (line 140) | type Json struct
  type ComponentClientIterator (line 144) | type ComponentClientIterator interface
  type ComponentClientStreamIterator (line 149) | type ComponentClientStreamIterator struct
    method Next (line 155) | func (t *ComponentClientStreamIterator) Next() (*ComponentRunResponse,...
  type ComponentClientOnceIterator (line 179) | type ComponentClientOnceIterator struct
    method Next (line 184) | func (t *ComponentClientOnceIterator) Next() (*ComponentRunResponse, e...

FILE: go/appbuilder/component_client_test.go
  function TestComponentClient (line 24) | func TestComponentClient(t *testing.T) {
  function TestComponentClientHeader (line 91) | func TestComponentClientHeader(t *testing.T) {

FILE: go/appbuilder/config.go
  constant GatewayURL (line 31) | GatewayURL            = "GATEWAY_URL"
  constant GatewayURLV2 (line 32) | GatewayURLV2          = "GATEWAY_URL_V2"
  constant SecretKey (line 33) | SecretKey             = "APPBUILDER_TOKEN"
  constant ConsoleOpenAPIVersion (line 34) | ConsoleOpenAPIVersion = "CONSOLE_OPENAPI_VERSION"
  constant ConsoleOpenAPIPrefix (line 35) | ConsoleOpenAPIPrefix  = "CONSOLE_OPENAPI_PREFIX"
  constant SecretKeyPrefix (line 36) | SecretKeyPrefix       = "SECRET_KEY_PREFIX"
  constant DatasetID (line 37) | DatasetID             = "DATASET_ID"
  constant SecretKeyV3 (line 38) | SecretKeyV3           = "APPBUILDER_TOKEN_V3"
  constant DatasetIDV3 (line 39) | DatasetIDV3           = "DATASET_ID_V3"
  constant DocumentIDV3 (line 40) | DocumentIDV3          = "DOCUMENT_ID_V3"
  constant DefaultSecretKeyPrefix (line 42) | DefaultSecretKeyPrefix       = "Bearer"
  constant DefaultGatewayURL (line 43) | DefaultGatewayURL            = "https://appbuilder.baidu.com"
  constant DefaultGatewayURLV2 (line 44) | DefaultGatewayURLV2          = "https://qianfan.baidubce.com"
  constant DefaultConsoleOpenAPIVersion (line 45) | DefaultConsoleOpenAPIVersion = "/v2"
  constant DefaultConsoleOpenAPIPrefix (line 46) | DefaultConsoleOpenAPIPrefix  = ""
  type SDKConfig (line 49) | type SDKConfig struct
    method AuthHeader (line 108) | func (t *SDKConfig) AuthHeader() http.Header {
    method AuthHeaderV2 (line 116) | func (t *SDKConfig) AuthHeaderV2() http.Header {
    method authHeader (line 123) | func (t *SDKConfig) authHeader() http.Header {
    method ServiceURL (line 135) | func (t *SDKConfig) ServiceURL(suffix string) (*url.URL, error) {
    method ServiceURLV2 (line 159) | func (t *SDKConfig) ServiceURLV2(suffix string) (*url.URL, error) {
    method formatURL (line 164) | func (t *SDKConfig) formatURL(absolutePath, suffix string) (*url.URL, ...
    method BuildCurlCommand (line 191) | func (t *SDKConfig) BuildCurlCommand(req *http.Request) {
  function NewSDKConfig (line 59) | func NewSDKConfig(gatewayURL, secretKey string) (*SDKConfig, error) {
  function getEnvWithDefault (line 96) | func getEnvWithDefault(key, paramValue, defaultValue string) string {
  type nopCloser (line 181) | type nopCloser struct
    method Close (line 185) | func (nopCloser) Close() error { return nil }
  function NopCloser (line 187) | func NopCloser(r io.Reader) io.ReadCloser {

FILE: go/appbuilder/dataset.go
  function NewDataset (line 31) | func NewDataset(config *SDKConfig) (*Dataset, error) {
  type Dataset (line 42) | type Dataset struct
    method Create (line 47) | func (t *Dataset) Create(name string) (string, error) {
    method BatchUploadLocaleFile (line 85) | func (t *Dataset) BatchUploadLocaleFile(datasetID string, localFilePat...
    method UploadLocalFile (line 101) | func (t *Dataset) UploadLocalFile(datasetID string, localFilePath stri...
    method uploadLocalFile (line 113) | func (t *Dataset) uploadLocalFile(localFilePath string) (string, error) {
    method addFileToDataset (line 161) | func (t *Dataset) addFileToDataset(datasetID string, fileID []string) ...
    method ListDocument (line 200) | func (t *Dataset) ListDocument(datasetID string, page int, limit int, ...
    method DeleteDocument (line 243) | func (t *Dataset) DeleteDocument(datasetID, documentID string) error {

FILE: go/appbuilder/dataset_data.go
  type DatasetResponse (line 17) | type DatasetResponse struct
  type DatasetBindResponse (line 23) | type DatasetBindResponse struct
  type DatasetBindResult (line 29) | type DatasetBindResult struct
  type ListDocumentResponse (line 33) | type ListDocumentResponse struct
  type ListDocumentResponseResult (line 39) | type ListDocumentResponseResult struct
  type FileInfo (line 47) | type FileInfo struct

FILE: go/appbuilder/dataset_test.go
  function TestDatasetError (line 24) | func TestDatasetError(t *testing.T) {

FILE: go/appbuilder/knowledge_base.go
  function NewKnowledgeBase (line 34) | func NewKnowledgeBase(config *SDKConfig) (*KnowledgeBase, error) {
  function NewKnowledgeBaseWithKnowledgeBaseID (line 45) | func NewKnowledgeBaseWithKnowledgeBaseID(knowledgeBaseID string, config ...
  type KnowledgeBase (line 56) | type KnowledgeBase struct
    method CreateDocument (line 62) | func (t *KnowledgeBase) CreateDocument(req CreateDocumentRequest) (Cre...
    method DeleteDocument (line 103) | func (t *KnowledgeBase) DeleteDocument(req DeleteDocumentRequest) error {
    method GetDocumentList (line 149) | func (t *KnowledgeBase) GetDocumentList(req GetDocumentListRequest) (*...
    method DescribeDocuments (line 204) | func (t *KnowledgeBase) DescribeDocuments(req DescribeDocumentsRequest...
    method UploadFile (line 245) | func (t *KnowledgeBase) UploadFile(localFilePath string) (string, erro...
    method CreateKnowledgeBase (line 293) | func (t *KnowledgeBase) CreateKnowledgeBase(req KnowledgeBaseDetail) (...
    method GetKnowledgeBaseDetail (line 331) | func (t *KnowledgeBase) GetKnowledgeBaseDetail(knowledgeBaseID string)...
    method GetKnowledgeBaseList (line 368) | func (t *KnowledgeBase) GetKnowledgeBaseList(req GetKnowledgeBaseListR...
    method ModifyKnowledgeBase (line 403) | func (t *KnowledgeBase) ModifyKnowledgeBase(req ModifyKnowlegeBaseRequ...
    method DeleteKnowledgeBase (line 437) | func (t *KnowledgeBase) DeleteKnowledgeBase(knowledgeBaseID string) er...
    method DeleteKnowledgeBaseWithReq (line 441) | func (t *KnowledgeBase) DeleteKnowledgeBaseWithReq(req DeleteKnowlegeB...
    method deleteKnowledgeBase (line 445) | func (t *KnowledgeBase) deleteKnowledgeBase(knowledgeBaseID string, cl...
    method CreateDocuments (line 482) | func (t *KnowledgeBase) CreateDocuments(req CreateDocumentsRequest) er...
    method CreateDocumentsWithResp (line 516) | func (t *KnowledgeBase) CreateDocumentsWithResp(req CreateDocumentsReq...
    method UploadDocuments (line 553) | func (t *KnowledgeBase) UploadDocuments(localFilePath string, req Crea...
    method UploadDocumentsWithResp (line 610) | func (t *KnowledgeBase) UploadDocumentsWithResp(localFilePath string, ...
    method CreateChunk (line 670) | func (t *KnowledgeBase) CreateChunk(req CreateChunkRequest) (string, e...
    method ModifyChunk (line 713) | func (t *KnowledgeBase) ModifyChunk(req ModifyChunkRequest) error {
    method DeleteChunk (line 756) | func (t *KnowledgeBase) DeleteChunk(chunkID string) error {
    method DeleteChunkWithReq (line 760) | func (t *KnowledgeBase) DeleteChunkWithReq(req DeleteChunkRequest) err...
    method deleteChunk (line 764) | func (t *KnowledgeBase) deleteChunk(chunkID string, clientToken string...
    method DescribeChunk (line 810) | func (t *KnowledgeBase) DescribeChunk(chunkID string) (DescribeChunkRe...
    method DescribeChunks (line 853) | func (t *KnowledgeBase) DescribeChunks(req DescribeChunksRequest) (Des...
    method QueryKnowledgeBase (line 893) | func (t *KnowledgeBase) QueryKnowledgeBase(req QueryKnowledgeBaseReque...

FILE: go/appbuilder/knowledge_base_data.go
  type QueryType (line 17) | type QueryType
  constant Fulltext (line 20) | Fulltext QueryType = "fulltext"
  constant Semantic (line 21) | Semantic QueryType = "semantic"
  constant Hybrid (line 22) | Hybrid   QueryType = "hybrid"
  constant ContentTypeRawText (line 26) | ContentTypeRawText = "raw_text"
  constant ContentTypeQA (line 27) | ContentTypeQA      = "qa"
  type CreateDocumentRequest (line 30) | type CreateDocumentRequest struct
  type DeleteDocumentRequest (line 39) | type DeleteDocumentRequest struct
  type GetDocumentListRequest (line 45) | type GetDocumentListRequest struct
  type CustomProcessRule (line 52) | type CustomProcessRule struct
  type CreateDocumentResponse (line 58) | type CreateDocumentResponse struct
  type GetDocumentListResponse (line 66) | type GetDocumentListResponse struct
  type Document (line 73) | type Document struct
  type DocumentMeta (line 82) | type DocumentMeta struct
  type UploadFileResponse (line 87) | type UploadFileResponse struct
  type KnowlegeBaseConfig (line 95) | type KnowlegeBaseConfig struct
  type KnowledgeBaseConfigIndex (line 100) | type KnowledgeBaseConfigIndex struct
  type KnowledgeBaseConfigCatalogue (line 108) | type KnowledgeBaseConfigCatalogue struct
  type KnowledgeBaseDetail (line 112) | type KnowledgeBaseDetail struct
  type ModifyKnowlegeBaseRequest (line 120) | type ModifyKnowlegeBaseRequest struct
  type DeleteKnowlegeBaseRequest (line 128) | type DeleteKnowlegeBaseRequest struct
  type GetKnowledgeBaseListRequest (line 133) | type GetKnowledgeBaseListRequest struct
  type GetKnowledgeBaseListResponse (line 139) | type GetKnowledgeBaseListResponse struct
  type DocumentsSourceUrlConfig (line 148) | type DocumentsSourceUrlConfig struct
  type DocumentsSource (line 152) | type DocumentsSource struct
  type DocumentsProcessOptionParser (line 159) | type DocumentsProcessOptionParser struct
  type DocumentsProcessOptionChunkerSeparator (line 163) | type DocumentsProcessOptionChunkerSeparator struct
  type DocumentsProcessOptionChunkerPattern (line 169) | type DocumentsProcessOptionChunkerPattern struct
  type DocumentsProcessOptionChunker (line 176) | type DocumentsProcessOptionChunker struct
  type DocumentsProcessOptionKnowledgeAugmentation (line 183) | type DocumentsProcessOptionKnowledgeAugmentation struct
  type DocumentsProcessOption (line 187) | type DocumentsProcessOption struct
  type CreateDocumentsRequest (line 194) | type CreateDocumentsRequest struct
  type CreateDocumentsResponse (line 202) | type CreateDocumentsResponse struct
  type UploadDocumentsResponse (line 207) | type UploadDocumentsResponse struct
  type CreateChunkRequest (line 212) | type CreateChunkRequest struct
  type CreateChunkResponse (line 219) | type CreateChunkResponse struct
  type ModifyChunkRequest (line 223) | type ModifyChunkRequest struct
  type DeleteChunkRequest (line 231) | type DeleteChunkRequest struct
  type DescribeChunkRequest (line 237) | type DescribeChunkRequest struct
  type DescribeChunkResponse (line 242) | type DescribeChunkResponse struct
  type DescribeDocumentsRequest (line 258) | type DescribeDocumentsRequest struct
  type DescribeDocumentResponse (line 264) | type DescribeDocumentResponse struct
  type DescribeDocumentMeta (line 274) | type DescribeDocumentMeta struct
  type DescribeDocumentsResponse (line 282) | type DescribeDocumentsResponse struct
  type DescribeChunksRequest (line 291) | type DescribeChunksRequest struct
  type DescribeChunksResponse (line 300) | type DescribeChunksResponse struct
  type MetadataFilter (line 308) | type MetadataFilter struct
  type MetadataFilters (line 314) | type MetadataFilters struct
  type PreRankingConfig (line 319) | type PreRankingConfig struct
  type ElasticSearchRetrieveConfig (line 327) | type ElasticSearchRetrieveConfig struct
  type VectorDBRetrieveConfig (line 334) | type VectorDBRetrieveConfig struct
  type SmallToBigConfig (line 341) | type SmallToBigConfig struct
  type RankingConfig (line 346) | type RankingConfig struct
  type QueryPipelineConfig (line 354) | type QueryPipelineConfig struct
  type QueryKnowledgeBaseRequest (line 359) | type QueryKnowledgeBaseRequest struct
  type RowLine (line 370) | type RowLine struct
  type ChunkLocation (line 378) | type ChunkLocation struct
  type Chunk (line 383) | type Chunk struct
  type QueryKnowledgeBaseResponse (line 402) | type QueryKnowledgeBaseResponse struct

FILE: go/appbuilder/knowledge_base_test.go
  function TestAddDocumentError (line 27) | func TestAddDocumentError(t *testing.T) {
  function TestCreateKnowledgeBaseError (line 250) | func TestCreateKnowledgeBaseError(t *testing.T) {
  function TestChunkError (line 821) | func TestChunkError(t *testing.T) {
  function TestAddDocument (line 1101) | func TestAddDocument(t *testing.T) {
  function TestCreateKnowledgeBase (line 1177) | func TestCreateKnowledgeBase(t *testing.T) {
  function TestChunk (line 1417) | func TestChunk(t *testing.T) {
  function TestQueryKnowledgeBase (line 1522) | func TestQueryKnowledgeBase(t *testing.T) {

FILE: go/appbuilder/rag.go
  function NewRAG (line 27) | func NewRAG(appID string, config *SDKConfig) (*RAG, error) {
  type RAG (line 41) | type RAG struct
    method Run (line 47) | func (t *RAG) Run(conversationID string, query string, stream bool) (R...

FILE: go/appbuilder/rag_data.go
  type RAGRunResponse (line 24) | type RAGRunResponse struct
  type RAGResult (line 30) | type RAGResult struct
  type RAGEvent (line 36) | type RAGEvent struct
  type RAGAnswer (line 44) | type RAGAnswer struct
    method transform (line 50) | func (t *RAGAnswer) transform(res *RAGRunResponse) {
  type RAGIterator (line 59) | type RAGIterator interface
  type RAGStreamIterator (line 64) | type RAGStreamIterator struct
    method Next (line 70) | func (t *RAGStreamIterator) Next() (*RAGAnswer, error) {
  type RAGOnceIterator (line 101) | type RAGOnceIterator struct
    method Next (line 107) | func (t *RAGOnceIterator) Next() (*RAGAnswer, error) {

FILE: go/appbuilder/rag_test.go
  function TestNewRAGError (line 26) | func TestNewRAGError(t *testing.T) {
  function TestNewRAG (line 84) | func TestNewRAG(t *testing.T) {

FILE: go/appbuilder/util.go
  type SSEEvent (line 27) | type SSEEvent struct
  function checkHTTPResponse (line 33) | func checkHTTPResponse(rsp *http.Response) (string, error) {
  function NewSSEReader (line 49) | func NewSSEReader(bufSize int, reader *bufio.Reader) *sseReader {
  type sseReader (line 54) | type sseReader struct
    method ReadMessageLine (line 59) | func (t *sseReader) ReadMessageLine() ([]byte, error) {

FILE: java/parse_tests_and_coverage.py
  function parse_surefire_reports (line 10) | def parse_surefire_reports():
  function parse_jacoco (line 92) | def parse_jacoco():
  function get_modified_files (line 246) | def get_modified_files(repo, base_branch, path_pattern='src/main/**/*.ja...
  function generate_incremental_coverage_report (line 302) | def generate_incremental_coverage_report(modified_files, coverage_data):
  function main (line 364) | def main():

FILE: java/src/main/java/com/baidubce/appbuilder/base/component/Component.java
  class Component (line 6) | public class Component {
    method Component (line 9) | public Component() {
    method Component (line 14) | public Component(String secretKey) {
    method Component (line 18) | public Component(String secretKey, String gateway) {
    method initClient (line 22) | private void initClient(String secretKey, String gateway) {
    method getEnvWithDefault (line 43) | private String getEnvWithDefault(String propertyKey, String currentVal...

FILE: java/src/main/java/com/baidubce/appbuilder/base/config/AppBuilderConfig.java
  class AppBuilderConfig (line 3) | public class AppBuilderConfig {
    method AppBuilderConfig (line 110) | private AppBuilderConfig() {}

FILE: java/src/main/java/com/baidubce/appbuilder/base/exception/AppBuilderServerException.java
  class AppBuilderServerException (line 3) | public class AppBuilderServerException extends Exception {
    method AppBuilderServerException (line 11) | public AppBuilderServerException(String requestId, int code, String me...
    method AppBuilderServerException (line 17) | public AppBuilderServerException(String requestId, int code, String me...
    method AppBuilderServerException (line 23) | public AppBuilderServerException(String requestId, int code, String me...
    method getRequestId (line 28) | public String getRequestId() {
    method getCode (line 32) | public int getCode() {
    method getMessage (line 36) | public String getMessage() {
    method getAppbuilderCode (line 40) | public int getAppbuilderCode() {
    method getAppbuilderMessage (line 44) | public String getAppbuilderMessage() {
    method getResponseBody (line 48) | public String getResponseBody() {
    method toString (line 52) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/base/utils/http/HttpClient.java
  class HttpClient (line 33) | public class HttpClient {
    method HttpClient (line 44) | public HttpClient(String secretKey, String gateway, String gatewayV2) {
    method createPostRequest (line 97) | public ClassicHttpRequest createPostRequest(String url, HttpEntity ent...
    method createPostRequestV2 (line 126) | public ClassicHttpRequest createPostRequestV2(String url, HttpEntity e...
    method createGetRequestV2 (line 148) | public ClassicHttpRequest createGetRequestV2(String url, Map<String, O...
    method createDeleteRequestV2 (line 171) | public ClassicHttpRequest createDeleteRequestV2(String url, Map<String...
    method execute (line 197) | public <T> HttpResponse<T> execute(ClassicHttpRequest request, Type bo...
    method executeSSE (line 236) | public <T> HttpResponse<StreamIterator<T>> executeSSE(ClassicHttpReque...
    method toQueryString (line 261) | private String toQueryString(Map<String, Object> map) {
    method buildCurlCommand (line 280) | private void buildCurlCommand(ClassicHttpRequest request) {

FILE: java/src/main/java/com/baidubce/appbuilder/base/utils/http/HttpResponse.java
  class HttpResponse (line 5) | public class HttpResponse<T> {
    method getCode (line 15) | public int getCode() {
    method setCode (line 19) | protected HttpResponse<T> setCode(int code) {
    method getMessage (line 24) | public String getMessage() {
    method setMessage (line 28) | public HttpResponse<T> setMessage(String message) {
    method getRequestId (line 33) | public String getRequestId() {
    method setRequestId (line 37) | public HttpResponse<T> setRequestId(String requestId) {
    method getHeaders (line 42) | public Map<String, String> getHeaders() {
    method setHeaders (line 46) | protected HttpResponse<T> setHeaders(Map<String, String> headers) {
    method getBody (line 51) | public T getBody() {
    method setBody (line 55) | protected HttpResponse<T> setBody(T body) {
    method getStringBody (line 60) | public String getStringBody() {
    method setStringBody (line 64) | protected HttpResponse<T> setStringBody(String stringBody) {

FILE: java/src/main/java/com/baidubce/appbuilder/base/utils/iterator/StreamIterator.java
  class StreamIterator (line 14) | public class StreamIterator<T> implements Iterator<T>, AutoCloseable {
    method StreamIterator (line 21) | public StreamIterator(CloseableHttpResponse resp, Type type, HttpUriRe...
    method hasNext (line 28) | @Override
    method next (line 48) | @Override
    method close (line 61) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/base/utils/json/JsonUtils.java
  class JsonUtils (line 8) | public class JsonUtils {
    method serialize (line 11) | public static String serialize(Object object) {
    method deserialize (line 15) | public static <T> T deserialize(String json, Type type) {

FILE: java/src/main/java/com/baidubce/appbuilder/console/agentbuilder/AgentBuilder.java
  class AgentBuilder (line 23) | public class AgentBuilder extends Component {
    method AgentBuilder (line 26) | @Deprecated
    method AgentBuilder (line 32) | @Deprecated
    method AgentBuilder (line 38) | @Deprecated
    method createConversation (line 51) | public String createConversation() throws IOException, AppBuilderServe...
    method uploadLocalFile (line 76) | public String uploadLocalFile(String conversationId, String filePath) ...
    method run (line 107) | public AgentBuilderIterator run(String query, String conversationId, S...

FILE: java/src/main/java/com/baidubce/appbuilder/console/aisearch/AISearch.java
  class AISearch (line 17) | public class AISearch extends Component {
    method AISearch (line 18) | public AISearch() {
    method AISearch (line 22) | public AISearch(String secretKey) {
    method AISearch (line 26) | public AISearch(String secretKey, String gateway) {
    method run (line 31) | public AISearchIterator run(AISearchRequest request)

FILE: java/src/main/java/com/baidubce/appbuilder/console/appbuilderclient/App.java
  class App (line 17) | public class App extends Component {
    method App (line 18) | public App() {
    method describeApp (line 30) | public AppDescribeResponse describeApp(String appId)

FILE: java/src/main/java/com/baidubce/appbuilder/console/appbuilderclient/AppBuilderClient.java
  class AppBuilderClient (line 21) | public class AppBuilderClient extends Component {
    method AppBuilderClient (line 24) | public AppBuilderClient(String appID) {
    method AppBuilderClient (line 29) | public AppBuilderClient(String appID, String secretKey) {
    method AppBuilderClient (line 34) | public AppBuilderClient(String appID, String secretKey, String gateway) {
    method createConversation (line 46) | public String createConversation() throws IOException, AppBuilderServe...
    method innerCreateConversation (line 50) | private String innerCreateConversation() throws IOException, AppBuilde...
    method uploadLocalFile (line 77) | public String uploadLocalFile(String conversationId, String filePath)
    method uploadFile (line 82) | public String uploadFile(String conversationId, String filePath, Strin...
    method innerUploadLocalFile (line 87) | private String innerUploadLocalFile(String conversationId, String file...
    method run (line 124) | public AppBuilderClientIterator run(String query, String conversationI...
    method run (line 153) | public AppBuilderClientIterator run(AppBuilderClientRunRequest request...
    method feedback (line 177) | public AppBuilderClientFeedbackResponse feedback(AppBuilderClientFeedb...

FILE: java/src/main/java/com/baidubce/appbuilder/console/appbuilderclient/AppList.java
  class AppList (line 21) | public class AppList extends Component {
    method AppList (line 22) | public AppList() {
    method getAppList (line 36) | @Deprecated
    method describeApps (line 55) | public AppsDescribeResponse describeApps(AppsDescribeRequest request)

FILE: java/src/main/java/com/baidubce/appbuilder/console/componentclient/ComponentClient.java
  class ComponentClient (line 21) | public class ComponentClient extends Component {
    method ComponentClient (line 22) | public ComponentClient() {
    method ComponentClient (line 26) | public ComponentClient(String secretKey) {
    method ComponentClient (line 30) | public ComponentClient(String secretKey, String gateway) {
    method run (line 47) | public ComponentClientIterator run(String componentId, String version,...

FILE: java/src/main/java/com/baidubce/appbuilder/console/dataset/Dataset.java
  class Dataset (line 20) | public class Dataset extends Component {
    method Dataset (line 23) | @Deprecated
    method Dataset (line 28) | @Deprecated
    method Dataset (line 33) | @Deprecated
    method setDatasetId (line 39) | public void setDatasetId(String datasetId) {
    method createDataset (line 51) | public String createDataset(String datasetName) throws IOException, Ap...
    method uploadDocument (line 77) | private String uploadDocument(String filePath) throws IOException, App...
    method addDocuments (line 105) | public String[] addDocuments(List<String> filePaths, boolean isCustomP...
    method getDocumentList (line 146) | public DocumentListResponse getDocumentList(int page, int limit, Strin...
    method deleteDocument (line 175) | public void deleteDocument(String documentId) throws IOException, AppB...
    method deleteDocuments (line 201) | public void deleteDocuments(String[] documentIds) throws IOException, ...

FILE: java/src/main/java/com/baidubce/appbuilder/console/knowledgebase/Knowledgebase.java
  class Knowledgebase (line 19) | public class Knowledgebase extends Component {
    method Knowledgebase (line 22) | public Knowledgebase() {
    method Knowledgebase (line 26) | public Knowledgebase(String SecretKey) {
    method Knowledgebase (line 30) | public Knowledgebase(String knowledgeBaseId, String SecretKey) {
    method uploadFile (line 43) | @Deprecated
    method uploadFile (line 57) | @Deprecated
    method innerUploadFile (line 71) | private String innerUploadFile(String filePath, String clientToken) th...
    method addDocument (line 98) | @Deprecated
    method addDocument (line 113) | @Deprecated
    method innerAddDocument (line 128) | private String[] innerAddDocument(DocumentAddRequest req, String clien...
    method getDocumentList (line 154) | @Deprecated
    method describeDocuments (line 166) | public DocumentsDescribeResponse describeDocuments(DocumentsDescribeRe...
    method deleteDocument (line 190) | public void deleteDocument(DocumentDeleteRequest request)
    method deleteDocument (line 203) | public void deleteDocument(DocumentDeleteRequest request, String clien...
    method innerDeleteDocument (line 216) | private void innerDeleteDocument(DocumentDeleteRequest request, String...
    method createKnowledgeBase (line 238) | public KnowledgeBaseDetail createKnowledgeBase(KnowledgeBaseDetail req...
    method createKnowledgeBase (line 252) | public KnowledgeBaseDetail createKnowledgeBase(KnowledgeBaseDetail req...
    method innerCreateKnowledgeBase (line 266) | private KnowledgeBaseDetail innerCreateKnowledgeBase(KnowledgeBaseDeta...
    method getKnowledgeBaseDetail (line 287) | public KnowledgeBaseDetail getKnowledgeBaseDetail(String knowledgeBaseId)
    method deleteKnowledgeBase (line 309) | public void deleteKnowledgeBase(String knowledgeBaseId)
    method deleteKnowledgeBase (line 322) | public void deleteKnowledgeBase(String knowledgeBaseId, String clientT...
    method innerDeleteKnowledgeBase (line 335) | private void innerDeleteKnowledgeBase(String knowledgeBaseId, String c...
    method modifyKnowledgeBase (line 356) | public void modifyKnowledgeBase(KnowledgeBaseModifyRequest request)
    method modifyKnowledgeBase (line 369) | public void modifyKnowledgeBase(KnowledgeBaseModifyRequest request, St...
    method innerModifyKnowledgeBase (line 382) | private void innerModifyKnowledgeBase(KnowledgeBaseModifyRequest reque...
    method getKnowledgeBaseList (line 402) | public KnowledgeBaseListResponse getKnowledgeBaseList(KnowledgeBaseLis...
    method createDocuments (line 424) | public DocumentsCreateResponse createDocuments(DocumentsCreateRequest ...
    method createDocuments (line 438) | public DocumentsCreateResponse createDocuments(DocumentsCreateRequest ...
    method innerCreateDocuments (line 452) | private DocumentsCreateResponse innerCreateDocuments(DocumentsCreateRe...
    method uploadDocuments (line 478) | public DocumentsUploadResponse uploadDocuments(String filePath, Docume...
    method uploadDocuments (line 493) | public DocumentsUploadResponse uploadDocuments(String filePath, Docume...
    method innerUploadDocuments (line 508) | private DocumentsUploadResponse innerUploadDocuments(String filePath, ...
    method createChunk (line 536) | public String createChunk(String documentId, String content)
    method createChunk (line 551) | public String createChunk(String documentId, String content, String cl...
    method innerCreateChunk (line 566) | private String innerCreateChunk(String documentId, String content, Str...
    method modifyChunk (line 596) | public void modifyChunk(String chunkId, String content, boolean enable)
    method modifyChunk (line 611) | public void modifyChunk(String chunkId, String content, boolean enable...
    method innerModifyChunk (line 626) | private void innerModifyChunk(String chunkId, String content, boolean ...
    method deleteChunk (line 651) | public void deleteChunk(String chunkId) throws IOException, AppBuilder...
    method deleteChunk (line 663) | public void deleteChunk(String chunkId, String clientToken) throws IOE...
    method innderDeleteChunk (line 675) | private void innderDeleteChunk(String chunkId, String clientToken) thr...
    method describeChunk (line 699) | public ChunkDescribeResponse describeChunk(String chunkId)
    method describeChunks (line 728) | public ChunksDescribeResponse describeChunks(String documentId, String...
    method describeChunks (line 745) | public ChunksDescribeResponse describeChunks(ChunksDescribeRequest req...
    method queryKnowledgeBase (line 761) | public QueryKnowledgeBaseResponse queryKnowledgeBase(QueryKnowledgeBas...
    method queryKnowledgeBase (line 778) | public QueryKnowledgeBaseResponse queryKnowledgeBase(String query, Str...
    method queryKnowledgeBase (line 797) | public QueryKnowledgeBaseResponse queryKnowledgeBase(String query, Str...

FILE: java/src/main/java/com/baidubce/appbuilder/console/rag/RAG.java
  class RAG (line 19) | public class RAG extends Component {
    method RAG (line 22) | public RAG(String appID) {
    method RAG (line 27) | public RAG(String appID, String secretKey) {
    method RAG (line 32) | public RAG(String appID, String secretKey, String gateway) {
    method run (line 47) | public RAGIterator run(String query, String conversationId, boolean st...

FILE: java/src/main/java/com/baidubce/appbuilder/model/agentbuilder/AgentBuilderIterator.java
  class AgentBuilderIterator (line 6) | public class AgentBuilderIterator {
    method AgentBuilderIterator (line 9) | public AgentBuilderIterator(StreamIterator<AgentBuilderResponse> itera...
    method hasNext (line 13) | public boolean hasNext() {
    method next (line 17) | public AgentBuilderResult next() {
    method close (line 35) | public void close(){

FILE: java/src/main/java/com/baidubce/appbuilder/model/agentbuilder/AgentBuilderResponse.java
  class AgentBuilderResponse (line 7) | public class AgentBuilderResponse {
    method getRequestId (line 20) | public String getRequestId() {
    method setRequestId (line 24) | public void setRequestId(String requestId) {
    method getData (line 28) | public String getData() {
    method setData (line 32) | public void setData(String data) {
    method getAnswer (line 36) | public String getAnswer() {
    method setAnswer (line 40) | public void setAnswer(String answer) {
    method getConversationId (line 44) | public String getConversationId() {
    method setConversationId (line 48) | public void setConversationId(String conversationId) {
    method getMessageId (line 52) | public String getMessageId() {
    method setMessageId (line 56) | public void setMessageId(String messageId) {
    method isCompletion (line 60) | public boolean isCompletion() {
    method setCompletion (line 64) | public void setCompletion(boolean completion) {
    method getContent (line 68) | public EventContent[] getContent() {
    method setContent (line 72) | public void setContent(EventContent[] content) {
    method toString (line 76) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/agentbuilder/AgentBuilderResult.java
  class AgentBuilderResult (line 6) | public class AgentBuilderResult {
    method getAnswer (line 10) | public String getAnswer() {
    method setAnswer (line 14) | public AgentBuilderResult setAnswer(String answer) {
    method getEvents (line 19) | public Event[] getEvents() {
    method setEvents (line 23) | public AgentBuilderResult setEvents(Event[] events) {
    method toString (line 28) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/agentbuilder/ConversationResponse.java
  class ConversationResponse (line 5) | public class ConversationResponse {
    method getRequestId (line 11) | public String getRequestId() {
    method setRequestId (line 15) | public void setRequestId(String requestId) {
    method getConversationId (line 19) | public String getConversationId() {
    method setConversationId (line 23) | public void setConversationId(String conversationId) {
    method toString (line 27) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/agentbuilder/Event.java
  class Event (line 5) | public class Event {
    method getCode (line 13) | public String getCode() {
    method setCode (line 17) | public Event setCode(String code) {
    method getMessage (line 22) | public String getMessage() {
    method setMessage (line 26) | public Event setMessage(String message) {
    method getEventType (line 31) | public String getEventType() {
    method setEventType (line 35) | public Event setEventType(String eventType) {
    method getStatus (line 40) | public String getStatus() {
    method setStatus (line 44) | public Event setStatus(String status) {
    method getContentType (line 49) | public String getContentType() {
    method setContentType (line 53) | public Event setContentType(String contentType) {
    method getDetail (line 58) | public Map<String, Object> getDetail() {
    method setDetail (line 62) | public Event setDetail(Map<String, Object> detail) {
    method toString (line 67) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/agentbuilder/EventContent.java
  class EventContent (line 8) | public class EventContent {
    method getEventCode (line 23) | public String getEventCode() {
    method setEventCode (line 27) | public void setEventCode(String eventCode) {
    method getEnentMessage (line 31) | public String getEnentMessage() {
    method setEnentMessage (line 35) | public void setEnentMessage(String enentMessage) {
    method getEventType (line 39) | public String getEventType() {
    method setEventType (line 43) | public void setEventType(String eventType) {
    method getEventId (line 47) | public String getEventId() {
    method setEventId (line 51) | public void setEventId(String eventId) {
    method getEventStatus (line 55) | public String getEventStatus() {
    method setEventStatus (line 59) | public void setEventStatus(String eventStatus) {
    method getContentType (line 63) | public String getContentType() {
    method setContentType (line 67) | public void setContentType(String contentType) {
    method getOutputs (line 71) | public Map<String, Object> getOutputs() {
    method setOutputs (line 75) | public void setOutputs(Map<String, Object> outputs) {
    method toString (line 79) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/agentbuilder/FileUploadResponse.java
  class FileUploadResponse (line 5) | public class FileUploadResponse {
    method getRequestId (line 12) | public String getRequestId() {
    method setRequestId (line 16) | public void setRequestId(String requestId) {
    method getFileId (line 20) | public String getFileId() {
    method toString (line 24) | @Override
    method setFileId (line 33) | public void setFileId(String fileId) {
    method getConversationId (line 37) | public String getConversationId() {
    method setConversationId (line 41) | public void setConversationId(String conversationId) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/aisearch/AISearchIterator.java
  class AISearchIterator (line 5) | public class AISearchIterator {
    method AISearchIterator (line 8) | public AISearchIterator(StreamIterator<AISearchResponse> iterator) {
    method hasNext (line 12) | public boolean hasNext() {
    method next (line 16) | public AISearchResponse next() {
    method close (line 20) | public void close(){

FILE: java/src/main/java/com/baidubce/appbuilder/model/aisearch/AISearchRequest.java
  class AISearchRequest (line 5) | public class AISearchRequest {
    class Message (line 56) | public static class Message {
      method Message (line 63) | public Message(String role, Object content) {
      method setRole (line 68) | public void setRole(String role) {
      method setContent (line 72) | public void setContent(Object content) {
      method getRole (line 76) | public String getRole() {
      method getContent (line 80) | public Object getContent() {
    class SearchResource (line 85) | public static class SearchResource {
      method SearchResource (line 92) | public SearchResource(int topK, String type) {
      method getTopK (line 97) | public int getTopK() {
      method getType (line 101) | public String getType() {
      method setTopK (line 105) | public void setTopK(int topK) {
      method setType (line 109) | public void setType(String type) {
    class SearchFilter (line 114) | public static class SearchFilter {
      method SearchFilter (line 121) | public SearchFilter(Range range, Match match) {
      method getRange (line 126) | public Range getRange() {
      method getMatch (line 130) | public Match getMatch() {
      method setRange (line 134) | public void setRange(Range range) {
      method setMatch (line 138) | public void setMatch(Match match) {
    class Range (line 143) | public static class Range {
      method Range (line 147) | public Range(PageTime pageTime) {
      method getPageTime (line 151) | public PageTime getPageTime() {
      method setPageTime (line 155) | public void setPageTime(PageTime pageTime) {
    class PageTime (line 160) | public static class PageTime {
      method PageTime (line 170) | public PageTime(String gth, String gt, String lth, String lt) {
      method getGth (line 178) | public String getGth() {
      method getGt (line 182) | public String getGt() {
      method getLth (line 186) | public String getLth() {
      method getLt (line 190) | public String getLt() {
      method setGth (line 194) | public void setGth(String gth) {
      method setGt (line 198) | public void setGt(String gt) {
      method setLth (line 202) | public void setLth(String lth) {
      method setLt (line 206) | public void setLt(String lt) {
    class Match (line 211) | public static class Match {
      method Match (line 215) | public Match(String[] site) {
      method getSite (line 219) | public String[] getSite() {
      method setSite (line 223) | public void setSite(String[] site) {
    class Knowledge (line 228) | public static class Knowledge {
      method Knowledge (line 238) | public Knowledge(Integer priority, String dataType, KnowledgeData da...
      method getPriority (line 244) | public Integer getPriority() {
      method getDataType (line 248) | public String getDataType() {
      method getData (line 252) | public KnowledgeData getData() {
      method setPriority (line 256) | public void setPriority(Integer priority) {
      method setDataType (line 260) | public void setDataType(String dataType) {
      method setData (line 264) | public void setData(KnowledgeData data) {
    class KnowledgeData (line 269) | public static class KnowledgeData {
      method KnowledgeData (line 282) | public KnowledgeData(String content, String title, String url, Strin...
      method getContent (line 289) | public String getContent() {
      method getTitle (line 293) | public String getTitle() {
      method getUrl (line 297) | public String getUrl() {
      method getReleaseDate (line 301) | public String getReleaseDate() {
      method setContent (line 305) | public void setContent(String content) {
      method setTitle (line 309) | public void setTitle(String title) {
      method setUrl (line 313) | public void setUrl(String url) {
      method setReleaseDate (line 317) | public void setReleaseDate(String releaseDate) {
    method getMessages (line 323) | public Message[] getMessages() {
    method setMessages (line 327) | public AISearchRequest setMessages(Message[] messages) {
    method getSearchSource (line 332) | public String getSearchSource() {
    method setSearchSource (line 336) | public AISearchRequest setSearchSource(String searchSource) {
    method getResourceTypeFilter (line 341) | public SearchResource[] getResourceTypeFilter() {
    method setResourceTypeFilter (line 345) | public AISearchRequest setResourceTypeFilter(SearchResource[] resource...
    method getSearchFilter (line 350) | public SearchFilter getSearchFilter() {
    method setSearchFilter (line 354) | public AISearchRequest setSearchFilter(SearchFilter searchFilter) {
    method getSearchRecencyFilter (line 359) | public String getSearchRecencyFilter() {
    method setSearchRecencyFilter (line 363) | public AISearchRequest setSearchRecencyFilter(String searchRecencyFilt...
    method getSearchDomainFilter (line 368) | public String[] getSearchDomainFilter() {
    method setSearchDomainFilter (line 372) | public AISearchRequest setSearchDomainFilter(String[] searchDomainFilt...
    method getModel (line 377) | public String getModel() {
    method setModel (line 381) | public AISearchRequest setModel(String model) {
    method getInstruction (line 386) | public String getInstruction() {
    method setInstruction (line 390) | public AISearchRequest setInstruction(String instruction) {
    method getTemperature (line 395) | public Double getTemperature() {
    method setTemperature (line 399) | public AISearchRequest setTemperature(Double temperature) {
    method getTopP (line 404) | public Double getTopP() {
    method setTopP (line 408) | public AISearchRequest setTopP(Double topP) {
    method getPromptTemplate (line 413) | public String getPromptTemplate() {
    method setPromptTemplate (line 417) | public AISearchRequest setPromptTemplate(String promptTemplate) {
    method getSearchMode (line 422) | public String getSearchMode() {
    method setSearchMode (line 426) | public AISearchRequest setSearchMode(String searchMode) {
    method getEnableReasoning (line 431) | public Boolean getEnableReasoning() {
    method setEnableReasoning (line 435) | public AISearchRequest setEnableReasoning(Boolean enableReasoning) {
    method getEnableDeepSearch (line 440) | public Boolean getEnableDeepSearch() {
    method setEnableDeepSearch (line 444) | public AISearchRequest setEnableDeepSearch(Boolean enableDeepSearch) {
    method getAdditionalKnowledge (line 449) | public Knowledge[] getAdditionalKnowledge() {
    method setAdditionalKnowledge (line 453) | public AISearchRequest setAdditionalKnowledge(Knowledge[] additionalKn...
    method getMaxCompletionTokens (line 458) | public Integer getMaxCompletionTokens() {
    method setMaxCompletionTokens (line 462) | public AISearchRequest setMaxCompletionTokens(Integer maxCompletionTok...
    method getResponseFormat (line 467) | public String getResponseFormat() {
    method setResponseFormat (line 471) | public AISearchRequest setResponseFormat(String responseFormat) {
    method getEnableCornerMarkers (line 476) | public Boolean getEnableCornerMarkers() {
    method setEnableCornerMarkers (line 480) | public AISearchRequest setEnableCornerMarkers(Boolean enableCornerMark...
    method getEnableFollowupQueries (line 485) | public Boolean getEnableFollowupQueries() {
    method setEnableFollowupQueries (line 489) | public AISearchRequest setEnableFollowupQueries(Boolean enableFollowup...
    method getStream (line 494) | public Boolean getStream() {
    method setStream (line 498) | public AISearchRequest setStream(Boolean stream) {
    method getSafetyLevel (line 503) | public String getSafetyLevel() {
    method setSafetyLevel (line 507) | public AISearchRequest setSafetyLevel(String safetyLevel) {
    method getMaxReferSearchItems (line 512) | public Integer getMaxReferSearchItems() {
    method setMaxReferSearchItems (line 516) | public AISearchRequest setMaxReferSearchItems(Integer maxReferSearchIt...
    method getConfigId (line 521) | public String getConfigId() {
    method setConfigId (line 525) | public AISearchRequest setConfigId(String configId) {
    method getModelAppid (line 530) | public String getModelAppid() {
    method setModelAppid (line 534) | public AISearchRequest setModelAppid(String modelAppid) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/aisearch/AISearchResponse.java
  class AISearchResponse (line 6) | public class AISearchResponse {
    method getRequestId (line 26) | public String getRequestId() {
    method setRequestId (line 30) | public AISearchResponse setRequestId(String requestId) {
    method getIsSafe (line 35) | public Boolean getIsSafe() {
    method setIsSafe (line 39) | public AISearchResponse setIsSafe(Boolean isSafe) {
    method getChoices (line 44) | public List<Choice> getChoices() {
    method setChoices (line 48) | public AISearchResponse setChoices(List<Choice> choices) {
    method getCode (line 53) | public String getCode() {
    method setCode (line 57) | public AISearchResponse setCode(String code) {
    method getMessage (line 62) | public String getMessage() {
    method setMessage (line 66) | public AISearchResponse setMessage(String message) {
    method getUsage (line 71) | public Usage getUsage() {
    method setUsage (line 75) | public AISearchResponse setUsage(Usage usage) {
    method getReferences (line 80) | public List<Reference> getReferences() {
    method setReferences (line 84) | public AISearchResponse setReferences(List<Reference> references) {
    method getFollowupQueries (line 89) | public List<String> getFollowupQueries() {
    method setFollowupQueries (line 93) | public AISearchResponse setFollowupQueries(List<String> followupQuerie...
    class Usage (line 99) | public static class Usage {
      method getCompletionTokens (line 109) | public Integer getCompletionTokens() {
      method setCompletionTokens (line 113) | public Usage setCompletionTokens(Integer completionTokens) {
      method getPromptTokens (line 118) | public Integer getPromptTokens() {
      method setPromptTokens (line 122) | public Usage setPromptTokens(Integer promptTokens) {
      method getTotalTokens (line 127) | public Integer getTotalTokens() {
      method setTotalTokens (line 131) | public Usage setTotalTokens(Integer totalTokens) {
    class VideoDetail (line 137) | public static class VideoDetail {
      method getUrl (line 147) | public String getUrl() {
      method setUrl (line 151) | public VideoDetail setUrl(String url) {
      method getHeight (line 156) | public String getHeight() {
      method setHeight (line 160) | public VideoDetail setHeight(String height) {
      method getWidth (line 165) | public String getWidth() {
      method setWidth (line 169) | public VideoDetail setWidth(String width) {
      method getSize (line 174) | public String getSize() {
      method setSize (line 178) | public VideoDetail setSize(String size) {
      method getDuration (line 183) | public String getDuration() {
      method setDuration (line 187) | public VideoDetail setDuration(String duration) {
      method getHoverPic (line 192) | @SerializedName("hover_pic")
      method setHoverPic (line 197) | public VideoDetail setHoverPic(String hoverPic) {
    class ImageDetail (line 203) | public static class ImageDetail {
      method getUrl (line 208) | public String getUrl() {
      method setUrl (line 212) | public ImageDetail setUrl(String url) {
      method getHeight (line 217) | public String getHeight() {
      method setHeight (line 221) | public ImageDetail setHeight(String height) {
      method getWidth (line 226) | public String getWidth() {
      method setWidth (line 230) | public ImageDetail setWidth(String width) {
    class Reference (line 236) | public static class Reference {
      method getId (line 253) | public Integer getId() {
      method setId (line 257) | public Reference setId(Integer id) {
      method getTitle (line 262) | public String getTitle() {
      method setTitle (line 266) | public Reference setTitle(String title) {
      method getUrl (line 271) | public String getUrl() {
      method setUrl (line 275) | public Reference setUrl(String url) {
      method getWebAnchor (line 280) | public String getWebAnchor() {
      method setWebAnchor (line 284) | public Reference setWebAnchor(String webAnchor) {
      method getIcon (line 289) | public String getIcon() {
      method setIcon (line 293) | public Reference setIcon(String icon) {
      method getContent (line 298) | public String getContent() {
      method setContent (line 302) | public Reference setContent(String content) {
      method getDate (line 307) | public String getDate() {
      method setDate (line 311) | public Reference setDate(String date) {
      method getType (line 316) | public String getType() {
      method setType (line 320) | public Reference setType(String type) {
      method getImage (line 325) | public ImageDetail getImage() {
      method setImage (line 329) | public Reference setImage(ImageDetail image) {
      method getVideo (line 334) | public VideoDetail getVideo() {
      method setVideo (line 338) | public Reference setVideo(VideoDetail video) {
    class Delta (line 344) | public static class Delta {
      method setContent (line 353) | public Delta setContent(String content) {
      method getContent (line 358) | public String getContent() {
      method getRole (line 362) | public String getRole() {
      method setRole (line 366) | public Delta setRole(String role) {
      method getReasoningContent (line 371) | public String getReasoningContent() {
      method setReasoningContent (line 375) | public Delta setReasoningContent(String reasoningContent) {
    class ChoiceMessage (line 381) | public static class ChoiceMessage {
      method getContent (line 389) | public String getContent() {
      method setContent (line 393) | public ChoiceMessage setContent(String content) {
      method getRole (line 398) | public String getRole() {
      method setRole (line 402) | public ChoiceMessage setRole(String role) {
      method getReasoningContent (line 407) | public String getReasoningContent() {
      method setReasoningContent (line 411) | public ChoiceMessage setReasoningContent(String reasoningContent) {
    class Choice (line 417) | public static class Choice {
      method getIndex (line 426) | public int getIndex() {
      method setIndex (line 430) | public Choice setIndex(int index) {
      method getFinishReason (line 435) | public String getFinishReason() {
      method setFinishReason (line 439) | public Choice setFinishReason(String finishReason) {
      method getMessage (line 444) | public ChoiceMessage getMessage() {
      method setMessage (line 448) | public Choice setMessage(ChoiceMessage message) {
      method getDelta (line 453) | public Delta getDelta() {
      method setDelta (line 457) | public Choice setDelta(Delta delta) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/App.java
  class App (line 3) | public class App {
    method getId (line 12) | public String getId() {
    method getName (line 16) | public String getName() {
    method getDescription (line 20) | public String getDescription() {
    method setId (line 25) | public void setId(String id) {
    method setName (line 29) | public void setName(String name) {
    method setDescription (line 33) | public void setDescription(String description) {
    method getAppType (line 37) | public String getAppType() {
    method setAppType (line 41) | public void setAppType(String appType) {
    method isPublic (line 45) | public boolean isPublic() {
    method setPublic (line 49) | public void setPublic(boolean aPublic) {
    method getUpdateTime (line 53) | public Integer getUpdateTime() {
    method setUpdateTime (line 57) | public void setUpdateTime(Integer updateTime) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/AppBuilderClientFeedbackRequest.java
  class AppBuilderClientFeedbackRequest (line 5) | public class AppBuilderClientFeedbackRequest {
    method AppBuilderClientFeedbackRequest (line 16) | public AppBuilderClientFeedbackRequest(String appId, String conversati...
    method getAppId (line 26) | public String getAppId() {
    method setAppId (line 30) | public void setAppId(String appId) {
    method getConversationId (line 34) | public String getConversationId() {
    method setConversationId (line 38) | public void setConversationId(String conversationId) {
    method getMessageId (line 42) | public String getMessageId() {
    method setMessageId (line 46) | public void setMessageId(String messageId) {
    method getType (line 50) | public String getType() {
    method setType (line 54) | public void setType(String type) {
    method getFlag (line 58) | public String[] getFlag() {
    method setFlag (line 62) | public void setFlag(String[] flag) {
    method getReason (line 66) | public String getReason() {
    method setReason (line 70) | public void setReason(String reason) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/AppBuilderClientFeedbackResponse.java
  class AppBuilderClientFeedbackResponse (line 5) | public class AppBuilderClientFeedbackResponse {
    method getRequestId (line 11) | public String getRequestId() {
    method setRequestId (line 15) | public void setRequestId(String requestId) {
    method getCode (line 19) | public String getCode() {
    method setCode (line 23) | public void setCode(String code) {
    method getMessage (line 27) | public String getMessage() {
    method setMessage (line 31) | public void setMessage(String message) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/AppBuilderClientIterator.java
  class AppBuilderClientIterator (line 6) | public class AppBuilderClientIterator {
    method AppBuilderClientIterator (line 9) | public AppBuilderClientIterator(StreamIterator<AppBuilderClientRespons...
    method hasNext (line 13) | public boolean hasNext() {
    method next (line 17) | public AppBuilderClientResult next() {
    method close (line 36) | public void close() {

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/AppBuilderClientResponse.java
  class AppBuilderClientResponse (line 7) | public class AppBuilderClientResponse {
    method getRequestId (line 23) | public String getRequestId() {
    method setRequestId (line 27) | public void setRequestId(String requestId) {
    method getData (line 31) | public String getData() {
    method setData (line 35) | public void setData(String data) {
    method getAnswer (line 39) | public String getAnswer() {
    method setAnswer (line 43) | public void setAnswer(String answer) {
    method getConversationId (line 47) | public String getConversationId() {
    method setConversationId (line 51) | public void setConversationId(String conversationId) {
    method getMessageId (line 55) | public String getMessageId() {
    method setMessageId (line 59) | public void setMessageId(String messageId) {
    method isCompletion (line 63) | public boolean isCompletion() {
    method setCompletion (line 67) | public void setCompletion(boolean completion) {
    method getContent (line 71) | public EventContent[] getContent() {
    method setContent (line 75) | public void setContent(EventContent[] content) {
    method getDate (line 79) | public String getDate() {
    method setDate (line 83) | public void setDate(String date) {
    method getCode (line 87) | public String getCode() {
    method setCode (line 91) | public void setCode(String code) {
    method getMessage (line 95) | public String getMessage() {
    method setMessage (line 99) | public void setMessage(String message) {
    method toString (line 103) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/AppBuilderClientResult.java
  class AppBuilderClientResult (line 8) | public class AppBuilderClientResult {
    method getAnswer (line 18) | public String getAnswer() {
    method setAnswer (line 22) | public AppBuilderClientResult setAnswer(String answer) {
    method getRequestId (line 27) | public String getRequestId() {
    method setRequestId (line 31) | public AppBuilderClientResult setRequestId(String requestId) {
    method getMessageId (line 36) | public String getMessageId() {
    method setMessageId (line 40) | public AppBuilderClientResult setMessageId(String messageId) {
    method getEvents (line 45) | public Event[] getEvents() {
    method setEvents (line 49) | public AppBuilderClientResult setEvents(Event[] events) {
    method getCode (line 55) | public String getCode() {
    method setCode (line 59) | public AppBuilderClientResult setCode(String code) {
    method getMessage (line 64) | public String getMessage() {
    method setMessage (line 68) | public AppBuilderClientResult setMessage(String message) {
    method toString (line 73) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/AppBuilderClientRunRequest.java
  class AppBuilderClientRunRequest (line 9) | public class AppBuilderClientRunRequest {
    method AppBuilderClientRunRequest (line 32) | public AppBuilderClientRunRequest() {
    method AppBuilderClientRunRequest (line 35) | public AppBuilderClientRunRequest(String appID) {
    method AppBuilderClientRunRequest (line 39) | public AppBuilderClientRunRequest(String appID, String conversationID) {
    method AppBuilderClientRunRequest (line 44) | public AppBuilderClientRunRequest(String appID, String conversationID,...
    method getAppId (line 51) | public String getAppId() {
    method setAppId (line 55) | public void setAppId(String appId) {
    method getQuery (line 59) | public String getQuery() {
    method setQuery (line 63) | public void setQuery(String query) {
    method isStream (line 67) | public boolean isStream() {
    method setStream (line 71) | public void setStream(boolean stream) {
    method getConversationID (line 75) | public String getConversationID() {
    method setConversationID (line 79) | public void setConversationID(String conversationID) {
    method getEndUserId (line 83) | public String getEndUserId() {
    method setEndUserId (line 87) | public void setEndUserId(String endUserId) {
    method getTools (line 91) | public Tool[] getTools() {
    method setTools (line 95) | public void setTools(Tool[] tools) {
    method setTools (line 99) | public void setTools(String toolJson) {
    method setTools (line 105) | public void setTools(String[] toolJsons) {
    method getToolOutputs (line 114) | public ToolOutput[] getToolOutputs() {
    method setToolOutputs (line 118) | public void setToolOutputs(ToolOutput[] toolOutputs) {
    method setToolOutputs (line 122) | public void setToolOutputs(String toolCallID, String outputString) {
    method getToolChoice (line 127) | public ToolChoice getToolChoice() {
    method setToolChoice (line 131) | public void setToolChoice(ToolChoice toolChoice) {
    method getAction (line 135) | public Action getAction() {
    method setAction (line 139) | public void setAction(Action action) {
    method setMcpAuthorization (line 143) | public AppBuilderClientRunRequest setMcpAuthorization(List<Map<String,...
    method getMcpAuthorization (line 148) | public List<Map<String, Object>> getMcpAuthorization() {
    method getParameters (line 152) | public Map<String, Object> getParameters() {
    method setParameters (line 156) | public void setParameters(Map<String, Object> parameters) {
    method setCustomMetadata (line 160) | public void setCustomMetadata(CustomMetadata customMetadata) {
    class Tool (line 164) | public static class Tool {
      method Tool (line 168) | public Tool(String type, Function function) {
      method getType (line 173) | public String getType() {
      method getFunction (line 177) | public Function getFunction() {
      class Function (line 182) | public static class Function {
        method Function (line 187) | public Function(String name, String description, Map<String, Objec...
        method getName (line 193) | public String getName() {
        method getDescription (line 197) | public String getDescription() {
        method getParameters (line 201) | public Map<String, Object> getParameters() {
    class ToolOutput (line 207) | public static class ToolOutput {
      method ToolOutput (line 212) | public ToolOutput(String toolCallID, String output) {
      method getToolCallID (line 217) | public String getToolCallID() {
      method getOutput (line 221) | public String getOutput() {
    class ToolChoice (line 226) | public static class ToolChoice {
      method ToolChoice (line 230) | public ToolChoice(String type, Function function) {
      method getType (line 235) | public String getType() {
      method getFunction (line 239) | public Function getFunction() {
      class Function (line 243) | public static class Function {
        method Function (line 247) | public Function(String name, Map<String, Object> input) {
        method getName (line 252) | public String getName() {
        method getInput (line 256) | public Map<String, Object> getInput() {
    class Action (line 262) | public static class Action {
      method createAction (line 268) | public static Action createAction(String interruptId) {
      method createAction (line 272) | public static Action createAction(String actionType, String id, Stri...
      method Action (line 278) | public Action(String actionType, Parameters parameters) {
      method getActionType (line 283) | public String getActionType() {
      method getParameters (line 287) | public Parameters getParameters() {
      class Parameters (line 291) | public static class Parameters {
        method Parameters (line 295) | public Parameters(InterruptEvent interruptEvent) {
        method getInterruptEvent (line 299) | public InterruptEvent getInterruptEvent() {
        class InterruptEvent (line 303) | public static class InterruptEvent {
          method InterruptEvent (line 307) | public InterruptEvent(String id, String type) {
          method getId (line 312) | public String getId() {
          method getType (line 316) | public String getType() {
    class CustomMetadata (line 323) | public static class CustomMetadata{
      method CustomMetadata (line 327) | public CustomMetadata(String overrideRoleInstruction) {
      method setOverrideRoleInstruction (line 331) | public void setOverrideRoleInstruction(String overrideRoleInstructio...
      method getOverrideRoleInstruction (line 335) | public String getOverrideRoleInstruction() {

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/AppDescribeRequest.java
  class AppDescribeRequest (line 3) | public class AppDescribeRequest {
    method getId (line 6) | public String getId() {
    method setId (line 10) | public void setId(String id) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/AppDescribeResponse.java
  class AppDescribeResponse (line 3) | public class AppDescribeResponse {
    method getRequestId (line 18) | public String getRequestId() {
    method setRequestId (line 22) | public void setRequestId(String requestId) {
    method getId (line 26) | public String getId() {
    method setId (line 30) | public void setId(String id) {
    method getName (line 34) | public String getName() {
    method setName (line 38) | public void setName(String name) {
    method getDescription (line 42) | public String getDescription() {
    method setDescription (line 46) | public void setDescription(String description) {
    method getInstruction (line 50) | public String getInstruction() {
    method setInstruction (line 54) | public void setInstruction(String instruction) {
    method getPrologue (line 58) | public String getPrologue() {
    method setPrologue (line 62) | public void setPrologue(String prologue) {
    method getExampleQueries (line 66) | public String[] getExampleQueries() {
    method setExampleQueries (line 70) | public void setExampleQueries(String[] exampleQueries) {
    method getFollowUpQueries (line 74) | public FollowUpQueries getFollowUpQueries() {
    method setFollowUpQueries (line 78) | public void setFollowUpQueries(FollowUpQueries followUpQueries) {
    method getComponents (line 82) | public Component[] getComponents() {
    method setComponents (line 86) | public void setComponents(Component[] components) {
    method getKnowledgeBaseConfig (line 90) | public KnowledgeBaseConfig getKnowledgeBaseConfig() {
    method setKnowledgeBaseConfig (line 94) | public void setKnowledgeBaseConfig(KnowledgeBaseConfig knowledgeBaseCo...
    method getModelConfig (line 98) | public ModelConfig getModelConfig() {
    method setModelConfig (line 102) | public void setModelConfig(ModelConfig modelConfig) {
    method getBackground (line 106) | public BackgroundConfig getBackground() {
    method setBackground (line 110) | public void setBackground(BackgroundConfig background) {
    class FollowUpQueries (line 114) | public static class FollowUpQueries {
      method getType (line 120) | public String getType() {
      method setType (line 124) | public void setType(String type) {
      method getPrompt (line 128) | public String getPrompt() {
      method setPrompt (line 132) | public void setPrompt(String prompt) {
      method getRound (line 136) | public String getRound() {
      method setRound (line 140) | public void setRound(String round) {
    class Component (line 145) | public static class Component {
      method getName (line 151) | public String getName() {
      method setName (line 155) | public void setName(String name) {
      method getDescription (line 159) | public String getDescription() {
      method setDescription (line 163) | public void setDescription(String description) {
      method getCustomDesc (line 167) | public String getCustomDesc() {
      method setCustomDesc (line 171) | public void setCustomDesc(String customDesc) {
    class KnowledgeBaseConfig (line 176) | public static class KnowledgeBaseConfig {
      method getKnowledgeBases (line 181) | public KnowledgeBase[] getKnowledgeBases() {
      method setKnowledgeBases (line 185) | public void setKnowledgeBases(KnowledgeBase[] knowledgeBases) {
      method getRetrieval (line 189) | public RetrievalConfig getRetrieval() {
      method setRetrieval (line 193) | public void setRetrieval(RetrievalConfig retrieval) {
      class KnowledgeBase (line 197) | public static class KnowledgeBase {
        method getId (line 203) | public String getId() {
        method setId (line 207) | public void setId(String id) {
        method getName (line 211) | public String getName() {
        method setName (line 215) | public void setName(String name) {
        method getDescription (line 219) | public String getDescription() {
        method setDescription (line 223) | public void setDescription(String description) {
      class RetrievalConfig (line 228) | public static class RetrievalConfig {
        method getEnableWebSearch (line 236) | public Boolean getEnableWebSearch() {
        method setEnableWebSearch (line 240) | public void setEnableWebSearch(Boolean enableWebSearch) {
        method getOrder (line 244) | public String getOrder() {
        method setOrder (line 248) | public void setOrder(String order) {
        method getStrategy (line 252) | public String getStrategy() {
        method setStrategy (line 256) | public void setStrategy(String strategy) {
        method getTopK (line 260) | public Integer getTopK() {
        method setTopK (line 264) | public void setTopK(Integer topK) {
        method getThreshold (line 268) | public Float getThreshold() {
        method setThreshold (line 272) | public void setThreshold(Float threshold) {
    class ModelConfig (line 278) | public static class ModelConfig {
      method getPlan (line 283) | public PlanConfig getPlan() {
      method setPlan (line 287) | public void setPlan(PlanConfig plan) {
      method getChat (line 291) | public ChatConfig getChat() {
      method setChat (line 295) | public void setChat(ChatConfig chat) {
      class PlanConfig (line 299) | public static class PlanConfig {
        method getModelId (line 306) | public String getModelId() {
        method setModelId (line 310) | public void setModelId(String modelId) {
        method getModel (line 314) | public String getModel() {
        method setModel (line 318) | public void setModel(String model) {
        method getMaxRounds (line 322) | public Integer getMaxRounds() {
        method setMaxRounds (line 326) | public void setMaxRounds(Integer maxRounds) {
        method getConfig (line 330) | public Config getConfig() {
        method setConfig (line 334) | public void setConfig(Config config) {
        class Config (line 338) | public static class Config {
          method getTemperature (line 343) | public Float getTemperature() {
          method setTemperature (line 347) | public void setTemperature(Float temperature) {
          method getTopP (line 351) | public Float getTopP() {
          method setTopP (line 355) | public void setTopP(Float topP) {
      class ChatConfig (line 361) | public static class ChatConfig {
        method getModelId (line 368) | public String getModelId() {
        method setModelId (line 372) | public void setModelId(String modelId) {
        method getModel (line 376) | public String getModel() {
        method setModel (line 380) | public void setModel(String model) {
        method getHistoryChatRounds (line 384) | public Integer getHistoryChatRounds() {
        method setHistoryChatRounds (line 388) | public void setHistoryChatRounds(Integer historyChatRounds) {
        method getConfig (line 392) | public Config getConfig() {
        method setConfig (line 396) | public void setConfig(Config config) {
        class Config (line 400) | public static class Config {
          method getTemperature (line 405) | public Float getTemperature() {
          method setTemperature (line 409) | public void setTemperature(Float temperature) {
          method getTopP (line 413) | public Float getTopP() {
          method setTopP (line 417) | public void setTopP(Float topP) {
    class BackgroundConfig (line 424) | public static class BackgroundConfig {
      method getId (line 431) | public String getId() {
      method setId (line 435) | public void setId(String id) {
      method getPath (line 439) | public String getPath() {
      method setPath (line 443) | public void setPath(String path) {
      method getMobileConfig (line 447) | public MobileConfig getMobileConfig() {
      method setMobileConfig (line 451) | public void setMobileConfig(MobileConfig mobileConfig) {
      method getPcConfig (line 455) | public PcConfig getPcConfig() {
      method setPcConfig (line 459) | public void setPcConfig(PcConfig pcConfig) {
      class MobileConfig (line 463) | public static class MobileConfig {
        method getLeft (line 470) | public String getLeft() {
        method setLeft (line 474) | public void setLeft(String left) {
        method getTop (line 478) | public String getTop() {
        method setTop (line 482) | public void setTop(String top) {
        method getHeight (line 486) | public String getHeight() {
        method setHeight (line 490) | public void setHeight(String height) {
        method getColor (line 494) | public String getColor() {
        method setColor (line 498) | public void setColor(String color) {
      class PcConfig (line 503) | public static class PcConfig {
        method getLeft (line 510) | public String getLeft() {
        method setLeft (line 514) | public void setLeft(String left) {
        method getTop (line 518) | public String getTop() {
        method setTop (line 522) | public void setTop(String top) {
        method getHeight (line 526) | public String getHeight() {
        method setHeight (line 530) | public void setHeight(String height) {
        method getColor (line 534) | public String getColor() {
        method setColor (line 538) | public void setColor(String color) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/AppListRequest.java
  class AppListRequest (line 6) | public class AppListRequest {
    method getLimit (line 12) | public int getLimit() {
    method setLimit (line 16) | public void setLimit(int limit) {
    method getAfter (line 20) | public String getAfter() {
    method setAfter (line 24) | public void setAfter(String after) {
    method getBefore (line 28) | public String getBefore() {
    method setBefore (line 32) | public void setBefore(String before) {
    method toMap (line 36) | public Map<String, Object> toMap() {

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/AppListResponse.java
  class AppListResponse (line 5) | public class AppListResponse {
    method getRequestId (line 12) | public String getRequestId() {
    method setRequestId (line 16) | public void setRequestId(String requestId) {
    method getData (line 20) | public App[] getData() {
    method setData (line 24) | public void setData(App[] data) {
    method getCode (line 28) | public String getCode() {
    method setCode (line 32) | public void setCode(String code) {
    method getMessage (line 36) | public String getMessage() {
    method setMessage (line 40) | public void setMessage(String message) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/AppsDescribeRequest.java
  class AppsDescribeRequest (line 3) | public class AppsDescribeRequest {
    method AppsDescribeRequest (line 7) | public AppsDescribeRequest(String marker, Integer maxKeys) {
    method AppsDescribeRequest (line 12) | public AppsDescribeRequest() {
    method AppsDescribeRequest (line 16) | public AppsDescribeRequest(Integer maxKeys) {
    method AppsDescribeRequest (line 20) | public AppsDescribeRequest(String marker) {
    method getMarker (line 24) | public String getMarker() {
    method getMaxKeys (line 28) | public Integer getMaxKeys() {

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/AppsDescribeResponse.java
  class AppsDescribeResponse (line 3) | public class AppsDescribeResponse {
    method getRequestId (line 11) | public String getRequestId() {
    method setRequestId (line 15) | public void setRequestId(String requestId) {
    method getMarker (line 19) | public String getMarker() {
    method setMarker (line 23) | public void setMarker(String marker) {
    method getIsTruncated (line 27) | public Boolean getIsTruncated() {
    method setIsTruncated (line 31) | public void setIsTruncated(Boolean isTruncated) {
    method getNextMarker (line 35) | public String getNextMarker() {
    method setNextMarker (line 39) | public void setNextMarker(String nextMarker) {
    method getMaxKeys (line 43) | public Integer getMaxKeys() {
    method setMaxKeys (line 47) | public void setMaxKeys(Integer maxKeys) {
    method getData (line 51) | public App[] getData() {
    method setData (line 55) | public void setData(App[] data) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/ConversationResponse.java
  class ConversationResponse (line 5) | public class ConversationResponse {
    method getRequestId (line 11) | public String getRequestId() {
    method setRequestId (line 15) | public void setRequestId(String requestId) {
    method getConversationId (line 19) | public String getConversationId() {
    method setConversationId (line 23) | public void setConversationId(String conversationId) {
    method toString (line 27) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/Event.java
  class Event (line 6) | public class Event {
    method getCode (line 20) | public String getCode() {
    method setCode (line 24) | public Event setCode(String code) {
    method getMessage (line 29) | public String getMessage() {
    method setMessage (line 33) | public Event setMessage(String message) {
    method getEventType (line 38) | public String getEventType() {
    method setEventType (line 42) | public Event setEventType(String eventType) {
    method getStatus (line 47) | public String getStatus() {
    method setStatus (line 51) | public Event setStatus(String status) {
    method getContentType (line 56) | public String getContentType() {
    method setContentType (line 60) | public Event setContentType(String contentType) {
    method getDetail (line 65) | public Map<String, Object> getDetail() {
    method setDetail (line 69) | public Event setDetail(Map<String, Object> detail) {
    method getUsage (line 74) | public Map<String, Object> getUsage() {
    method setUsage (line 78) | public Event setUsage(Map<String, Object> usage) {
    method getToolCalls (line 83) | public ToolCall[] getToolCalls() {
    method setToolCalls (line 87) | public Event setToolCalls(ToolCall[] toolCalls) {
    method toString (line 92) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/EventContent.java
  class EventContent (line 7) | public class EventContent {
    method getEventCode (line 38) | public String getEventCode() {
    method setEventCode (line 42) | public void setEventCode(String eventCode) {
    method getEnentMessage (line 46) | public String getEnentMessage() {
    method setEnentMessage (line 50) | public void setEnentMessage(String enentMessage) {
    method getEventType (line 54) | public String getEventType() {
    method setEventType (line 58) | public void setEventType(String eventType) {
    method getEventId (line 62) | public String getEventId() {
    method setEventId (line 66) | public void setEventId(String eventId) {
    method getEventStatus (line 70) | public String getEventStatus() {
    method setEventStatus (line 74) | public void setEventStatus(String eventStatus) {
    method getContentType (line 78) | public String getContentType() {
    method setContentType (line 82) | public void setContentType(String contentType) {
    method getOutputs (line 86) | public Map<String, Object> getOutputs() {
    method setOutputs (line 90) | public void setOutputs(Map<String, Object> outputs) {
    method getUsage (line 94) | public Map<String, Object> getUsage() {
    method setUsage (line 98) | public void setUsage(Map<String, Object> usage) {
    method getToolCalls (line 102) | public ToolCall[] getToolCalls() {
    method setToolCalls (line 106) | public void setToolCalls(ToolCall[] toolCalls) {
    method toString (line 110) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/FileUploadResponse.java
  class FileUploadResponse (line 5) | public class FileUploadResponse {
    method getRequestId (line 12) | public String getRequestId() {
    method setRequestId (line 16) | public void setRequestId(String requestId) {
    method getFileId (line 20) | public String getFileId() {
    method toString (line 24) | @Override
    method setFileId (line 33) | public void setFileId(String fileId) {
    method getConversationId (line 37) | public String getConversationId() {
    method setConversationId (line 41) | public void setConversationId(String conversationId) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/appbuilderclient/ToolCall.java
  class ToolCall (line 3) | public class ToolCall {
    method getId (line 7) | public String getId() {
    method setId (line 11) | public void setId(String id) {
    method getType (line 15) | public String getType() {
    method setType (line 19) | public void setType(String type) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/componentclient/ComponentClientIterator.java
  class ComponentClientIterator (line 6) | public class ComponentClientIterator {
    method ComponentClientIterator (line 9) | public ComponentClientIterator(StreamIterator<ComponentClientRunRespon...
    method hasNext (line 13) | public boolean hasNext() {
    method next (line 17) | public ComponentClientRunResponse next() {
    method close (line 21) | public void close(){

FILE: java/src/main/java/com/baidubce/appbuilder/model/componentclient/ComponentClientRunRequest.java
  class ComponentClientRunRequest (line 6) | public class ComponentClientRunRequest {
    method isStream (line 16) | public boolean isStream() {
    method setStream (line 20) | public void setStream(boolean stream) {
    method getParameters (line 24) | public Map<String, Object> getParameters() {
    method setParameters (line 28) | public void setParameters(Map<String, Object> parameters) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/componentclient/ComponentClientRunResponse.java
  class ComponentClientRunResponse (line 9) | public class ComponentClientRunResponse {
    method getRequestID (line 29) | public String getRequestID() {
    method setRequestID (line 33) | public void setRequestID(String requestID) {
    method getCode (line 37) | public String getCode() {
    method setCode (line 41) | public void setCode(String code) {
    method getMessage (line 45) | public String getMessage() {
    method setMessage (line 49) | public void setMessage(String message) {
    method getConversationID (line 53) | public String getConversationID() {
    method setConversationID (line 57) | public void setConversationID(String conversationID) {
    method getMessageID (line 61) | public String getMessageID() {
    method setMessageID (line 65) | public void setMessageID(String messageID) {
    method getTraceID (line 69) | public String getTraceID() {
    method setTraceID (line 73) | public void setTraceID(String traceID) {
    method getUserID (line 77) | public String getUserID() {
    method setUserID (line 81) | public void setUserID(String userID) {
    method getEndUserID (line 85) | public String getEndUserID() {
    method setEndUserID (line 89) | public void setEndUserID(String endUserID) {
    method getStatus (line 93) | public String getStatus() {
    method setStatus (line 97) | public void setStatus(String status) {
    method getRole (line 101) | public String getRole() {
    method setRole (line 105) | public void setRole(String role) {
    method getContent (line 109) | public Content[] getContent() {
    method setContent (line 113) | public void setContent(Content[] content) {
    class Content (line 117) | public static class Content {
      method getName (line 130) | public String getName() {
      method setName (line 134) | public void setName(String name) {
      method getVisibleScope (line 138) | public String getVisibleScope() {
      method setVisibleScope (line 142) | public void setVisibleScope(String visibleScope) {
      method getRawData (line 146) | public Map<String, Object> getRawData() {
      method setRawData (line 150) | public void setRawData(Map<String, Object> rawData) {
      method getUsage (line 154) | public Map<String, Object> getUsage() {
      method setUsage (line 158) | public void setUsage(Map<String, Object> usage) {
      method getMetrics (line 162) | public Map<String, Object> getMetrics() {
      method setMetrics (line 166) | public void setMetrics(Map<String, Object> metrics) {
      method getType (line 170) | public String getType() {
      method setType (line 174) | public void setType(String type) {
      method getText (line 178) | public Map<String, Object> getText() {
      method setText (line 182) | public void setText(Map<String, Object> text) {
      method getEvent (line 186) | public ComponentEvent getEvent() {
      method setEvent (line 190) | public void setEvent(ComponentEvent event) {
      class ComponentEvent (line 194) | public static class ComponentEvent {
        method getId (line 206) | public String getId() {
        method setId (line 210) | public void setId(String id) {
        method getStatus (line 214) | public String getStatus() {
        method setStatus (line 218) | public void setStatus(String status) {
        method getName (line 222) | public String getName() {
        method setName (line 226) | public void setName(String name) {
        method getCreatedTime (line 230) | public String getCreatedTime() {
        method setCreatedTime (line 234) | public void setCreatedTime(String createdTime) {
        method getErrorCode (line 238) | public String getErrorCode() {
        method setErrorCode (line 242) | public void setErrorCode(String errorCode) {
        method getErrorMessage (line 246) | public String getErrorMessage() {
        method setErrorMessage (line 250) | public void setErrorMessage(String errorMessage) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/dataset/DatasetCreateResponse.java
  class DatasetCreateResponse (line 3) | public class DatasetCreateResponse {
    method getCode (line 8) | public int getCode() {
    method setCode (line 12) | public void setCode(int code) {
    method getMessage (line 16) | public String getMessage() {
    method setMessage (line 20) | public void setMessage(String message) {
    method getResult (line 24) | public DatasetCreateResult getResult() {
    method setResult (line 28) | public void setResult(DatasetCreateResult result) {
    method toString (line 32) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/dataset/DatasetCreateResult.java
  class DatasetCreateResult (line 5) | public class DatasetCreateResult {
    method getId (line 26) | public String getId() {
    method setId (line 30) | public void setId(String id) {
    method getName (line 34) | public String getName() {
    method setName (line 38) | public void setName(String name) {
    method getDescription (line 42) | public String getDescription() {
    method setDescription (line 46) | public void setDescription(String description) {
    method getIndexingTechnique (line 50) | public String getIndexingTechnique() {
    method setIndexingTechnique (line 54) | public void setIndexingTechnique(String indexingTechnique) {
    method getDocumentCount (line 58) | public int getDocumentCount() {
    method setDocumentCount (line 62) | public void setDocumentCount(int documentCount) {
    method getWordCount (line 66) | public int getWordCount() {
    method setWordCount (line 70) | public void setWordCount(int wordCount) {
    method getCreatedBy (line 74) | public String getCreatedBy() {
    method setCreatedBy (line 78) | public void setCreatedBy(String createdBy) {
    method getCreatedAt (line 82) | public long getCreatedAt() {
    method setCreatedAt (line 86) | public void setCreatedAt(long createdAt) {
    method getUpdatedBy (line 90) | public String getUpdatedBy() {
    method setUpdatedBy (line 94) | public void setUpdatedBy(String updatedBy) {
    method getUpdatedAt (line 98) | public long getUpdatedAt() {
    method setUpdatedAt (line 102) | public void setUpdatedAt(long updatedAt) {
    method isPriority (line 106) | public boolean isPriority() {
    method setPriority (line 110) | public void setPriority(boolean priority) {
    method toString (line 114) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/dataset/DocumentAddResponse.java
  class DocumentAddResponse (line 3) | public class DocumentAddResponse {
    method getCode (line 8) | public int getCode() {
    method setCode (line 12) | public void setCode(int code) {
    method getMessage (line 16) | public String getMessage() {
    method setMessage (line 20) | public void setMessage(String message) {
    method getResult (line 24) | public DocumentAddResult getResult() {
    method setResult (line 28) | public void setResult(DocumentAddResult result) {
    method toString (line 32) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/dataset/DocumentAddResult.java
  class DocumentAddResult (line 7) | public class DocumentAddResult {
    method getDatasetId (line 13) | public String getDatasetId() {
    method setDatasetId (line 17) | public void setDatasetId(String datasetId) {
    method getDocumentIds (line 21) | public String[] getDocumentIds() {
    method setDocumentIds (line 25) | public void setDocumentIds(String[] documentIds) {
    method toString (line 29) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/dataset/DocumentDeleteResponse.java
  class DocumentDeleteResponse (line 3) | public class DocumentDeleteResponse {
    method getCode (line 8) | public int getCode() {
    method setCode (line 12) | public void setCode(int code) {
    method getMessage (line 16) | public String getMessage() {
    method setMessage (line 20) | public void setMessage(String message) {
    method getResult (line 24) | public Object getResult() {
    method setResult (line 28) | public void setResult(Object result) {
    method toString (line 32) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/dataset/DocumentListData.java
  class DocumentListData (line 7) | public class DocumentListData {
    method getId (line 38) | public String getId() {
    method setId (line 42) | public void setId(String id) {
    method getName (line 46) | public String getName() {
    method setName (line 50) | public void setName(String name) {
    method getDatasetProcessRuleId (line 54) | public String getDatasetProcessRuleId() {
    method setDatasetProcessRuleId (line 58) | public void setDatasetProcessRuleId(String datasetProcessRuleId) {
    method getDataSourceType (line 62) | public String getDataSourceType() {
    method setDataSourceType (line 66) | public void setDataSourceType(String dataSourceType) {
    method getPosition (line 70) | public int getPosition() {
    method setPosition (line 74) | public void setPosition(int position) {
    method getDataSourceInfo (line 78) | public Map<String, String> getDataSourceInfo() {
    method setDataSourceInfo (line 82) | public void setDataSourceInfo(Map<String, String> dataSourceInfo) {
    method getCreatedFrom (line 86) | public String getCreatedFrom() {
    method setCreatedFrom (line 90) | public void setCreatedFrom(String createdFrom) {
    method getCreatedBy (line 94) | public String getCreatedBy() {
    method setCreatedBy (line 98) | public void setCreatedBy(String createdBy) {
    method getCreatedAt (line 102) | public long getCreatedAt() {
    method setCreatedAt (line 106) | public void setCreatedAt(long createdAt) {
    method getIndexingStatus (line 110) | public String getIndexingStatus() {
    method setIndexingStatus (line 114) | public void setIndexingStatus(String indexingStatus) {
    method getError (line 118) | public Object getError() {
    method setError (line 122) | public void setError(Object error) {
    method isEnabled (line 126) | public boolean isEnabled() {
    method setEnabled (line 130) | public void setEnabled(boolean enabled) {
    method getDisplayStatus (line 134) | public String getDisplayStatus() {
    method setDisplayStatus (line 138) | public void setDisplayStatus(String displayStatus) {
    method getWordCount (line 142) | public int getWordCount() {
    method setWordCount (line 146) | public void setWordCount(int wordCount) {
    method getEstimatedWaitingMinutes (line 150) | public int getEstimatedWaitingMinutes() {
    method setEstimatedWaitingMinutes (line 154) | public void setEstimatedWaitingMinutes(int estimatedWaitingMinutes) {
    method getDisabledAt (line 158) | public Object getDisabledAt() {
    method setDisabledAt (line 162) | public void setDisabledAt(Object disabledAt) {
    method getDisabledBy (line 166) | public Object getDisabledBy() {
    method setDisabledBy (line 170) | public void setDisabledBy(Object disabledBy) {
    method toString (line 174) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/dataset/DocumentListResponse.java
  class DocumentListResponse (line 3) | public class DocumentListResponse {
    method getCode (line 8) | public int getCode() {
    method setCode (line 12) | public void setCode(int code) {
    method getMessage (line 16) | public String getMessage() {
    method setMessage (line 20) | public void setMessage(String message) {
    method getResult (line 24) | public DocumentListResult getResult() {
    method setResult (line 28) | public void setResult(DocumentListResult result) {
    method toString (line 32) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/dataset/DocumentListResult.java
  class DocumentListResult (line 7) | public class DocumentListResult {
    method isHasMore (line 15) | public boolean isHasMore() {
    method setHasMore (line 19) | public void setHasMore(boolean hasMore) {
    method getLimit (line 23) | public int getLimit() {
    method setLimit (line 27) | public void setLimit(int limit) {
    method getPage (line 31) | public int getPage() {
    method setPage (line 35) | public void setPage(int page) {
    method getTotal (line 39) | public int getTotal() {
    method setTotal (line 43) | public void setTotal(int total) {
    method getData (line 47) | public DocumentListData[] getData() {
    method setData (line 51) | public void setData(DocumentListData[] data) {
    method toString (line 55) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/dataset/FileUploadResponse.java
  class FileUploadResponse (line 3) | public class FileUploadResponse {
    method getCode (line 8) | public int getCode() {
    method setCode (line 12) | public void setCode(int code) {
    method getMessage (line 16) | public String getMessage() {
    method setMessage (line 20) | public void setMessage(String message) {
    method getResult (line 24) | public FileUploadResult getResult() {
    method setResult (line 28) | public void setResult(FileUploadResult result) {
    method toString (line 32) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/dataset/FileUploadResult.java
  class FileUploadResult (line 5) | public class FileUploadResult {
    method getId (line 17) | public String getId() {
    method setId (line 21) | public void setId(String id) {
    method getName (line 25) | public String getName() {
    method setName (line 29) | public void setName(String name) {
    method getSize (line 33) | public int getSize() {
    method setSize (line 37) | public void setSize(int size) {
    method getExtension (line 41) | public String getExtension() {
    method setExtension (line 45) | public void setExtension(String extension) {
    method getMimeType (line 49) | public String getMimeType() {
    method setMimeType (line 53) | public void setMimeType(String mimeType) {
    method getCreatedBy (line 57) | public String getCreatedBy() {
    method setCreatedBy (line 61) | public void setCreatedBy(String createdBy) {
    method getCreatedAt (line 65) | public long getCreatedAt() {
    method setCreatedAt (line 69) | public void setCreatedAt(long createdAt) {
    method toString (line 73) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/ChunkCreateRequest.java
  class ChunkCreateRequest (line 3) | public class ChunkCreateRequest {
    method ChunkCreateRequest (line 9) | public ChunkCreateRequest(String documetId, String content) {
    method ChunkCreateRequest (line 14) | public ChunkCreateRequest(String knowledgeBaseId, String documetId, St...
    method getKnowledgeBaseId (line 20) | public String getKnowledgeBaseId() {
    method setKnowledgeBaseId (line 24) | public void setKnowledgeBaseId(String knowledgeBaseId) {
    method getDocumentId (line 28) | public String getDocumentId() {
    method setDocumentId (line 32) | public void setDocumentId(String documentId) {
    method getContent (line 36) | public String getContent() {
    method setContent (line 40) | public void setContent(String content) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/ChunkCreateResponse.java
  class ChunkCreateResponse (line 5) | public class ChunkCreateResponse {
    method setChunkId (line 9) | public void setChunkId(String chunkId) {
    method getChunkId (line 13) | public String getChunkId() {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/ChunkDeleteRequest.java
  class ChunkDeleteRequest (line 3) | public class ChunkDeleteRequest {
    method setKnowledgeBaseId (line 7) | public void setKnowledgeBaseId(String knowledgeBaseId) {
    method getKnowledgeBaseId (line 11) | public String getKnowledgeBaseId() {
    method setChunkId (line 15) | public void setChunkId(String chunkId) {
    method getChunkId (line 19) | public String getChunkId() {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/ChunkDescribeRequest.java
  class ChunkDescribeRequest (line 3) | public class ChunkDescribeRequest {
    method setChunkId (line 7) | public void setChunkId(String chunkId) {
    method setKnowledgeBaseId (line 11) | public void setKnowledgeBaseId(String knowledgeBaseId) {
    method getChunkId (line 15) | public String getChunkId() {
    method getKnowledgeBaseId (line 19) | public String getKnowledgeBaseId() {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/ChunkDescribeResponse.java
  class ChunkDescribeResponse (line 5) | public class ChunkDescribeResponse {
    method setChunkId (line 21) | public void setChunkId(String chunkId) {
    method getChunkId (line 25) | public String getChunkId() {
    method setType (line 29) | public void setType(String type) {
    method getType (line 33) | public String getType() {
    method setKnowledgeBaseId (line 37) | public void setKnowledgeBaseId(String knowledgeBaseId) {
    method getKnowledgeBaseId (line 41) | public String getKnowledgeBaseId() {
    method setDocumentId (line 45) | public void setDocumentId(String documentId) {
    method getDocumentId (line 49) | public String getDocumentId() {
    method setContent (line 53) | public void setContent(String content) {
    method getContent (line 57) | public String getContent() {
    method setWordCount (line 61) | public void setWordCount(Integer wordCount) {
    method getWordCount (line 65) | public Integer getWordCount() {
    method setTokenCount (line 69) | public void setTokenCount(Integer tokenCount) {
    method getTokenCount (line 73) | public Integer getTokenCount() {
    method setEnabled (line 77) | public void setEnabled(boolean enabled) {
    method getEnabled (line 81) | public boolean getEnabled() {
    method setStatus (line 85) | public void setStatus(String status) {
    method getStatus (line 89) | public String getStatus() {
    method setStatusMessage (line 93) | public void setStatusMessage(String statusMessage) {
    method getStatusMessage (line 97) | public String getStatusMessage() {
    method setImageUrls (line 101) | public void setImageUrls(String[] imageUrls) {
    method getImageUrls (line 105) | public String[] getImageUrls() {
    method setCreateTime (line 109) | public void setCreateTime(Integer createTime) {
    method getCreateTime (line 113) | public Integer getCreateTime() {
    method setUpdateTime (line 117) | public void setUpdateTime(Integer updateTime) {
    method getUpdateTime (line 121) | public Integer getUpdateTime() {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/ChunkModifyRequest.java
  class ChunkModifyRequest (line 3) | public class ChunkModifyRequest {
    method ChunkModifyRequest (line 9) | public ChunkModifyRequest(String chunkId, String content, boolean enab...
    method ChunkModifyRequest (line 15) | public ChunkModifyRequest(String knowledgeBaseId, String chunkId, Stri...
    method getKnowledgeBaseId (line 22) | public String getKnowledgeBaseId() {
    method setKnowledgeBaseId (line 26) | public void setKnowledgeBaseId(String knowledgeBaseId) {
    method getChunkId (line 30) | public String getChunkId() {
    method setChunkId (line 34) | public void setChunkId(String chunkId) {
    method getContent (line 38) | public String getContent() {
    method setContent (line 42) | public void setContent(String content) {
    method getEnable (line 46) | public boolean getEnable() {
    method setEnable (line 50) | public void setEnable(boolean enable) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/ChunksDescribeRequest.java
  class ChunksDescribeRequest (line 3) | public class ChunksDescribeRequest {
    method ChunksDescribeRequest (line 11) | public ChunksDescribeRequest(String documentId, String marker, Integer...
    method ChunksDescribeRequest (line 18) | public ChunksDescribeRequest(String knowledgeBaseId, String documentId...
    method ChunksDescribeRequest (line 27) | public ChunksDescribeRequest(String knowledgeBaseId, String documentId...
    method getKnowledgeBaseId (line 37) | public String getKnowledgeBaseId() {
    method setKnowledgeBaseId (line 41) | public void setKnowledgeBaseId(String knowledgeBaseId) {
    method getDocumentId (line 45) | public String getDocumentId() {
    method setDocumentId (line 49) | public void setDocumentId(String documentId) {
    method getMarker (line 53) | public String getMarker() {
    method setMarker (line 57) | public void setMarker(String marker) {
    method getMaxKeys (line 61) | public Integer getMaxKeys() {
    method setMaxKeys (line 65) | public void setMaxKeys(Integer maxKeys) {
    method getType (line 69) | public String getType() {
    method setType (line 73) | public void setType(String type) {
    method setKeyword (line 77) | public void setKeyword(String keyword) {
    method getKeyword (line 81) | public String getKeyword() {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/ChunksDescribeResponse.java
  class ChunksDescribeResponse (line 3) | public class ChunksDescribeResponse {
    method getData (line 10) | public ChunkDescribeResponse[] getData() {
    method setData (line 14) | public void setData(ChunkDescribeResponse[] data) {
    method getMarker (line 18) | public String getMarker() {
    method setMarker (line 22) | public void setMarker(String marker) {
    method isTruncated (line 26) | public boolean isTruncated() {
    method setTruncated (line 30) | public void setTruncated(boolean isTruncated) {
    method getNextMarker (line 34) | public String getNextMarker() {
    method setNextMarker (line 38) | public void setNextMarker(String nextMarker) {
    method getMaxKeys (line 42) | public Integer getMaxKeys() {
    method setMaxKeys (line 46) | public void setMaxKeys(Integer maxKeys) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/Document.java
  class Document (line 5) | public class Document {
    method getId (line 15) | public String getId() {
    method setId (line 19) | public void setId(String id) {
    method getName (line 23) | public String getName() {
    method setName (line 27) | public void setName(String name) {
    method getCreatedAt (line 31) | public String getCreatedAt() {
    method setCreatedAt (line 35) | public void setCreatedAt(String createdAt) {
    method getWordCount (line 39) | public int getWordCount() {
    method setWordCount (line 43) | public void setWordCount(int wordCount) {
    method isEnabled (line 47) | public boolean isEnabled() {
    method setEnabled (line 51) | public void setEnabled(boolean enabled) {
    method getMeta (line 55) | public Meta getMeta() {
    method setMeta (line 59) | public void setMeta(Meta meta) {
    class Meta (line 63) | public static class Meta {
      method getSource (line 68) | public String getSource() {
      method setSource (line 72) | public void setSource(String source) {
      method getFileId (line 76) | public String getFileId() {
      method setFileId (line 80) | public void setFileId(String fileId) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/DocumentAddRequest.java
  class DocumentAddRequest (line 5) | public class DocumentAddRequest {
    method getKnowledgeBaseId (line 17) | public String getKnowledgeBaseId() {
    method setKnowledgeBaseId (line 21) | public void setKnowledgeBaseId(String knowledgeBaseId) {
    method getContentType (line 25) | public String getContentType() {
    method setContentType (line 29) | public void setContentType(String contentType) {
    method isEnhanced (line 33) | public boolean isEnhanced() {
    method setEnhanced (line 37) | public void setEnhanced(boolean enhanced) {
    method getFileIds (line 41) | public String[] getFileIds() {
    method setFileIds (line 45) | public void setFileIds(String[] fileIds) {
    method getCustomProcessRule (line 49) | public CustomProcessRule getCustomProcessRule() {
    method setCustomProcessRule (line 53) | public void setCustomProcessRule(CustomProcessRule customProcessRule) {
    class CustomProcessRule (line 57) | public static class CustomProcessRule {
      method getSeparators (line 65) | public String[] getSeparators() {
      method setSeparators (line 69) | public void setSeparators(String[] separators) {
      method getTargetLength (line 73) | public int getTargetLength() {
      method setTargetLength (line 77) | public void setTargetLength(int targetLength) {
      method getOverlapRate (line 81) | public double getOverlapRate() {
      method setOverlapRate (line 85) | public void setOverlapRate(double overlapRate) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/DocumentAddResponse.java
  class DocumentAddResponse (line 5) | public class DocumentAddResponse {
    method getRequestId (line 15) | public String getRequestId() {
    method setRequestId (line 19) | public void setRequestId(String requestId) {
    method getKnowledgeBaseId (line 23) | public String getKnowledgeBaseId() {
    method setKnowledgeBaseId (line 27) | public void setKnowledgeBaseId(String id) {
    method getDocumentIds (line 31) | public String[] getDocumentIds() {
    method setDocumentIds (line 35) | public void setDocumentIds(String[] documentIds) {
    method getCode (line 39) | public String getCode() {
    method setCode (line 43) | public void setCode(String code) {
    method getMessage (line 47) | public String getMessage() {
    method setMessage (line 51) | public void setMessage(String message) {
    method toString (line 55) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/DocumentDeleteRequest.java
  class DocumentDeleteRequest (line 8) | public class DocumentDeleteRequest {
    method getKonwledgeBaseId (line 15) | public String getKonwledgeBaseId() {
    method setKonwledgeBaseId (line 19) | public void setKonwledgeBaseId(String konwledgeBaseId) {
    method getDocumentId (line 23) | public String getDocumentId() {
    method setDocumentId (line 27) | public void setDocumentId(String documentId) {
    method toMap (line 31) | public Map<String, Object> toMap() {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/DocumentDeleteResponse.java
  class DocumentDeleteResponse (line 5) | public class DocumentDeleteResponse {
    method getRequestId (line 11) | public String getRequestId() {
    method setRequestId (line 15) | public void setRequestId(String requestId) {
    method getCode (line 19) | public String getCode() {
    method setCode (line 23) | public void setCode(String code) {
    method getMessage (line 27) | public String getMessage() {
    method setMessage (line 31) | public void setMessage(String message) {
    method toString (line 35) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/DocumentDescribeResponse.java
  class DocumentDescribeResponse (line 3) | public class DocumentDescribeResponse {
    method getId (line 12) | public String getId() {
    method setId (line 16) | public void setId(String id) {
    method getName (line 20) | public String getName() {
    method setName (line 24) | public void setName(String name) {
    method getCreatedAt (line 28) | public String getCreatedAt() {
    method setCreatedAt (line 32) | public void setCreatedAt(String createdAt) {
    method getDisplayStatus (line 36) | public String getDisplayStatus() {
    method setDisplayStatus (line 40) | public void setDisplayStatus(String displayStatus) {
    method getWordCount (line 44) | public Integer getWordCount() {
    method setWordCount (line 48) | public void setWordCount(Integer wordCount) {
    method getEnabled (line 52) | public Boolean getEnabled() {
    method setEnabled (line 56) | public void setEnabled(Boolean enabled) {
    method getMeta (line 60) | public Meta getMeta() {
    method setMeta (line 64) | public void setMeta(Meta meta) {
    class Meta (line 68) | public static class Meta {
      method getSource (line 76) | public String getSource() {
      method setSource (line 80) | public void setSource(String source) {
      method getFileId (line 84) | public String getFileId() {
      method setFileId (line 88) | public void setFileId(String fileId) {
      method getUrl (line 92) | public String getUrl() {
      method setUrl (line 96) | public void setUrl(String url) {
      method getMimeType (line 100) | public String getMimeType() {
      method setMimeType (line 104) | public void setMimeType(String mime_type) {
      method getFileSize (line 108) | public Integer getFileSize() {
      method setFileSize (line 112) | public void setFileSize(Integer file_size) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/DocumentListRequest.java
  class DocumentListRequest (line 8) | public class DocumentListRequest {
    method getKonwledgeBaseId (line 16) | public String getKonwledgeBaseId() {
    method setKonwledgeBaseId (line 20) | public void setKonwledgeBaseId(String konwledgeBaseId) {
    method getLimit (line 24) | public int getLimit() {
    method setLimit (line 28) | public void setLimit(int limit) {
    method getAfter (line 32) | public String getAfter() {
    method setAfter (line 36) | public void setAfter(String after) {
    method getBefore (line 40) | public String getBefore() {
    method setBefore (line 44) | public void setBefore(String before) {
    method toMap (line 48) | public Map<String, Object> toMap() {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/DocumentListResponse.java
  class DocumentListResponse (line 5) | public class DocumentListResponse {
    method getRequestId (line 12) | public String getRequestId() {
    method setRequestId (line 16) | public void setRequestId(String requestId) {
    method getData (line 20) | public Document[] getData() {
    method setData (line 24) | public void setData(Document[] data) {
    method getCode (line 28) | public String getCode() {
    method setCode (line 32) | public void setCode(String code) {
    method getMessage (line 36) | public String getMessage() {
    method setMessage (line 40) | public void setMessage(String message) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/DocumentsCreateRequest.java
  class DocumentsCreateRequest (line 5) | public class DocumentsCreateRequest {
    method DocumentsCreateRequest (line 12) | public DocumentsCreateRequest(String knowledgeBaseId, String contentFo...
    method getKnowledgeBaseId (line 20) | public String getKnowledgeBaseId() {
    method getContentFormat (line 24) | public String getContentFormat() {
    method getSource (line 28) | public Source getSource() {
    method getProcessOption (line 32) | public ProcessOption getProcessOption() {
    class Source (line 36) | public static class Source {
      method Source (line 42) | public Source(String type, String[] urls, Integer urlDepth) {
      method Source (line 48) | public Source(String type, String[] urls, Integer urlDepth, UrlConfi...
      method getType (line 55) | public String getType() {
      method getUrls (line 59) | public String[] getUrls() {
      method getUrlDepth (line 63) | public Integer getUrlDepth() {
      method getUrlConfigs (line 67) | public UrlConfig[] getUrlConfigs() {
      method setUrlConfigs (line 71) | public void setUrlConfigs(UrlConfig[] urlConfigs) {
      class UrlConfig (line 75) | public static class UrlConfig {
        method UrlConfig (line 78) | public UrlConfig(Integer frequency) {
        method getFrequency (line 82) | public Integer getFrequency() {
        method setFrequency (line 86) | public void setFrequency(Integer frequency) {
    class ProcessOption (line 92) | public static class ProcessOption {
      method ProcessOption (line 98) | public ProcessOption(String template, Parser parser, Chunker chunker,
      method getTemplate (line 106) | public String getTemplate() {
      method getParser (line 110) | public Parser getParser() {
      method getChunker (line 114) | public Chunker getChunker() {
      method getKnowledgeAugmentation (line 118) | public KnowledgeAugmentation getKnowledgeAugmentation() {
      class Parser (line 122) | public static class Parser {
        method Parser (line 125) | public Parser(String[] choices) {
        method getChoices (line 129) | public String[] getChoices() {
      class Chunker (line 134) | public static class Chunker {
        method Chunker (line 140) | public Chunker(String[] choices, Separator separator, Pattern patt...
        method getChoices (line 148) | public String[] getChoices() {
        method getSeparator (line 152) | public Separator getSeparator() {
        method getPattern (line 156) | public Pattern getPattern() {
        method getPrependInfo (line 160) | public String[] getPrependInfo() {
        class Separator (line 164) | public static class Separator {
          method Separator (line 169) | public Separator(String[] separators, Integer targetLength, Doub...
          method getSeparators (line 175) | public String[] getSeparators() {
          method getTargetLength (line 179) | public Integer getTargetLength() {
          method getOverlapRate (line 183) | public Double getOverlapRate() {
        class Pattern (line 188) | public static class Pattern {
          method Pattern (line 194) | public Pattern(String markPosition, String regex, Integer target...
          method getMarkPosition (line 202) | public String getMarkPosition() {
          method getRegex (line 206) | public String getRegex() {
          method getTargetLength (line 210) | public Integer getTargetLength() {
          method getOverlapRate (line 214) | public Double getOverlapRate() {
      class KnowledgeAugmentation (line 220) | public static class KnowledgeAugmentation {
        method KnowledgeAugmentation (line 223) | public KnowledgeAugmentation(String[] choices) {
        method getChoices (line 227) | public String[] getChoices() {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/DocumentsCreateResponse.java
  class DocumentsCreateResponse (line 3) | public class DocumentsCreateResponse {
    method getRequestId (line 6) | public String getRequestId() {
    method setRequestId (line 9) | public void setRequestId(String requestId) {
    method getDocumentIds (line 12) | public String[] getDocumentIds() {
    method setDocumentIds (line 15) | public void setDocumentIds(String[] documentIds) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/DocumentsDescribeRequest.java
  class DocumentsDescribeRequest (line 3) | public class DocumentsDescribeRequest {
    method DocumentsDescribeRequest (line 8) | public DocumentsDescribeRequest(String marker, Integer maxKeys) {
    method DocumentsDescribeRequest (line 13) | public DocumentsDescribeRequest(String knowledgeBaseId, String marker,...
    method getKnowledgeBaseId (line 19) | public String getKnowledgeBaseId() {
    method setKnowledgeBaseId (line 23) | public void setKnowledgeBaseId(String knowledgeBaseId) {
    method getMarker (line 27) | public String getMarker() {
    method setMarker (line 31) | public void setMarker(String marker) {
    method getMaxKeys (line 35) | public Integer getMaxKeys() {
    method setMaxKeys (line 39) | public void setMaxKeys(Integer maxKeys) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/DocumentsDescribeResponse.java
  class DocumentsDescribeResponse (line 3) | public class DocumentsDescribeResponse {
    method getData (line 10) | public DocumentDescribeResponse[] getData() {
    method setData (line 14) | public void setData(DocumentDescribeResponse[] data) {
    method getMarker (line 18) | public String getMarker() {
    method setMarker (line 22) | public void setMarker(String marker) {
    method isTruncated (line 26) | public boolean isTruncated() {
    method setTruncated (line 30) | public void setTruncated(boolean isTruncated) {
    method getNextMarker (line 34) | public String getNextMarker() {
    method setNextMarker (line 38) | public void setNextMarker(String nextMarker) {
    method getMaxKeys (line 42) | public Integer getMaxKeys() {
    method setMaxKeys (line 46) | public void setMaxKeys(Integer maxKeys) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/DocumentsUploadResponse.java
  class DocumentsUploadResponse (line 3) | public class DocumentsUploadResponse {
    method getRequestId (line 7) | public String getRequestId() {
    method setRequestId (line 11) | public void setRequestId(String requestId) {
    method getDocumentId (line 15) | public String getDocumentId() {
    method setDocumentId (line 19) | public void setDocumentId(String documentId) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/FileUploadResponse.java
  class FileUploadResponse (line 5) | public class FileUploadResponse {
    method getRequestId (line 12) | public String getRequestId() {
    method setRequestId (line 16) | public void setRequestId(String requestId) {
    method getId (line 20) | public String getId() {
    method setId (line 24) | public void setId(String id) {
    method getCode (line 28) | public String getCode() {
    method setCode (line 32) | public void setCode(String code) {
    method getMessage (line 36) | public String getMessage() {
    method setMessage (line 40) | public void setMessage(String message) {
    method toString (line 44) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/KnowledgeBaseConfig.java
  class KnowledgeBaseConfig (line 3) | public class KnowledgeBaseConfig {
    method KnowledgeBaseConfig (line 7) | public KnowledgeBaseConfig(Index index) {
    method KnowledgeBaseConfig (line 11) | public KnowledgeBaseConfig(Index index, Catalogue catalogue) {
    method getIndex (line 16) | public Index getIndex() {
    method setIndex (line 20) | public void setIndex(Index index) {
    method setCatalogue (line 24) | public void setCatalogue(Catalogue catalogue) {
    method getCatalogue (line 28) | public Catalogue getCatalogue() {
    class Index (line 32) | public static class Index {
      method Index (line 39) | public Index(String type, String clusterId, String username, String ...
      method getType (line 47) | public String getType() {
      method getClusterId (line 51) | public String getClusterId() {
      method getUsername (line 55) | public String getUsername() {
      method getPassword (line 59) | public String getPassword() {
      method getLocation (line 63) | public String getLocation() {
    class Catalogue (line 68) | public static class Catalogue {
      method setPathPrefix (line 71) | public void setPathPrefix(String pathPrefix) {
      method getPathPrefix (line 75) | public String getPathPrefix() {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/KnowledgeBaseDetail.java
  class KnowledgeBaseDetail (line 3) | public class KnowledgeBaseDetail {
    method getId (line 9) | public String getId() {
    method setId (line 13) | public void setId(String id) {
    method getConfig (line 17) | public KnowledgeBaseConfig getConfig() {
    method setConfig (line 21) | public void setConfig(KnowledgeBaseConfig config) {
    method getName (line 25) | public String getName() {
    method setName (line 29) | public void setName(String name) {
    method getDescription (line 33) | public String getDescription() {
    method setDescription (line 37) | public void setDescription(String description) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/KnowledgeBaseDetailRequest.java
  class KnowledgeBaseDetailRequest (line 5) | public class KnowledgeBaseDetailRequest {
    method getKnowledgeBaseId (line 9) | public String getKnowledgeBaseId() {
    method setKnowledgeBaseId (line 13) | public void setKnowledgeBaseId(String knowledgeBaseId) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/KnowledgeBaseListRequest.java
  class KnowledgeBaseListRequest (line 3) | public class KnowledgeBaseListRequest {
    method KnowledgeBaseListRequest (line 11) | public KnowledgeBaseListRequest(String marker, Integer maxKeys, String...
    method getMarker (line 17) | public String getMarker() {
    method getMaxKeys (line 21) | public int getMaxKeys() {
    method getKeyword (line 25) | public String getKeyword() {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/KnowledgeBaseListResponse.java
  class KnowledgeBaseListResponse (line 3) | public class KnowledgeBaseListResponse {
    method getRequestId (line 11) | public String getRequestId() {
    method setRequestId (line 15) | public void setRequestId(String requestId) {
    method getData (line 19) | public KnowledgeBaseDetail[] getData() {
    method setData (line 23) | public void setData(KnowledgeBaseDetail[] data) {
    method getMarker (line 27) | public String getMarker() {
    method setMarker (line 31) | public void setMarker(String marker) {
    method isTruncated (line 35) | public boolean isTruncated() {
    method setTruncated (line 39) | public void setTruncated(boolean isTruncated) {
    method getNextMarker (line 43) | public String getNextMarker() {
    method setNextMarker (line 47) | public void setNextMarker(String nextMarker) {
    method getMaxKeys (line 51) | public int getMaxKeys() {
    method setMaxKeys (line 55) | public void setMaxKeys(int maxKeys) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/KnowledgeBaseModifyRequest.java
  class KnowledgeBaseModifyRequest (line 5) | public class KnowledgeBaseModifyRequest {
    method getKnowledgeBaseId (line 12) | public String getKnowledgeBaseId() {
    method setKnowledgeBaseId (line 16) | public void setKnowledgeBaseId(String knowledgeBaseId) {
    method getName (line 20) | public String getName() {
    method setName (line 24) | public void setName(String name) {
    method getDescription (line 28) | public String getDescription() {
    method setDescription (line 32) | public void setDescription(String description) {
    method getConfig (line 36) | public KnowledgeBaseConfig getConfig() {
    method setConfig (line 40) | public void setConfig(KnowledgeBaseConfig config) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/QueryKnowledgeBaseRequest.java
  class QueryKnowledgeBaseRequest (line 5) | public class QueryKnowledgeBaseRequest {
    method QueryKnowledgeBaseRequest (line 15) | public QueryKnowledgeBaseRequest(String query, String type, Float rank...
    method getQuery (line 28) | public String getQuery() {
    method setQuery (line 32) | public void setQuery(String query) {
    method getType (line 36) | public String getType() {
    method setType (line 40) | public void setType(String type) {
    method getRank_score_threshold (line 44) | public Float getRank_score_threshold() {
    method setRank_score_threshold (line 48) | public void setRank_score_threshold(Float rank_score_threshold) {
    method getTop (line 52) | public Integer getTop() {
    method setTop (line 56) | public void setTop(Integer top) {
    method getSkip (line 60) | public Integer getSkip() {
    method setSkip (line 64) | public void setSkip(Integer skip) {
    method getKnowledgebase_ids (line 68) | public String[] getKnowledgebase_ids() {
    method setKnowledgebase_ids (line 72) | public void setKnowledgebase_ids(String[] knowledgebase_ids) {
    method getMetadata_filters (line 76) | public MetadataFilters getMetadata_filters() {
    method setMetadata_filters (line 80) | public void setMetadata_filters(MetadataFilters metadata_filters) {
    method getPipeline_config (line 84) | public QueryPipelineConfig getPipeline_config() {
    method setPipeline_config (line 88) | public void setPipeline_config(QueryPipelineConfig pipeline_config) {
    class MetadataFilter (line 92) | public static class MetadataFilter {
      method getOperator (line 97) | public String getOperator() {
      method setOperator (line 101) | public void setOperator(String operator) {
      method getField (line 105) | public String getField() {
      method setField (line 109) | public void setField(String field) {
      method getValue (line 113) | public Object getValue() {
      method setValue (line 117) | public void setValue(Object value) {
    class MetadataFilters (line 122) | public static class MetadataFilters {
      method getFilters (line 126) | public List<MetadataFilter> getFilters() {
      method setFilters (line 130) | public void setFilters(List<MetadataFilter> filters) {
      method getCondition (line 134) | public String getCondition() {
      method setCondition (line 138) | public void setCondition(String condition) {
    class PreRankingConfig (line 143) | public static class PreRankingConfig {
      method getBm25_weight (line 150) | public Double getBm25_weight() {
      method setBm25_weight (line 154) | public void setBm25_weight(Double bm25_weight) {
      method getVec_weight (line 158) | public Double getVec_weight() {
      method setVec_weight (line 162) | public void setVec_weight(Double vec_weight) {
      method getBm25_b (line 166) | public Double getBm25_b() {
      method setBm25_b (line 170) | public void setBm25_b(Double bm25_b) {
      method getBm25_k1 (line 174) | public Double getBm25_k1() {
      method setBm25_k1 (line 178) | public void setBm25_k1(Double bm25_k1) {
      method getBm25_max_score (line 182) | public Double getBm25_max_score() {
      method setBm25_max_score (line 186) | public void setBm25_max_score(Double bm25_max_score) {
    class ElasticSearchRetrieveConfig (line 191) | public static class ElasticSearchRetrieveConfig {
      method getName (line 197) | public String getName() {
      method setName (line 201) | public void setName(String name) {
      method getType (line 205) | public String getType() {
      method setType (line 209) | public void setType(String type) {
      method getThreshold (line 213) | public Double getThreshold() {
      method setThreshold (line 217) | public void setThreshold(Double threshold) {
      method getTop (line 221) | public Integer getTop() {
      method setTop (line 225) | public void setTop(Integer top) {
    class VectorDBRetrieveConfig (line 230) | public static class VectorDBRetrieveConfig {
      method getName (line 236) | public String getName() {
      method setName (line 240) | public void setName(String name) {
      method getType (line 244) | public String getType() {
      method setType (line 248) | public void setType(String type) {
      method getThreshold (line 252) | public Double getThreshold() {
      method setThreshold (line 256) | public void setThreshold(Double threshold) {
      method getTop (line 260) | public Integer getTop() {
      method setTop (line 264) | public void setTop(Integer top) {
    class RankingConfig (line 270) | public static class RankingConfig {
      method getName (line 277) | public String getName() {
      method setName (line 281) | public void setName(String name) {
      method getType (line 285) | public String getType() {
      method setType (line 289) | public void setType(String type) {
      method getInputs (line 293) | public List<String> getInputs() {
      method setInputs (line 297) | public void setInputs(List<String> inputs) {
      method getModel_name (line 301) | public String getModel_name() {
      method setModel_name (line 305) | public void setModel_name(String model_name) {
      method getTop (line 309) | public Integer getTop() {
      method setTop (line 313) | public void setTop(Integer top) {
    class SmallToBigConfig (line 318) | public static class SmallToBigConfig {
      method getName (line 322) | public String getName() {
      method setName (line 326) | public void setName(String name) {
      method getType (line 330) | public String getType() {
      method setType (line 334) | public void setType(String type) {
    class QueryPipelineConfig (line 340) | public static class QueryPipelineConfig {
      method getId (line 344) | public String getId() {
      method setId (line 348) | public void setId(String id) {
      method getPipeline (line 352) | public List<Object> getPipeline() {
      method setPipeline (line 356) | public void setPipeline(List<Object> pipeline) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/knowledgebase/QueryKnowledgeBaseResponse.java
  class QueryKnowledgeBaseResponse (line 6) | public class QueryKnowledgeBaseResponse {
    method getRequestId (line 13) | public String getRequestId() { return requestId; }
    method setRequestId (line 15) | public void setRequestId(String requestId) { this.requestId = requestI...
    method getCode (line 17) | public String getCode() { return code; }
    method setCode (line 19) | public void setCode(String code) { this.code = code; }
    method getMessage (line 21) | public String getMessage() { return message; }
    method setMessage (line 23) | public void setMessage(String message) { this.message = message; }
    method getChunks (line 25) | public List<Chunk> getChunks() { return chunks; }
    method setChunks (line 27) | public void setChunks(List<Chunk> chunks) { this.chunks = chunks; }
    method getTotal_count (line 29) | public int getTotal_count() { return total_count; }
    method setTotal_count (line 31) | public void setTotal_count(int total_count) { this.total_count = total...
    class Chunk (line 33) | public static class Chunk {
      method getChunk_id (line 51) | public String getChunk_id() { return chunk_id; }
      method setChunk_id (line 53) | public void setChunk_id(String chunk_id) { this.chunk_id = chunk_id; }
      method getKnowledgebase_id (line 55) | public String getKnowledgebase_id() { return knowledgebase_id; }
      method setKnowledgebase_id (line 57) | public void setKnowledgebase_id(String knowledgebase_id) { this.know...
      method getDocument_id (line 59) | public String getDocument_id() { return document_id; }
      method setDocument_id (line 61) | public void setDocument_id(String document_id) { this.document_id = ...
      method getDocument_name (line 63) | public String getDocument_name() { return document_name; }
      method setDocument_name (line 65) | public void setDocument_name(String document_name) { this.document_n...
      method getMeta (line 67) | public Map<String, Object> getMeta() { return meta; }
      method setMeta (line 69) | public void setMeta(Map<String, Object> meta) { this.meta = meta; }
      method getType (line 71) | public String getType() { return type; }
      method setType (line 73) | public void setType(String type) { this.type = type; }
      method getContent (line 75) | public String getContent() { return content; }
      method setContent (line 77) | public void setContent(String content) { this.content = content; }
      method getCreate_time (line 79) | public String getCreate_time() { return create_time; }
      method setCreate_time (line 81) | public void setCreate_time(String create_time) { this.create_time = ...
      method getUpdate_time (line 83) | public String getUpdate_time() { return update_time; }
      method setUpdate_time (line 85) | public void setUpdate_time(String update_time) { this.update_time = ...
      method getRetrieval_score (line 87) | public float getRetrieval_score() { return retrieval_score; }
      method setRetrieval_score (line 89) | public void setRetrieval_score(float retrieval_score) { this.retriev...
      method getRank_score (line 91) | public float getRank_score() { return rank_score; }
      method setRank_score (line 93) | public void setRank_score(float rank_score) { this.rank_score = rank...
      method getLocations (line 95) | public ChunkLocation getLocations() { return locations; }
      method setLocations (line 97) | public void setLocations(ChunkLocation locations) { this.locations =...
      method getChildren (line 99) | public List<Chunk> getChildren() { return children; }
      method setChildren (line 101) | public void setChildren(List<Chunk> children) { this.children = chil...
      method getNeighbour_chunks (line 103) | public List<Chunk> getNeighbour_chunks() { return neighbour_chunks; }
      method setNeighbour_chunks (line 105) | public void setNeighbour_chunks(List<Chunk> neighbour_chunks) { this...
      method getOriginal_chunk_id (line 107) | public String getOriginal_chunk_id() { return original_chunk_id; }
      method setOriginal_chunk_id (line 109) | public void setOriginal_chunk_id(String original_chunk_id) { this.or...
      method getOriginal_chunk_offset (line 111) | public Integer getOriginal_chunk_offset() { return original_chunk_of...
      method setOriginal_chunk_offset (line 113) | public void setOriginal_chunk_offset(Integer original_chunk_offset) ...
    class ChunkLocation (line 116) | public static class ChunkLocation {
      method getPaget_num (line 120) | public List<Integer> getPaget_num() {
      method setPaget_num (line 124) | public void setPaget_num(List<Integer> paget_num) {
      method getBox (line 128) | public List<List<Integer>> getBox() {
      method setBox (line 132) | public void setBox(List<List<Integer>> box) {

FILE: java/src/main/java/com/baidubce/appbuilder/model/rag/EventContent.java
  class EventContent (line 9) | public class EventContent {
    method getEventCode (line 32) | public String getEventCode() {
    method setEventCode (line 36) | public void setEventCode(String eventCode) {
    method getEnentMessage (line 40) | public String getEnentMessage() {
    method setEnentMessage (line 44) | public void setEnentMessage(String enentMessage) {
    method getNodeName (line 48) | public String getNodeName() {
    method setNodeName (line 52) | public void setNodeName(String nodeName) {
    method getDependencyNodes (line 56) | public String[] getDependencyNodes() {
    method setDependencyNodes (line 60) | public void setDependencyNodes(String[] dependencyNodes) {
    method getEventType (line 64) | public String getEventType() {
    method setEventType (line 68) | public void setEventType(String eventType) {
    method getEventId (line 72) | public String getEventId() {
    method setEventId (line 76) | public void setEventId(String eventId) {
    method getEventStatus (line 80) | public String getEventStatus() {
    method setEventStatus (line 84) | public void setEventStatus(String eventStatus) {
    method getContentType (line 88) | public String getContentType() {
    method setContentType (line 92) | public void setContentType(String contentType) {
    method getOutputs (line 96) | public Map<String, Object> getOutputs() {
    method setOutputs (line 100) | public void setOutputs(Map<String, Object> outputs) {
    method getDetail (line 104) | public HashMap<String, String> getDetail() {
    method setDetail (line 108) | public void setDetail(HashMap<String, String> detail) {
    method toString (line 112) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/rag/RAGIterator.java
  class RAGIterator (line 7) | public class RAGIterator {
    method RAGIterator (line 11) | public RAGIterator(HttpResponse<StreamIterator<RAGResponse>> resp) {
    method hasNext (line 16) | public boolean hasNext() {
    method next (line 20) | public RAGResponse next() throws AppBuilderServerException {
    method close (line 29) | public void close(){

FILE: java/src/main/java/com/baidubce/appbuilder/model/rag/RAGResponse.java
  class RAGResponse (line 5) | public class RAGResponse {
    method getTraceId (line 13) | public String getTraceId() {
    method setTraceId (line 17) | public void setTraceId(String traceId) {
    method getTime (line 21) | public long getTime() {
    method setTime (line 25) | public void setTime(int time) {
    method getResult (line 29) | public RAGResult getResult() {
    method setResult (line 33) | public void setResult(RAGResult result) {
    method getCode (line 37) | public int getCode() {
    method setCode (line 41) | public void setCode(int code) {
    method getMessage (line 45) | public String getMessage() {
    method setMessage (line 49) | public void setMessage(String message) {
    method toString (line 53) | @Override

FILE: java/src/main/java/com/baidubce/appbuilder/model/rag/RAGResult.java
  class RAGResult (line 7) | public class RAGResult {
    method getAnswer (line 20) | public String getAnswer() {
    method setAnswer (line 24) | public void setAnswer(String answer) {
    method getConversationId (line 28) | public String getConversationId() {
    method setConversationId (line 32) | public void setConversationId(String conversationId) {
    method getMessageId (line 36) | public String getMessageId() {
    method setMessageId (line 40) | public void setMessageId(String messageId) {
    method getIsCompletion (line 44) | public Object getIsCompletion() {
    method setIsCompletion (line 48) | public void setIsCompletion(Object isCompletion) {
    method getPrototype (line 52) | public String getPrototype() {
    method setPrototype (line 56) | public void setPrototype(String prototype) {
    method getContent (line 60) | public EventContent[] getContent() {
    method setContent (line 64) | public void setContent(EventContent[] content) {
    method toString (line 68) | @Override

FILE: java/src/test/java/com/baidubce/appbuilder/AISearchTest.java
  class AISearchTest (line 17) | public class AISearchTest {
    method setUp (line 18) | @Before
    method TestBaseSearch (line 24) | @Test
    method TestAISearch (line 40) | @Test
    method TestAISearchStream (line 56) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/AgentBuilderTest.java
  class AgentBuilderTest (line 16) | public class AgentBuilderTest{
    method setUp (line 19) | @Before
    method testAgentBuilder (line 26) | @Test
    method testCreateConversation_AppBuilderServerException (line 42) | @Test(expected = AppBuilderServerException.class)

FILE: java/src/test/java/com/baidubce/appbuilder/AppBuilderClientTest.java
  class AppBuilderClientTest (line 31) | public class AppBuilderClientTest {
    method setUp (line 37) | @Before
    method GetAppsTest (line 47) | @Test
    method DescribeAppTest (line 55) | @Test
    method DescribeAppsTest (line 66) | @Test
    method AppBuilderClientRunTest (line 73) | @Test
    method testCreateConversation_AppBuilderServerException (line 118) | @Test(expected = AppBuilderServerException.class)
    method AppBuilderClientRunFuncTest (line 125) | @Test
    method AppBuilderClientRunToolChoiceTest (line 157) | @Test
    method AppBuilderClientRunParametersTest (line 179) | @Test
    method AppBuilderClientRunChatflowTest (line 200) | @Test
    method AppBuilderClientFeedbackTest (line 296) | @Test
    method AppBuilderClientRunCustomMetadataTest (line 321) | @Test
    method AppBuilderClientClose (line 351) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/ComponentClientTest.java
  class ComponentClientTest (line 17) | public class ComponentClientTest {
    method setUp (line 20) | @Before
    method TestComponentClientRun (line 27) | @Test
    method TestComponentClientRunStream (line 39) | @Test
    method TestComponentClientHeaderRun (line 55) | @Test
    method TestComponentClientHeaderRunStream (line 68) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/DatasetTest.java
  class DatasetTest (line 15) | public class DatasetTest {
    method setUp (line 17) | @Before

FILE: java/src/test/java/com/baidubce/appbuilder/KnowledgebaseTest.java
  class KnowledgebaseTest (line 20) | public class KnowledgebaseTest {
    method setUp (line 21) | @Before
    method testAddDocument (line 27) | @Test
    method testCreateKnowledgebase (line 70) | @Test
    method testCreateChunk (line 153) | @Test
    method testQueryKnowledgeBase (line 185) | @Test
    method testQueryKnowledgeBaseV2 (line 198) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/RAGTest.java
  class RAGTest (line 17) | public class RAGTest {
    method setUp (line 20) | @Before

FILE: java/src/test/java/com/baidubce/appbuilder/base/exception/AppBuilderServerExceptionTest.java
  class AppBuilderServerExceptionTest (line 6) | public class AppBuilderServerExceptionTest {
    method testConstructorWithBasicFields (line 8) | @Test
    method testConstructorWithAppbuilderFields (line 20) | @Test
    method testConstructorWithResponseBody (line 32) | @Test
    method testToString (line 44) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/base/utils/json/JsonUtilsTest.java
  class JsonUtilsTest (line 8) | public class JsonUtilsTest {
    method testSerialize (line 10) | @Test
    method testDeserialize (line 25) | @Test
    method testDeserializeToMap (line 38) | @Test
    class TestObject (line 52) | static class TestObject {
      method TestObject (line 56) | public TestObject(String name, int value) {
      method getName (line 61) | public String getName() {
      method getValue (line 65) | public int getValue() {

FILE: java/src/test/java/com/baidubce/appbuilder/model/agentbuilder/AgentBuilderResponseTest.java
  class AgentBuilderResponseTest (line 7) | public class AgentBuilderResponseTest {
    method setUp (line 10) | @Before
    method testRequestId (line 15) | @Test
    method testData (line 21) | @Test
    method testAnswer (line 27) | @Test
    method testConversationId (line 33) | @Test
    method testMessageId (line 39) | @Test
    method testIsCompletion (line 45) | @Test
    method testContent (line 54) | @Test
    method testToString (line 61) | @Test
    method testNullContent (line 79) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/agentbuilder/AgentBuilderResultTest.java
  class AgentBuilderResultTest (line 7) | public class AgentBuilderResultTest {
    method setUp (line 12) | @Before
    method testGetAnswer (line 24) | @Test
    method testGetEvents (line 29) | @Test
    method testToString (line 40) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/agentbuilder/ConversationResponseTest.java
  class ConversationResponseTest (line 7) | public class ConversationResponseTest {
    method setUp (line 10) | @Before
    method testRequestId (line 17) | @Test
    method testConversationId (line 22) | @Test
    method testToString (line 27) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/agentbuilder/EventContentTest.java
  class EventContentTest (line 10) | public class EventContentTest {
    method setUp (line 13) | @Before
    method testEventCode (line 30) | @Test
    method testEnentMessage (line 35) | @Test
    method testEventType (line 40) | @Test
    method testEventId (line 45) | @Test
    method testEventStatus (line 50) | @Test
    method testContentType (line 55) | @Test
    method testOutputs (line 60) | @Test
    method testToString (line 69) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/agentbuilder/EventTest.java
  class EventTest (line 10) | public class EventTest {
    method setUp (line 13) | @Before
    method testCode (line 29) | @Test
    method testMessage (line 34) | @Test
    method testEventType (line 39) | @Test
    method testStatus (line 44) | @Test
    method testContentType (line 49) | @Test
    method testDetail (line 54) | @Test
    method testToString (line 63) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/agentbuilder/FileUploadResponseTest.java
  class FileUploadResponseTest (line 7) | public class FileUploadResponseTest {
    method setUp (line 10) | @Before
    method testGetRequestId (line 18) | @Test
    method testGetFileId (line 23) | @Test
    method testGetConversationId (line 28) | @Test
    method testToString (line 33) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/appbuilderclient/AppBuilderClientResponseTest.java
  class AppBuilderClientResponseTest (line 7) | public class AppBuilderClientResponseTest {
    method setUp (line 10) | @Before
    method testRequestId (line 15) | @Test
    method testData (line 21) | @Test
    method testAnswer (line 27) | @Test
    method testConversationId (line 33) | @Test
    method testMessageId (line 39) | @Test
    method testIsCompletion (line 45) | @Test
    method testContent (line 51) | @Test
    method testToString (line 58) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/appbuilderclient/AppBuilderClientRunRequestTest.java
  class AppBuilderClientRunRequestTest (line 10) | public class AppBuilderClientRunRequestTest {
    method setUp (line 18) | @Before
    method testAppId (line 47) | @Test
    method testQuery (line 52) | @Test
    method testStream (line 57) | @Test
    method testConversationID (line 62) | @Test
    method testEndUserId (line 67) | @Test
    method testTools (line 72) | @Test
    method testToolOutputs (line 81) | @Test
    method testToolChoice (line 88) | @Test
    method testToolFunction (line 95) | @Test
    method testToolChoiceFunction (line 102) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/appbuilderclient/AppListRequestTest.java
  class AppListRequestTest (line 10) | public class AppListRequestTest {
    method setUp (line 14) | @Before
    method testGetLimit (line 19) | @Test
    method testSetLimit (line 25) | @Test
    method testGetAfter (line 31) | @Test
    method testSetAfter (line 37) | @Test
    method testGetBefore (line 43) | @Test
    method testSetBefore (line 49) | @Test
    method testToMap_WithLimit (line 55) | @Test
    method testToMap_WithoutLimit (line 70) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/appbuilderclient/AppListResponseTest.java
  class AppListResponseTest (line 7) | public class AppListResponseTest {
    method setUp (line 11) | @Before
    method testGetSetRequestId (line 16) | @Test
    method testGetSetData (line 22) | @Test
    method testGetSetCode (line 31) | @Test
    method testGetSetMessage (line 37) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/appbuilderclient/AppTest.java
  class AppTest (line 7) | public class AppTest {
    method setUp (line 11) | @Before
    method testSetGetId (line 16) | @Test
    method testSetGetName (line 22) | @Test
    method testSetGetDescription (line 28) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/appbuilderclient/ConversationResponseTest.java
  class ConversationResponseTest (line 7) | public class ConversationResponseTest {
    method setUp (line 11) | @Before
    method testSetGetRequestId (line 16) | @Test
    method testSetGetConversationId (line 22) | @Test
    method testToString (line 28) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/appbuilderclient/EventContentTest.java
  class EventContentTest (line 11) | public class EventContentTest {
    method setUp (line 16) | @Before
    method testGetSetEventCode (line 22) | @Test
    method testGetSetEventMessage (line 28) | @Test
    method testGetSetEventType (line 34) | @Test
    method testGetSetEventId (line 40) | @Test
    method testGetSetEventStatus (line 46) | @Test
    method testGetSetContentType (line 52) | @Test
    method testGetSetOutputs (line 58) | @Test
    method testGetSetUsage (line 66) | @Test
    method testGetSetToolCalls (line 74) | @Test
    method testToString (line 80) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/appbuilderclient/EventTest.java
  class EventTest (line 11) | public class EventTest {
    method setUp (line 18) | @Before
    method testGetCode (line 41) | @Test
    method testGetMessage (line 46) | @Test
    method testGetEventType (line 51) | @Test
    method testGetStatus (line 56) | @Test
    method testGetContentType (line 61) | @Test
    method testGetDetail (line 66) | @Test
    method testGetUsage (line 71) | @Test
    method testGetToolCalls (line 76) | @Test
    method testToString (line 81) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/appbuilderclient/FileUploadResponseTest.java
  class FileUploadResponseTest (line 8) | public class FileUploadResponseTest {
    method setUp (line 12) | @Before
    method testSetGetRequestId (line 17) | @Test
    method testSetGetFileId (line 23) | @Test
    method testSetGetConversationId (line 29) | @Test
    method testToString (line 35) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/appbuilderclient/ToolCallTest.java
  class ToolCallTest (line 8) | public class ToolCallTest {
    method setUp (line 12) | @Before
    method testGetId (line 17) | @Test
    method testSetId (line 23) | @Test
    method testGetType (line 29) | @Test
    method testSetType (line 35) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/dataset/DatasetCreateResultTest.java
  class DatasetCreateResultTest (line 7) | public class DatasetCreateResultTest {
    method setUp (line 10) | @Before
    method testId (line 15) | @Test
    method testName (line 21) | @Test
    method testDescription (line 27) | @Test
    method testIndexingTechnique (line 33) | @Test
    method testDocumentCount (line 39) | @Test
    method testWordCount (line 45) | @Test
    method testCreatedBy (line 51) | @Test
    method testCreatedAt (line 57) | @Test
    method testUpdatedBy (line 63) | @Test
    method testUpdatedAt (line 69) | @Test
    method testIsPriority (line 75) | @Test
    method testToString (line 84) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/dataset/DocumentAddResultTest.java
  class DocumentAddResultTest (line 8) | public class DocumentAddResultTest {
    method setUp (line 11) | @Before
    method testGetDatasetId (line 18) | @Test
    method testSetDatasetId (line 23) | @Test
    method testGetDocumentIds (line 29) | @Test
    method testSetDocumentIds (line 36) | @Test
    method testToString (line 42) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/dataset/DocumentListDataTest.java
  class DocumentListDataTest (line 9) | public class DocumentListDataTest {
    method setUp (line 12) | @Before
    method testId (line 17) | @Test
    method testName (line 23) | @Test
    method testDatasetProcessRuleId (line 29) | @Test
    method testDataSourceType (line 35) | @Test
    method testPosition (line 41) | @Test
    method testDataSourceInfo (line 47) | @Test
    method testCreatedFrom (line 55) | @Test
    method testCreatedBy (line 61) | @Test
    method testCreatedAt (line 67) | @Test
    method testIndexingStatus (line 73) | @Test
    method testError (line 79) | @Test
    method testEnabled (line 86) | @Test
    method testDisplayStatus (line 95) | @Test
    method testWordCount (line 101) | @Test
    method testEstimatedWaitingMinutes (line 107) | @Test
    method testDisabledAt (line 113) | @Test
    method testDisabledBy (line 120) | @Test
    method testToString (line 127) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/dataset/DocumentListResponseTest.java
  class DocumentListResponseTest (line 7) | public class DocumentListResponseTest {
    method setUp (line 11) | @Before
    method testCode (line 21) | @Test
    method testMessage (line 27) | @Test
    method testResult (line 33) | @Test
    method testToString (line 41) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/dataset/DocumentListResultTest.java
  class DocumentListResultTest (line 7) | public class DocumentListResultTest {
    method setUp (line 10) | @Before
    method testHasMore (line 15) | @Test
    method testLimit (line 24) | @Test
    method testPage (line 30) | @Test
    method testTotal (line 36) | @Test
    method testData (line 42) | @Test
    method testToString (line 62) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/dataset/FileUploadResponseTest.java
  class FileUploadResponseTest (line 7) | public class FileUploadResponseTest {
    method setUp (line 11) | @Before
    method testCode (line 24) | @Test
    method testMessage (line 30) | @Test
    method testResult (line 36) | @Test
    method testToString (line 49) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/dataset/FileUploadResultTest.java
  class FileUploadResultTest (line 7) | public class FileUploadResultTest {
    method setUp (line 10) | @Before
    method testId (line 15) | @Test
    method testName (line 21) | @Test
    method testSize (line 27) | @Test
    method testExtension (line 33) | @Test
    method testMimeType (line 39) | @Test
    method testCreatedBy (line 45) | @Test
    method testCreatedAt (line 51) | @Test
    method testToString (line 57) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/dataset/ResponseTest.java
  class ResponseTest (line 7) | public class ResponseTest {
    method setUp (line 12) | @Before
    method testDatasetCreateResponse (line 35) | @Test
    method testDocumentAddResponse (line 49) | @Test
    method testDocumentDeleteResponse (line 63) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/ChunkCreateRequestTest.java
  class ChunkCreateRequestTest (line 7) | public class ChunkCreateRequestTest {
    method setUp (line 11) | @Before
    method testGetDocumentId (line 16) | @Test
    method testGetContent (line 21) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/ChunkCreateResponseTest.java
  class ChunkCreateResponseTest (line 7) | public class ChunkCreateResponseTest {
    method setUp (line 11) | @Before
    method testSetAndGetChunkId (line 17) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/ChunkDeleteRequestTest.java
  class ChunkDeleteRequestTest (line 7) | public class ChunkDeleteRequestTest {
    method setUp (line 11) | @Before
    method testSetAndGetChunkId (line 16) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/ChunkDescribeRequestTest.java
  class ChunkDescribeRequestTest (line 7) | public class ChunkDescribeRequestTest {
    method setUp (line 11) | @Before
    method testSetAndGetChunkId (line 17) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/ChunkDescribeResponseTest.java
  class ChunkDescribeResponseTest (line 7) | public class ChunkDescribeResponseTest {
    method setUp (line 10) | @Before
    method testChunkId (line 15) | @Test
    method testType (line 21) | @Test
    method testKnowledgeBaseId (line 27) | @Test
    method testDocumentId (line 33) | @Test
    method testContent (line 39) | @Test
    method testWordCount (line 45) | @Test
    method testTokenCount (line 51) | @Test
    method testEnabled (line 57) | @Test
    method testStatus (line 66) | @Test
    method testStatusMessage (line 72) | @Test
    method testCreateTime (line 78) | @Test
    method testUpdateTime (line 84) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/ChunkModifyRequestTest.java
  class ChunkModifyRequestTest (line 7) | public class ChunkModifyRequestTest {
    method setUp (line 11) | @Before
    method testGetChunkId (line 17) | @Test
    method testGetContent (line 22) | @Test
    method testGetEnable (line 27) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/ChunksDescribeRequestTest.java
  class ChunksDescribeRequestTest (line 7) | public class ChunksDescribeRequestTest {
    method setUp (line 11) | @Before
    method testGetDocumentId (line 17) | @Test
    method testGetMarker (line 22) | @Test
    method testGetMaxKeys (line 27) | @Test
    method testGetType (line 32) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/ChunksDescribeResponseTest.java
  class ChunksDescribeResponseTest (line 7) | public class ChunksDescribeResponseTest {
    method setUp (line 12) | @Before
    method testData (line 32) | @Test
    method testMarker (line 43) | @Test
    method testIsTruncated (line 48) | @Test
    method testNextMarker (line 53) | @Test
    method testMaxKeys (line 58) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/DocumentAddRequestTest.java
  class DocumentAddRequestTest (line 9) | public class DocumentAddRequestTest {
    method setUp (line 14) | @Before
    method testSetAndGetKnowledgeBaseId (line 20) | @Test
    method testSetAndGetContentType (line 27) | @Test
    method testSetAndGetIsEnhanced (line 34) | @Test
    method testSetAndGetFileIds (line 41) | @Test
    method testSetAndGetCustomProcessRule (line 48) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/DocumentDeleteRequestTest.java
  class DocumentDeleteRequestTest (line 10) | public class DocumentDeleteRequestTest {
    method setUp (line 14) | @Before
    method testSetAndGetKonwledgeBaseId (line 20) | @Test
    method testSetAndGetDocumentId (line 29) | @Test
    method testToMap (line 38) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/DocumentDeleteResponseTest.java
  class DocumentDeleteResponseTest (line 8) | public class DocumentDeleteResponseTest {
    method setUp (line 12) | @Before
    method testGetSetRequestId (line 17) | @Test
    method testGetSetCode (line 23) | @Test
    method testGetSetMessage (line 29) | @Test
    method testToString (line 35) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/DocumentListRequestTest.java
  class DocumentListRequestTest (line 11) | public class DocumentListRequestTest {
    method setUp (line 15) | @Before
    method testGetSetKonwledgeBaseId (line 20) | @Test
    method testGetSetLimit (line 26) | @Test
    method testGetSetAfter (line 32) | @Test
    method testGetSetBefore (line 38) | @Test
    method testToMapWithAllValues (line 44) | @Test
    method testToMapWithLimitZero (line 60) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/DocumentListResponseTest.java
  class DocumentListResponseTest (line 7) | public class DocumentListResponseTest {
    method setUp (line 12) | @Before
    method testRequestId (line 31) | @Test
    method testData (line 36) | @Test
    method testCode (line 47) | @Test
    method testMessage (line 52) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/DocumentTest.java
  class DocumentTest (line 7) | public class DocumentTest {
    method setUp (line 11) | @Before
    method testId (line 17) | @Test
    method testName (line 23) | @Test
    method testCreatedAt (line 29) | @Test
    method testWordCount (line 35) | @Test
    method testEnabled (line 41) | @Test
    method testMeta (line 50) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/DocumentsCreateRequestTest.java
  class DocumentsCreateRequestTest (line 7) | public class DocumentsCreateRequestTest {
    method setUp (line 17) | @Before
    method testKnowledgeBaseId (line 39) | @Test
    method testContentFormat (line 44) | @Test
    method testSource (line 49) | @Test
    method testProcessOption (line 56) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/FileUploadResponseTest.java
  class FileUploadResponseTest (line 7) | public class FileUploadResponseTest {
    method setUp (line 11) | @Before
    method testSetGetRequestId (line 16) | @Test
    method testSetGetId (line 22) | @Test
    method testSetGetCode (line 28) | @Test
    method testSetGetMessage (line 34) | @Test
    method testToString (line 40) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/KnowledgeBaseConfigTest.java
  class KnowledgeBaseConfigTest (line 10) | public class KnowledgeBaseConfigTest {
    method setUp (line 15) | @Before
    method testGetIndex (line 21) | @Test
    method testIndexType (line 26) | @Test
    method testIndexClusterId (line 31) | @Test
    method testIndexUsername (line 36) | @Test
    method testIndexPassword (line 41) | @Test
    method testIndexLocation (line 46) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/KnowledgeBaseDetailRequestTest.java
  class KnowledgeBaseDetailRequestTest (line 8) | public class KnowledgeBaseDetailRequestTest {
    method setUp (line 12) | @Before
    method testGetKnowledgeBaseId (line 17) | @Test
    method testSetKnowledgeBaseId (line 23) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/KnowledgeBaseDetailTest.java
  class KnowledgeBaseDetailTest (line 7) | public class KnowledgeBaseDetailTest {
    method setUp (line 12) | @Before
    method testSetGetId (line 18) | @Test
    method testSetGetName (line 24) | @Test
    method testSetGetDescription (line 30) | @Test
    method testSetGetConfig (line 36) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/KnowledgeBaseListRequestTest.java
  class KnowledgeBaseListRequestTest (line 7) | public class KnowledgeBaseListRequestTest {
    method setUp (line 11) | @Before
    method testGetMarker (line 17) | @Test
    method testGetMaxKeys (line 22) | @Test
    method testGetKeyword (line 27) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/KnowledgeBaseListResponseTest.java
  class KnowledgeBaseListResponseTest (line 7) | public class KnowledgeBaseListResponseTest {
    method setUp (line 12) | @Before
    method testRequestId (line 33) | @Test
    method testData (line 38) | @Test
    method testMarker (line 49) | @Test
    method testIsTruncated (line 54) | @Test
    method testNextMarker (line 59) | @Test
    method testMaxKeys (line 64) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/knowledgebase/KnowledgeBaseModifyRequestTest.java
  class KnowledgeBaseModifyRequestTest (line 8) | public class KnowledgeBaseModifyRequestTest {
    method setUp (line 12) | @Before
    method testSetGetKnowledgeBaseId (line 17) | @Test
    method testSetGetName (line 23) | @Test
    method testSetGetDescription (line 29) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/rag/EventContentTest.java
  class EventContentTest (line 11) | public class EventContentTest {
    method setUp (line 15) | @Before
    method testGetSetEventCode (line 20) | @Test
    method testGetSetEnentMessage (line 26) | @Test
    method testGetSetNodeName (line 32) | @Test
    method testGetSetDependencyNodes (line 38) | @Test
    method testGetSetEventType (line 45) | @Test
    method testGetSetEventId (line 51) | @Test
    method testGetSetEventStatus (line 57) | @Test
    method testGetSetContentType (line 63) | @Test
    method testGetSetOutputs (line 69) | @Test
    method testGetSetDetail (line 77) | @Test
    method testToString (line 85) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/rag/RAGResponseTest.java
  class RAGResponseTest (line 8) | public class RAGResponseTest {
    method setUp (line 12) | @Before
    method testSetGetCode (line 17) | @Test
    method testSetGetMessage (line 23) | @Test
    method testSetGetTraceId (line 29) | @Test
    method testSetGetTime (line 35) | @Test
    method testSetGetResult (line 41) | @Test
    method testToString (line 48) | @Test

FILE: java/src/test/java/com/baidubce/appbuilder/model/rag/RAGResultTest.java
  class RAGResultTest (line 11) | public class RAGResultTest {
    method setUp (line 15) | @Before
    method testSetGetAnswer (line 20) | @Test
    method testSetGetConversationId (line 26) | @Test
    method testSetGetMessageId (line 32) | @Test
    method testSetGetIsCompletion (line 38) | @Test
    method testSetGetPrototype (line 44) | @Test
    method testSetGetContent (line 50) | @Test
    method testToString (line 62) | @Test

FILE: python/__init__.py
  class PythonVersionChecker (line 24) | class PythonVersionChecker:
    method __init__ (line 25) | def __init__(self):
    method check_version (line 30) | def check_version(self):
  class SDKReportConfig (line 42) | class SDKReportConfig(pydantic.BaseModel):
  function get_default_header (line 49) | def get_default_header(mcp_context: str = None):

FILE: python/core/_client.py
  class HTTPClient (line 40) | class HTTPClient:
    method __init__ (line 43) | def __init__(
    method _init_gateway_url (line 67) | def _init_gateway_url(self, gateway: str):
    method _init_gateway_url_v2 (line 75) | def _init_gateway_url_v2(self, gateway_v2: str):
    method _init_secret_key (line 92) | def _init_secret_key(self, secret_key: str):
    method check_response_header (line 110) | def check_response_header(response: requests.Response):
    method service_url (line 169) | def service_url(self, sub_path: str, prefix: str = None):
    method service_url_v2 (line 181) | def service_url_v2(self, sub_path: str, client_token: str = None):
    method check_response_json (line 202) | def check_response_json(data: dict):
    method check_console_response (line 213) | def check_console_response(response: requests.Response):
    method auth_header (line 224) | def auth_header(self, request_id: Optional[str] = None):
    method auth_header_v2 (line 236) | def auth_header_v2(self, request_id: Optional[str] = None, mcp_context...
    method response_request_id (line 249) | def response_request_id(response: requests.Response):
    method check_param (line 254) | def check_param(func):
    method classify_exception (line 275) | def classify_exception(e):
  class AsyncHTTPClient (line 298) | class AsyncHTTPClient(HTTPClient):
    method __init__ (line 299) | def __init__(self, secret_key=None, gateway="", gateway_v2=""):
    method check_response_header (line 304) | async def check_response_header(response: ClientResponse):
    method response_request_id (line 359) | async def response_request_id(response: ClientResponse):
    method classify_exception (line 364) | async def classify_exception(e):
  class AssistantHTTPClient (line 385) | class AssistantHTTPClient(HTTPClient):
    method service_url (line 386) | def service_url(self, sub_path: str, prefix: str = None):
    method auth_header (line 400) | def auth_header(self, request_id: Optional[str] = None):
    method check_assistant_response (line 421) | def check_assistant_response(request_id, data):

FILE: python/core/_exception.py
  class BaseRPCException (line 20) | class BaseRPCException(Exception):
  class BadRequestException (line 26) | class BadRequestException(BaseRPCException):
  class UnAuthorizedException (line 32) | class UnAuthorizedException(BaseRPCException):
  class ForbiddenException (line 38) | class ForbiddenException(BaseRPCException):
  class NotFoundException (line 44) | class NotFoundException(BaseRPCException):
  class MethodNotAllowedException (line 49) | class MethodNotAllowedException(BaseRPCException):
  class ConflictException (line 55) | class ConflictException(BaseRPCException):
  class MissingContentLengthException (line 61) | class MissingContentLengthException(BaseRPCException):
  class PreconditionFailedException (line 67) | class PreconditionFailedException(BaseRPCException):
  class UnprocessableEntityException (line 73) | class UnprocessableEntityException(BaseRPCException):
  class DependencyFailedException (line 79) | class DependencyFailedException(BaseRPCException):
  class TooManyRequestsException (line 85) | class TooManyRequestsException(BaseRPCException):
  class InternalServerErrorException (line 90) | class InternalServerErrorException(BaseRPCException):
  class InsufficientStorageException (line 96) | class InsufficientStorageException(BaseRPCException):
  class HTTPConnectionException (line 101) | class HTTPConnectionException(BaseRPCException):
  class ModelNotSupportedException (line 107) | class ModelNotSupportedException(BaseRPCException):
  class TypeNotSupportedException (line 113) | class TypeNotSupportedException(BaseRPCException):
  class AppBuilderServerException (line 119) | class AppBuilderServerException(BaseRPCException):
    method __init__ (line 125) | def __init__(self, request_id="", code="", message="", service_err_cod...
    method __str__ (line 130) | def __str__(self):
  class AssistantServerException (line 133) | class AssistantServerException(BaseRPCException):
    method __init__ (line 139) | def __init__(self, request_id= "", code="", message="", type="", param...
    method __str__ (line 144) | def __str__(self):
  class InvalidRequestArgumentError (line 148) | class InvalidRequestArgumentError(BaseRPCException):
    method __init__ (line 154) | def __init__(self, message="", request_id= "", code=""):
    method __str__ (line 159) | def __str__(self):
  class RiskInputException (line 163) | class RiskInputException(BaseRPCException):
  class AppbuilderBuildexException (line 169) | class AppbuilderBuildexException(BaseRPCException):
  class AppbuilderTraceException (line 175) | class AppbuilderTraceException(BaseRPCException):
  class RetryableExecption (line 180) | class RetryableExecption(Exception):
  class InternalServerException (line 185) | class InternalServerException(BaseRPCException):
  class NoFileUploadedExecption (line 190) | class NoFileUploadedExecption(Exception):
  class CustomError (line 195) | class CustomError(Exception):
    method __init__ (line 198) | def __init__(self, code, message=""):
    method __str__ (line 210) | def __str__(self):

FILE: python/core/_session.py
  class InnerSession (line 23) | class InnerSession(requests.sessions.Session):
    method __init__ (line 25) | def __init__(self, *args, **kwargs):
    method build_curl (line 31) | def build_curl(self, request: requests.PreparedRequest) -> str:
    method send (line 55) | def send(self, request, **kwargs):
    method post (line 63) | def post(self, url, data=None, json=None, **kwargs):
    method delete (line 67) | def delete(self, url, **kwargs):
    method get (line 71) | def get(self, url, **kwargs):
    method put (line 75) | def put(self, url, data=None, **kwargs):
  class AsyncInnerSession (line 79) | class AsyncInnerSession(ClientSession):
    method __init__ (line 81) | def __init__(self, *args, **kwargs):
    method build_curl (line 87) | async def build_curl(self, method, url, data=None, json_data=None, **k...
    method post (line 112) | async def post(self, url, data=None, json=None, **kwargs):
    method delete (line 116) | async def delete(self, url, **kwargs):
    method get (line 120) | async def get(self, url, **kwargs):
    method put (line 124) | async def put(self, url, data=None, **kwargs):

FILE: python/core/agent.py
  class AgentRuntime (line 35) | class AgentRuntime(BaseModel):
    class Config (line 206) | class Config:
    method init (line 219) | def init(cls, values: Dict) -> Dict:
    method chat (line 236) | def chat(self, message: Message, stream: bool = False, **args) -> Mess...
    method create_flask_app (line 250) | def create_flask_app(self, url_rule="/chat"):
    method serve (line 435) | def serve(self, host='0.0.0.0', debug=True, port=8092, url_rule="/chat"):
    method prepare_chainlit_readme (line 451) | def prepare_chainlit_readme(self):
    method chainlit_demo (line 484) | def chainlit_demo(self, host='0.0.0.0', port=8091):
    method chainlit_agent (line 532) | def chainlit_agent(self, host='0.0.0.0', port=8091):

FILE: python/core/assistant/assistants/assistants.py
  class Assistants (line 24) | class Assistants(object):
    method __init__ (line 25) | def __init__(self):
    method files (line 29) | def files(self):
    method create (line 43) | def create(self,
    method update (line 106) | def update(self,
    method list (line 173) | def list(self,
    method query (line 220) | def query(self,
    method delete (line 258) | def delete(self,
    method mount_files (line 296) | def mount_files(self,
    method mounted_files_list (line 347) | def mounted_files_list(self,
    method unmount_files (line 394) | def unmount_files(self,

FILE: python/core/assistant/assistants/files.py
  class Files (line 27) | class Files(object):
    method __init__ (line 28) | def __init__(self):
    method create (line 32) | def create(self, file_path: str, purpose: str = "assistant") -> assist...
    method list (line 77) | def list(self) -> assistant_type.AssistantFilesListResponse:
    method query (line 128) | def query(self,
    method delete (line 173) | def delete(self,
    method download (line 205) | def download(self,
    method content (line 273) | def content(self,

FILE: python/core/assistant/base.py
  class BetaAssistant (line 16) | class BetaAssistant(object):
    method assistants (line 18) | def assistants(self):
    method threads (line 23) | def threads(self):
    method type (line 28) | def type(self):
    method assistant_type (line 33) | def assistant_type(self):
    method thread_type (line 38) | def thread_type(self):
    method public_type (line 43) | def public_type(self):

FILE: python/core/assistant/threads/messages/messages.py
  class Messages (line 22) | class Messages(object):
    method __init__ (line 23) | def __init__(self):
    method create (line 27) | def create(self,
    method update (line 73) | def update(self,
    method list (line 117) | def list(self,
    method query (line 164) | def query(self,
    method files (line 201) | def files(self,

FILE: python/core/assistant/threads/runs/runs.py
  class Runs (line 29) | class Runs():
    method __init__ (line 30) | def __init__(self) -> None:
    method steps (line 34) | def steps(self) -> Steps:
    method run (line 48) | def run(self,
    method _stream (line 146) | def _stream(self,
    method stream_run (line 246) | def stream_run(self,
    method stream_run_with_handler (line 312) | def stream_run_with_handler(self,
    method _iterate_events (line 379) | def _iterate_events(self, events):
    method submit_tool_outputs (line 414) | def submit_tool_outputs(self,
    method cancel (line 456) | def cancel(self, run_id: str, thread_id: str, sync: bool = False) -> t...
    method list (line 494) | def list(self, thread_id: str, limit: int = 20,
    method query (line 539) | def query(self, thread_id: str, run_id: str) -> thread_type.RunResult:

FILE: python/core/assistant/threads/runs/steps.py
  class Steps (line 23) | class Steps():
    method __init__ (line 24) | def __init__(self) -> None:
    method list (line 28) | def list(self, thread_id: str, run_id: str, limit: int = 20,
    method query (line 68) | def query(self, thread_id: str, run_id: str, step_id: str) -> thread_t...

FILE: python/core/assistant/threads/runs/stream_helper.py
  class StreamRunContext (line 22) | class StreamRunContext(object):
    method __init__ (line 42) | def __init__(self) -> None:
    method current_event (line 57) | def current_event(self) -> Union[thread_type.StreamRunStatus,
    method set_current_event (line 73) | def set_current_event(self, event):
    method current_tool_calls (line 94) | def current_tool_calls(self) -> Union[list[thread_type.ToolCall], None]:
    method set_current_tool_calls (line 107) | def set_current_tool_calls(self, tool_calls):
    method current_run_id (line 130) | def current_run_id(self) -> Union[str, None]:
    method set_current_run_id (line 143) | def set_current_run_id(self, run_id):
    method current_run_step_id (line 165) | def current_run_step_id(self) -> Union[str, None]:
    method set_current_run_step_id (line 178) | def set_current_run_step_id(self, run_step_id):
    method current_thread_id (line 201) | def current_thread_id(self) -> Union[str, None]:
    method set_current_thread_id (line 214) | def set_current_thread_id(self, thread_id):
    method current_assistant_id (line 236) | def current_assistant_id(self) -> Union[str, None]:
    method set_current_assistant_id (line 249) | def set_current_assistant_id(self, assistant_id):
    method reset_step_context (line 270) | def reset_step_context(self):
  class AssistantEventHandler (line 286) | class AssistantEventHandler():
    method _init (line 304) | def _init(self, response):
    method __stream__ (line 311) | def __stream__(self) -> Iterator[Union[
    method __stream_event_process__ (line 334) | def __stream_event_process__(self, event) -> Union[
    method __timeout_process__ (line 400) | def __timeout_process__(self, event):
    method __next__ (line 404) | def __next__(self) -> Optional[str]:
    method __iter__ (line 407) | def __iter__(self):
    method until_done (line 411) | def until_done(self):
    method _before_run_begin (line 428) | def _before_run_begin(self, stream_run_status):
    method _before_tool_calls (line 436) | def _before_tool_calls(self, stream_run_status):
    method _before_tool_step (line 440) | def _before_tool_step(self, stream_run_status):
    method messages (line 444) | def messages(self, messages_event: thread_type.StreamRunMessage):
    method tool_calls (line 459) | def tool_calls(self, status_event: thread_type.StreamRunStatus):
    method tool_submitted_output (line 474) | def tool_submitted_output(self, status_event: thread_type.StreamRunSta...
    method message_creation (line 489) | def message_creation(self, status_event: thread_type.StreamRunStatus):
    method run_begin (line 504) | def run_begin(self, status_event: thread_type.StreamRunStatus):
    method run_end (line 519) | def run_end(self, status_event: thread_type.StreamRunStatus):
    method tool_step_begin (line 534) | def tool_step_begin(self, status_event: thread_type.StreamRunStatus):
    method tool_step_end (line 549) | def tool_step_end(self, status_event: thread_type.StreamRunStatus):
    method run_cancelling (line 564) | def run_cancelling(self, status_event: thread_type.StreamRunStatus):
  class AssistantStreamManager (line 580) | class AssistantStreamManager(AssistantEventHandler):
    method __init__ (line 581) | def __init__(
    method __enter__ (line 590) | def __enter__(self) -> AssistantEventHandler:
    method __exit__ (line 593) | def __exit__(self, exc_type, exc_value, traceback) -> None:

FILE: python/core/assistant/threads/threads.py
  class Threads (line 22) | class Threads():
    method __init__ (line 23) | def __init__(self) -> None:
    method messages (line 27) | def messages(self) -> Messages:
    method runs (line 41) | def runs(self) -> Runs:
    method create (line 54) | def create(self, messages: Optional[list[thread_type.AssistantMessage]...
    method query (line 93) | def query(self,
    method delete (line 128) | def delete(self,
    method update (line 160) | def update(self,

FILE: python/core/assistant/type/assistant_type.py
  class AssistantFilesCreateResponse (line 25) | class AssistantFilesCreateResponse(BaseModel):
  class AuditStatus (line 34) | class AuditStatus(int,Enum):
  class AssistantFilesListData (line 44) | class AssistantFilesListData(BaseModel):
  class AssistantFilesListResponse (line 56) | class AssistantFilesListResponse(BaseModel):
  class AssistantFilesQueryResponse (line 61) | class AssistantFilesQueryResponse(BaseModel):
  class AssistantFilesDeleteResponse (line 72) | class AssistantFilesDeleteResponse(BaseModel):
  class AssistantCreateRequest (line 78) | class AssistantCreateRequest(BaseModel):
  class AssistantCreateResponse (line 92) | class AssistantCreateResponse(BaseModel):
  class AssistantUpdateRequest (line 106) | class AssistantUpdateRequest
Copy disabled (too large) Download .json
Condensed preview — 882 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (11,148K chars).
[
  {
    "path": ".env_template",
    "chars": 200,
    "preview": "# rename this file to .env\n\nAPPBUILDER_TOKEN=your-token\nAPPBUILDER_TOKEN_V2=your-token\nBAIDU_VDB_API_KEY=your-token\nINST"
  },
  {
    "path": ".github/workflows/python-package.yml",
    "chars": 15965,
    "preview": "# This workflow will install Python dependencies, run tests and lint with a variety of Python versions\n# For more inform"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 1696,
    "preview": "# Contributing to AppBuilder\n\nThanks for your interest in contributing to AppBuilder!  Please follow these guidelines to"
  },
  {
    "path": "LICENSE",
    "chars": 11366,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "NEW_README.md",
    "chars": 4295,
    "preview": "<div align=\"center\">\n<img src='docs/image/logo.png' alt='logo' width='700' >\n<br>\n\n[![License](https://img.shields.io/ba"
  },
  {
    "path": "README.md",
    "chars": 14810,
    "preview": "<div align=\"center\">\n<img src='docs/image/logo.png' alt='logo' width='700' >\n<br>\n\n[![License](https://img.shields.io/ba"
  },
  {
    "path": "cookbooks/README.md",
    "chars": 1765,
    "preview": "# AppBuilder-SDK Cookbook\n\n## Cookbook目录\n\n### 基础组件\n- [短语音识别组件-asr](/cookbooks/components/asr.ipynb)\n- [gbi - 自动选表问表](/co"
  },
  {
    "path": "cookbooks/advanced_application/agent_speech.ipynb",
    "chars": 12029,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# 实时语音对话能力\\n\",\n    \"**注意⚠️:实时语音功能目前"
  },
  {
    "path": "cookbooks/advanced_application/cloud_deploy.ipynb",
    "chars": 5578,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# 公有云部署AppBuilderSDK\\n\",\n    \"**注意⚠"
  },
  {
    "path": "cookbooks/agent_builder.ipynb",
    "chars": 5804,
    "preview": "{\n \"cells\": [\n  {\n   \"attachments\": {},\n   \"cell_type\": \"markdown\",\n   \"id\": \"42eace26869295fb\",\n   \"metadata\": {\n    \"c"
  },
  {
    "path": "cookbooks/appbuilder_trace/trace.ipynb",
    "chars": 6427,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# 使用Appbuilder-SDK Trace框架实现对Client"
  },
  {
    "path": "cookbooks/components/agent_runtime.ipynb",
    "chars": 30178,
    "preview": "{\n \"cells\": [\n  {\n   \"attachments\": {},\n   \"cell_type\": \"markdown\",\n   \"id\": \"f802e64d-4eaa-445d-a48a-1042a91bc394\",\n   "
  },
  {
    "path": "cookbooks/components/asr.ipynb",
    "chars": 3666,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {\n    \"collapsed\": true,\n    \"pycharm\": {\n     \"name\": \"#%%"
  },
  {
    "path": "cookbooks/components/gbi.ipynb",
    "chars": 14531,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"f802e64d-4eaa-445d-a48a-1042a91bc394\",\n   \"metadata\": {\n    \"tag"
  },
  {
    "path": "cookbooks/components/general_ocr.ipynb",
    "chars": 4903,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"source\": [\n    \"# 通用文字识别-高精度版组件\\n\",\n    \"\\n\",\n    \"## 目标\\n\",\n    \"使用通用"
  },
  {
    "path": "cookbooks/components/object_recognize.ipynb",
    "chars": 5072,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {\n    \"collapsed\": true,\n    \"pycharm\": {\n     \"name\": \"#%%"
  },
  {
    "path": "cookbooks/components/rag_with_baidusearch.ipynb",
    "chars": 4899,
    "preview": "{\n \"cells\": [\n  {\n   \"attachments\": {},\n   \"cell_type\": \"markdown\",\n   \"id\": \"f802e64d-4eaa-445d-a48a-1042a91bc394\",\n   "
  },
  {
    "path": "cookbooks/components/text_generation.ipynb",
    "chars": 7412,
    "preview": "{\n \"cells\": [\n  {\n   \"attachments\": {},\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# 文本生成\\n\",\n  "
  },
  {
    "path": "cookbooks/components/translate.ipynb",
    "chars": 12269,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {\n    \"collapsed\": true,\n    \"pycharm\": {\n     \"name\": \"#%%"
  },
  {
    "path": "cookbooks/components/vdb_retriever.ipynb",
    "chars": 4052,
    "preview": "{\n \"cells\": [\n  {\n   \"attachments\": {},\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# VectorDB\\n\""
  },
  {
    "path": "cookbooks/end2end_application/agent/appbuilder_client.ipynb",
    "chars": 7675,
    "preview": "{\n \"cells\": [\n  {\n   \"attachments\": {},\n   \"cell_type\": \"markdown\",\n   \"id\": \"42eace26869295fb\",\n   \"metadata\": {\n    \"c"
  },
  {
    "path": "cookbooks/end2end_application/agent/chatflow.ipynb",
    "chars": 16199,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# 前言 - 学习本项目你可以获得什么\\n\",\n    \"- 入门百度"
  },
  {
    "path": "cookbooks/end2end_application/agent/tool_call.ipynb",
    "chars": 53863,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"<img src=\\\"https://chengmo-dev1.bj."
  },
  {
    "path": "cookbooks/end2end_application/agent/tool_choice.ipynb",
    "chars": 16889,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# AppBuilder-SDK 指定工具调用使用实例\\n\",\n   "
  },
  {
    "path": "cookbooks/end2end_application/rag/console_dataset.ipynb",
    "chars": 4319,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"bd16bc4e-9e7a-4119-a9e8-55b1adb7b560\",\n   \"metadata\": {},\n   \"so"
  },
  {
    "path": "cookbooks/end2end_application/rag/console_rag.ipynb",
    "chars": 3000,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"f802e64d-4eaa-445d-a48a-1042a91bc394\",\n   \"metadata\": {\n    \"tag"
  },
  {
    "path": "cookbooks/end2end_application/rag/qa_system_1_dataset.ipynb",
    "chars": 12346,
    "preview": "{\n \"cells\": [\n  {\n   \"attachments\": {},\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# 企业级问答系统 —— "
  },
  {
    "path": "cookbooks/end2end_application/rag/qa_system_2_dialogue.ipynb",
    "chars": 11098,
    "preview": "{\n \"cells\": [\n  {\n   \"attachments\": {},\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# 企业级问答系统 —— "
  },
  {
    "path": "cookbooks/end2end_application/rag/rag.ipynb",
    "chars": 7294,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"f802e64d-4eaa-445d-a48a-1042a91bc394\",\n   \"metadata\": {\n    \"tag"
  },
  {
    "path": "cookbooks/live_broadcast_material/2024_05_16/agent_run.py",
    "chars": 2196,
    "preview": "# Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\")"
  },
  {
    "path": "cookbooks/live_broadcast_material/2024_05_16/chatbot.py",
    "chars": 4853,
    "preview": "# Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\")"
  },
  {
    "path": "cookbooks/live_broadcast_material/2024_05_16/service_deploy.py",
    "chars": 835,
    "preview": "# Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\")"
  },
  {
    "path": "cookbooks/live_broadcast_material/2024_05_16/two_agent.py",
    "chars": 2089,
    "preview": "# Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\")"
  },
  {
    "path": "cookbooks/live_broadcast_material/2024_08_22/README.md",
    "chars": 374,
    "preview": "- AppBuilderClient-Tool Call\n  - [本地调用内网tool工具](tool_call_1.ipynb)\n  - [调用Agent执行本地命令](tool_call_2.ipynb)\n  - [使用AppBuil"
  },
  {
    "path": "cookbooks/live_broadcast_material/2024_08_22/knowledgebase.ipynb",
    "chars": 18568,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# AppBuilder-Knowledge:生产环境的知识库/文档/"
  },
  {
    "path": "cookbooks/live_broadcast_material/2024_08_22/tool_call_1.ipynb",
    "chars": 9164,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# 本地调用内网tool工具\\n\",\n    \"\\n\",\n    \"在"
  },
  {
    "path": "cookbooks/live_broadcast_material/2024_08_22/tool_call_2.ipynb",
    "chars": 14800,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# 本地调用tool工具-调用Agent执行本地命令\\n\",\n    "
  },
  {
    "path": "cookbooks/live_broadcast_material/2024_08_22/tool_call_3.ipynb",
    "chars": 5912,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# 本地调用tool工具-使用AppBuilderEventHandl"
  },
  {
    "path": "cookbooks/live_broadcast_material/2024_08_22/tool_call_4.ipynb",
    "chars": 5510,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# 本地调用tool工具-使用AppBuilderEventHandl"
  },
  {
    "path": "cookbooks/live_broadcast_material/2024_08_22/trace.ipynb",
    "chars": 31310,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# AppBuilder-Trace:更友好易用的可视化Debug方法"
  },
  {
    "path": "cookbooks/live_broadcast_material/2024_12_18/rag_knowledgebase_01.ipynb",
    "chars": 15713,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# AppBuilder-Knowledge:生产环境的知识库/文档/"
  },
  {
    "path": "cookbooks/mcp/app_mcp_server.ipynb",
    "chars": 9959,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"8ce67390\",\n   \"metadata\": {},\n   \"source\": [\n    \"# 前言\\n\",\n    \""
  },
  {
    "path": "cookbooks/mcp/baidu_map.ipynb",
    "chars": 34279,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"8ce67390\",\n   \"metadata\": {},\n   \"source\": [\n    \"# MCP协议加持,千帆Ap"
  },
  {
    "path": "cookbooks/mcp/client.ipynb",
    "chars": 11119,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# 前言-学习本项目你可以获得什么\\n\",\n    \"- 理论学习:了"
  },
  {
    "path": "cookbooks/mcp/knowledge_base_mcp_server.ipynb",
    "chars": 8415,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"8ce67390\",\n   \"metadata\": {},\n   \"source\": [\n    \"# 前言\\n\",\n    \""
  },
  {
    "path": "cookbooks/mcp/server.ipynb",
    "chars": 8723,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# 前言-学习本项目你可以获得什么\\n\",\n    \"- 理论学习:了"
  },
  {
    "path": "cookbooks/pipeline/assistant.ipynb",
    "chars": 16645,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Assistant\\n\",\n    \"\\n\",\n    \"本文档描"
  },
  {
    "path": "cookbooks/pipeline/assistant_function_call.ipynb",
    "chars": 8876,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# AppBuilder Assistant SDK Function"
  },
  {
    "path": "cookbooks/pipeline/file.ipynb",
    "chars": 7188,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# File\\n\",\n    \"\\n\",\n    \"本文档描述与 Fi"
  },
  {
    "path": "cookbooks/pipeline/message.ipynb",
    "chars": 5046,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Message\\n\",\n    \"\\n\",\n    \"本文档描述 "
  },
  {
    "path": "cookbooks/pipeline/run.ipynb",
    "chars": 7401,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Run\\n\",\n    \"\\n\",\n    \"本文档描述 Assi"
  },
  {
    "path": "cookbooks/pipeline/thread.ipynb",
    "chars": 4010,
    "preview": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Thread\\n\",\n    \"\\n\",\n    \"本文档描述 A"
  },
  {
    "path": "docs/Application/Agent/BasicKnowledge/agent.md",
    "chars": 31049,
    "preview": "# console端Agent操作工具(Agent)\n\n## 简介\n\nAIAgent是能够感知环境,基于目标进行决策并执行动作的智能化应用。不同于传统人工智能应用(主要指以规则引擎、机器学习、深度学习等技术为核心)和RPA机器人,AIAge"
  },
  {
    "path": "docs/Application/Agent/ToolCall/tool_call.md",
    "chars": 18279,
    "preview": "# Agent 本地ToolCall(Functioncall)\n\n## 概述\n\n### 什么是ToolCall\n\n解释该问题,需要了解以下的知识点:`Agent工具` -> `FunctionCall` - `ToolCall`\n\nAIA"
  },
  {
    "path": "docs/Application/Agent/ToolChoice/tool_choice.md",
    "chars": 4538,
    "preview": "# ToolChoice\n\n#### Run方法带ToolChoice使用示例:\n\n* 注意:当前功能为试运行阶段,可能存在如下问题,如使用过程遇到其他问题,欢迎提issue或微信群讨论。\n  * 需开启\"组件/知识库结论可直接作为回复\"\n"
  },
  {
    "path": "docs/Application/Agent/UseOfficialComponents/use_official_components.md",
    "chars": 1203,
    "preview": "# Client应用调用官方组件\n\n## 简介 \n\nAgent是基于线上Agent应用的问答组件,可以使用该组件利用线上Agent应用进行问答,同时可以在线上为Client应用添加组件,丰富Agent能力。\n\n## Agent添加Compo"
  },
  {
    "path": "docs/Application/RAG/BasicKnowledge/rag.md",
    "chars": 7803,
    "preview": "# console端RAG操作工具(RAG)\n\n## 简介\n\nRAG是基于线上RAG应用的问答组件,可以使用该组件利用线上RAG应用进行问答。<br>\n<span style=\"color:red\">\n⚠️本组件仅适用于2024-04-02"
  },
  {
    "path": "docs/Application/RAG/DatasetManage/dataset_manage.md",
    "chars": 1309,
    "preview": "# console端知识库操作助手\n\n## 目标\n用户可通过SDK对console端知识库进行操作,实现创建知识库、添加知识文档、查询知识库文档、删除知识文档等操作,可在平台console中查看结果。\n\n```python\n#  设置环境变"
  },
  {
    "path": "docs/BasisModule/Components/Components.md",
    "chars": 36,
    "preview": "# 组件文档\n\n- 当前目录为Appbuilder-SDK的组件文档目录"
  },
  {
    "path": "docs/BasisModule/Components/animal_recognize/README.md",
    "chars": 2978,
    "preview": "# 动物识别 (AnimalRecognition) \n\n## 简介\n动物识别 (AnimalRecognition) 支持对于输入的一张图片(可正常解码),输出动物识别结果。\n\n### 功能介绍\n* 识别动物名称\n\n  识别近八千种动物,"
  },
  {
    "path": "docs/BasisModule/Components/asr/README.md",
    "chars": 2077,
    "preview": "# 短语音识别-极速版 (Automatic Speech Recognition) \n\n## 简介\n短语音识别 (Automatic Speech Recognition) 可以将音频流实时识别为文字,并返回每句话的开始和结束时间,适用于"
  },
  {
    "path": "docs/BasisModule/Components/dish_recognize/README.md",
    "chars": 2228,
    "preview": "# 菜品识别(DishRecognition)\n\n## 简介\n菜品识别组件(DishRecognition)可以识别超过9千种菜品,可准确识别图片中的菜品名称、卡路里,适用于多种客户识别菜品的业务场景中。\n\n### 功能介绍\n识别超过9千种"
  },
  {
    "path": "docs/BasisModule/Components/doc_crop_enhance/README.md",
    "chars": 3778,
    "preview": "# 文档矫正增强 (DocCropEnhance) \n\n## 简介\n文档矫正增强 (DocCropEnhance) 可对图片中的文件、卡证、票据等内容进行四角点检测定位,提取主体内容并对其进行矫正,同时可选图片增强效果进一步提升图片清晰度,"
  },
  {
    "path": "docs/BasisModule/Components/doc_format_converter/README.md",
    "chars": 1848,
    "preview": "# 文档格式转换 (DocFormatConverter)\n\n## 简介\n文档格式转换:识别文档内文字及版面布局,可将多种类型的版式文档转换为流式文档。\n\n### 功能介绍\n支持识别图片中文档版面布局,提取文字内容,并转换为保留原文档版式的"
  },
  {
    "path": "docs/BasisModule/Components/doc_parser/README.md",
    "chars": 6231,
    "preview": "# 文档解析(DocParser)\n\n## 简介\n文档解析组件(DocParser)可以用于文档内容解析,支持PDF、JPG、DOC、TXT、XLS、PPT等16种文档格式的内容解析。\n\n### 功能介绍\n文档解析组件(DocParser)"
  },
  {
    "path": "docs/BasisModule/Components/doc_splitter/README.md",
    "chars": 4614,
    "preview": "# 文档切分(DocSplitter)\n\n## 简介\n文档切分组件(DocSplitter)可以用于对文档进行段落切分。\n\n### 功能介绍\n对解析后的文档,支持将文档划分为多个段落,便于后续处理和分析。\n目前支持的文档切分类型splitt"
  },
  {
    "path": "docs/BasisModule/Components/document_understanding/README.md",
    "chars": 5095,
    "preview": "# 长文档内容理解(DocumentUnderstanding)\n\n## 简介\n长文档内容理解组件(DocumentUnderstanding)支持对图片以及文档内容进行理解,并基于图片以及文档内容对用户的提问进行回答,\n包括但不限于文档内"
  },
  {
    "path": "docs/BasisModule/Components/embeddings/README.md",
    "chars": 3527,
    "preview": "# 向量计算(Embedding)\n\n## 简介\n\n向量计算组件(Embedding)支持将文本转化为用数值表示的向量形式,用于文本检索、信息推荐、知识挖掘等场景。嵌入(Embedding)是一种在机器学习和自然语言处理中常用的技术,主要用"
  },
  {
    "path": "docs/BasisModule/Components/extract_table/README.md",
    "chars": 2439,
    "preview": "# 表格抽取组件(ExtractTableFromDoc)\n\n## 简介\n表格抽取组件(ExtractTableFromDoc)是用于文档表格处理的组件,从文档中抽取表格。支持对文档表格大小进行限制,限制后自动进行拆分、跨页合并等处理;支持"
  },
  {
    "path": "docs/BasisModule/Components/gbi/nl2sql/README.md",
    "chars": 6423,
    "preview": "# GBI 问表\n\n## 简介\nGBI 问表,根据提供的 mysql 表的 schema 信息,生成对应问题的 sql 语句。\n\n### 功能介绍\nGBI 问表,根据提供的 mysql 表的 schema 信息,生成对应问题的 sql 语句"
  },
  {
    "path": "docs/BasisModule/Components/gbi/select_table/README.md",
    "chars": 2917,
    "preview": "# GBI 选表\n\n## 简介\nGBI 选表:根据提供的多个 MySql 表名 以及 表名对应的描述信息,通过 query 选择一个或多个最合适的表来回答该 query。\n一般的适用场景是,当有数据库有多个表的时候,但是实际只有1个表能回答"
  },
  {
    "path": "docs/BasisModule/Components/general_ocr/README.md",
    "chars": 3173,
    "preview": "# 通用文字识别-高精度版(GeneralOCR)\n\n## 简介\n\n通用文字识别组件(GeneralOCR)支持多场景、多语种、高精度的文字识别服务,对图片全部文字内容进行检测识别。\n\n### 功能介绍\n覆盖多种通用场景、20+种语言的高精"
  },
  {
    "path": "docs/BasisModule/Components/handwrite_ocr/README.md",
    "chars": 3438,
    "preview": "# 手写文字识别 (HandwriteOCR)\n\n## 简介\n手写文字识别 (HandwriteOCR),图片中的手写中文、手写数字进行检测和识别,针对不规则的手写字体进行专项优化,识别准确率可达90%以上。\n\n\n### 功能介绍\n检测识别"
  },
  {
    "path": "docs/BasisModule/Components/image_understand/README.md",
    "chars": 2630,
    "preview": "# 图像内容理解 (ImageUnderstand)\n\n## 简介\n图像内容理解 (ImageUnderstand),输出理解图片后的文本信息\n### 功能介绍\n支持输入图片和提问信息,可对输入图片进行理解,输出对图片的一句话描述\n### "
  },
  {
    "path": "docs/BasisModule/Components/landmark_recognize/README.md",
    "chars": 2197,
    "preview": "# 地标识别(LandmarkRecognition)\n\n## 简介\n地标识别组件(LandmarkRecognition)可以识别12万中外著名地标、热门景点,可返回地标名称。\n\n### 功能介绍\n识别中外著名地标、热门景点,可返回地标名"
  },
  {
    "path": "docs/BasisModule/Components/llms/dialog_summary/README.md",
    "chars": 1885,
    "preview": "# 会话小结(DialogSummary)\n\n## 简介\n会话小结(DialogSummary)基于生成式大模型对一段用户与坐席的对话生成总结,结果按{\"诉求\": \"\", \"回应\": \"\", \"解决情况\": \"\"}格式输出。适用于运营商、金"
  },
  {
    "path": "docs/BasisModule/Components/llms/hallucination_detection/README.md",
    "chars": 2974,
    "preview": "# 幻觉检测(Hallucination Detection)\n\n## 简介\n幻觉检测(Hallucination Detection)针对问答场景,检测答案中是否存在幻觉。\n\n### 功能介绍\n幻觉检测(Hallucination Det"
  },
  {
    "path": "docs/BasisModule/Components/llms/is_complex_query/README.md",
    "chars": 1900,
    "preview": "# 复杂Query判定(IsComplexQuery)\n\n## 简介\n复杂Query判定组件(IsComplexQuery)可以根据输入的提问进行初步的分类,区分简单问题和复杂问题,以便后续运用不同的处理流程处理。可应用于知识问答场景。\n\n"
  },
  {
    "path": "docs/BasisModule/Components/llms/mrc/README.md",
    "chars": 4874,
    "preview": "# 阅读理解问答(MRC)\n\n## 简介\n阅读理解问答(MRC)组件是基于生成式大模型的阅读理解问答系统。该组件支持拒答、澄清、重点强调、友好性提升、溯源等多种功能,可用于回答用户提出的问题。\n\n### 功能介绍\nMRC(阅读理解问答模块)"
  },
  {
    "path": "docs/BasisModule/Components/llms/nl2pandas/README.md",
    "chars": 2297,
    "preview": "# 自然语言转pandas (nl2pandas)\n\n## 简介\n自然语言转pandas (nl2pandas)这个组件通过理解对表格信息的提问,生成对应语义的可执行Python代码,主要使用Pandas库。它可以用于基于表格的查询,问答等"
  },
  {
    "path": "docs/BasisModule/Components/llms/oral_query_generation/README.md",
    "chars": 3010,
    "preview": "# 口语化Query生成(Oral Query Generation)\n\n## 简介\n口语化Query生成组件(Oral Query Generation)可以基于输入文本生成与文档内容相关的Query。\n\n### 功能介绍\n基于输入文本生"
  },
  {
    "path": "docs/BasisModule/Components/llms/playground/README.md",
    "chars": 2200,
    "preview": "# 空应用(Playground)\n\n## 简介\nPlayground空应用(Playground)是一款灵活的组件,允许用户自定义prompt模板并执行。\n\n\n### 功能介绍\nPlayground空应用(Playground)是一款灵活"
  },
  {
    "path": "docs/BasisModule/Components/llms/qa_pair_mining/README.md",
    "chars": 3180,
    "preview": "# 问答对挖掘(QAPairMining)\n\n## 简介\n问答对挖掘(QAPairMining)可以基于输入文本内容,快速生成多个问题及对应答案,极大提高信息提炼的效率和准确性。广泛用于在线客服、智能问答等领域。\n\n### 功能介绍\n基于输"
  },
  {
    "path": "docs/BasisModule/Components/llms/query_decomposition/README.md",
    "chars": 1773,
    "preview": "# 复杂Query分解(QueryDecomposition)\n\n## 简介\n复杂Query分解(QueryDecomposition)可以将已经确定为复杂问题的原始问题拆解为一个个简单问题。广泛应用在知识问答场景。\n\n### 功能介绍\n在"
  },
  {
    "path": "docs/BasisModule/Components/llms/query_rewrite/README.md",
    "chars": 1951,
    "preview": "# 多轮改写 (QueryRewrite)\n\n## 简介\n多轮改写组件 (QueryRewrite) 是一个用于处理多轮对话和查询改写的组件。它主要用于理解和优化用户与机器人的交互过程,进行指代消解及省略补全。该组件支持不同的改写类型,可根"
  },
  {
    "path": "docs/BasisModule/Components/llms/similar_question/README.md",
    "chars": 1565,
    "preview": "# 相似问生成(SimilarQuestion)\n\n## 简介\n相似问生成组件(SimilarQuestion)可以用于基于输入的问题,挖掘出与该问题相关的类似问题。广泛用于客服、问答等场景。\n\n### 功能介绍\n基于输入的问题,挖掘出与该"
  },
  {
    "path": "docs/BasisModule/Components/llms/style_rewrite/README.md",
    "chars": 2001,
    "preview": "# 风格转写 (StyleRewrite)\n\n## 简介\n风格转写组件(StyleRewrite) 可以基于生成式大模型对文本的风格进行改写。支持多种文本风格,包括营销、客服、直播、激励及教学话术。\n\n\n### 功能介绍\n文本风格转写能够将"
  },
  {
    "path": "docs/BasisModule/Components/llms/style_writing/README.md",
    "chars": 2141,
    "preview": "# 风格写作(StyleWriting)\n\n## 简介\n风格写作组件(StyleWriting)是一款基于生成式大模型进行文本创作的工具,支持多种风格,包括B站、小红书等,适用于编写文案、广告等多种场景。\n\n### 功能介绍\n风格写作组件("
  },
  {
    "path": "docs/BasisModule/Components/llms/tag_extraction/README.md",
    "chars": 2064,
    "preview": "# 标签抽取(TagExtraction)\n\n## 简介\n标签抽取组件(TagExtraction)是一款高效的标签抽取组件,基于生成式大模型,专门用于从文本中提取关键标签。它适用于各种文本分析场景,如内容分类、关键词提取等。\n\n### 功"
  },
  {
    "path": "docs/BasisModule/Components/matching/README.md",
    "chars": 2226,
    "preview": "# 语义匹配(Matching)\n\n## 简介\n\n语义匹配组件(Matching)可以计算query与文本列表之间的相似度关系,并根据其进行排序。\n\n### 功能介绍\n\n根据query与文本列表之间的相似度关系,并根据其进行排序。\n\n###"
  },
  {
    "path": "docs/BasisModule/Components/mix_card_ocr/README.md",
    "chars": 6335,
    "preview": "# 身份证混贴识别(MixCardOCR)\n\n## 简介\n身份证混贴识别(MixCardOCR),身份证混贴识别支持自动检测与识别身份证正反面在同一张图片上的场景,一次识别图片中身份证正反面所有字段。\n\n\n### 功能介绍\n支持对二代居民身"
  },
  {
    "path": "docs/BasisModule/Components/object_recognize/README.md",
    "chars": 3599,
    "preview": "# 通用物体和场景识别-高级版(ObjectRecognition)\n\n## 简介\n通用物体和场景识别组件(ObjectRecognition)可以识别超过10万类常见物体和场景,接口返回大类及细分类的名称。广泛适用于图像或视频内容分析、拍"
  },
  {
    "path": "docs/BasisModule/Components/plant_recognize/README.md",
    "chars": 3008,
    "preview": "# 植物识别(PlantRecognition)\n\n## 简介\n植物识别(PlantRecognition),即对于输入的一张图片(可正常解码,且长宽比较合适),输出植物识别结果。\n\n### 功能介绍\n可识别超过2万种常见植物和近8千种花卉"
  },
  {
    "path": "docs/BasisModule/Components/ppt_generation_from_file/README.md",
    "chars": 2306,
    "preview": "# 文件生成PPT(PPTGenerationFromFile)\n\n## 简介\n文件生成PPT组件(PPTGenerationFromFile)可以根据上传的文件(支持**中英文**)生成PPT。\n\n### 功能介绍\n根据上传的文件(支持*"
  },
  {
    "path": "docs/BasisModule/Components/ppt_generation_from_instruction/README.md",
    "chars": 3127,
    "preview": "# 指令生成PPT(PPTGenerationFromInstruction)\n\n## 简介\n指令生成PPT组件(PPTGenerationFromInstruction)可以基于指令或者自定义信息生成PPT。\n\n### 功能介绍\n基于指令"
  },
  {
    "path": "docs/BasisModule/Components/ppt_generation_from_paper/README.md",
    "chars": 2834,
    "preview": "# 论文生成PPT(PPTGenerationFromPaper)\n\n## 简介\n论文生成PPT组件(PPTGenerationFromPaper)可以根据上传的论文(支持**中英文**)生成PPT。\n\n### 功能介绍\n根据上传的论文(支"
  },
  {
    "path": "docs/BasisModule/Components/qrcode_ocr/README.md",
    "chars": 4536,
    "preview": "# 二维码识别 (QRcodeOCR) \n\n## 简介\n二维码识别 (QRcodeOCR) 可对图片中的二维码、条形码进行检测和识别,返回存储的文字信息及其位置信息。\n\n\n### 功能介绍\n* 二维码识别\n\n    检测识别图片中的二维码("
  },
  {
    "path": "docs/BasisModule/Components/rag_with_baidu_search/README.md",
    "chars": 7017,
    "preview": "# 百度搜索RAG(deprecate)\n\n## 简介\n百度搜索(BaiduSearch),通过百度搜索引擎搜索相关内容。\n现推荐使用RagWithBaiduSearchPro\n|              | 旧组件(百度搜索RAG)| "
  },
  {
    "path": "docs/BasisModule/Components/rag_with_baidu_search_pro/README.md",
    "chars": 4902,
    "preview": "# 百度搜索RAG_PRO\n\n## 简介\n百度搜索RAG_PRO组件旨在解决传统生成模型在生成长文本时可能会受到信息获取不足的问题,核心思想是将百度搜索与LLM相结合,使得生成的文本可以借助检索到的信息进行增强,从而提高生成文本的质量和相关"
  },
  {
    "path": "docs/BasisModule/Components/retriever/README.md",
    "chars": 605,
    "preview": "# 向量检索\n\n## 简介\nAppbuilder提供多种向量数据库作为向量检索的底座,当前主要支持百度向量数据库、百度 ElasticSearch。\n\n### 功能介绍\n`向量检索-VDB`组件(Baidu VDB Retriever)以百"
  },
  {
    "path": "docs/BasisModule/Components/retriever/baidu_vdb/README.md",
    "chars": 3058,
    "preview": "# 向量检索-VectorDB(BaiduVectorDBRetriever)\n\n## 简介\n向量检索-VectorDB(BaiduVectorDBRetriever)基于一款百度向量数据库的内容检索组件,支持根据文本的向量的相似度进行内容"
  },
  {
    "path": "docs/BasisModule/Components/retriever/bes/README.md",
    "chars": 2499,
    "preview": "# 向量检索-BES(BaiduElasticSearchRetriever)\n\n## 简介\n向量检索-BES组件(BaiduElasticSearchRetriever)基于一款Baidu ElasticSearch的内容检索组件,支持根"
  },
  {
    "path": "docs/BasisModule/Components/retriever/reranker/README.md",
    "chars": 1928,
    "preview": "# 文本精排(Reranker)\n\n## 简介\n文本精排能力,将Query召回到的N个候选文本段落进行精排;保证与Query相关程度越高的文本段落排序越靠前,提升检索效果。\n\n### 功能介绍\n文本精排(Reranker)用于检索排序,输入"
  },
  {
    "path": "docs/BasisModule/Components/table_ocr/README.md",
    "chars": 5632,
    "preview": "# 表格文字识别 (TableOCR) \n\n## 简介\n表格文字识别 (TableOCR) 可支持识别图片中的表格内容,返回各表格的表头表尾内容、单元格文字内容及其行列位置信息,全面覆盖各类表格样式,包括常规有线表格、无线表格、含合并单元格"
  },
  {
    "path": "docs/BasisModule/Components/text_to_image/README.md",
    "chars": 2607,
    "preview": "# 文生图 (Text2Image)\n\n## 简介\n文生图(Text2Image)基于文心大模型,可以根据用户输入的文本,自动创作不限定风格的图,为内容创作者提供灵感和高质量配图。\n\n### 功能介绍\nAI一下,文字成画,AI 精准理解中文"
  },
  {
    "path": "docs/BasisModule/Components/translate/README.md",
    "chars": 9823,
    "preview": "# 文本翻译-通用版(Translation)\n\n## 简介\n\n文本翻译组件(Translation)提供多种语言互译的在线文本翻译服务。支持术语定制功能,用户可对翻译结果进行干预,快速提高翻译质量。可广泛应用于移动端、PC网站、智能硬件等"
  },
  {
    "path": "docs/BasisModule/Components/tree_mind/README.md",
    "chars": 2263,
    "preview": "# 树图 (TreeMind)\n\n## 简介\n树图(TreeMind)提供智能思维导图制作工具和丰富的模板,支持脑图、逻辑图、树形图、鱼骨图、组织架构图、时间轴、时间线等多种专业格式。\n\n### 功能介绍   \n树图(TreeMind)是一"
  },
  {
    "path": "docs/BasisModule/Components/tts/README.md",
    "chars": 7363,
    "preview": "# 短文本在线合成(TTS)\n\n## 简介\n短文本在线合成组件(TTS)提供高度拟人、流畅自然的语音合成服务,将文本朗读出来,基础音库性价比更高,精品音库听感更逼真。\n\n### 功能介绍\n提供高度拟人、流畅自然的语音合成服务。\n\n### 特"
  },
  {
    "path": "docs/BasisModule/Deployment/AgentChainlit.md",
    "chars": 146,
    "preview": "# 交互式前端部署\n\n## 基础组件基于Chainlit提供交互式前端页面\n\n请参考 [组件服务化部署](https://github.com/baidubce/app-builder/blob/master/cookbooks/compo"
  },
  {
    "path": "docs/BasisModule/Deployment/agentruntime.md",
    "chars": 4758,
    "preview": "# `AgentRuntime`类\n\n## 简介\n\nAgentRuntime 是对组件调用的服务化封装,开发者不是必须要用 AgentRuntime 才能运行自己的组件服务。但 AgentRuntime 可以快速帮助开发者服务化组件服务,并"
  },
  {
    "path": "docs/BasisModule/Deployment/cloud.md",
    "chars": 3482,
    "preview": "# 公有云部署\n**注意⚠️:部署上云功能目前处于内测阶段,使用过程中有任何问题,欢迎提issue或微信群反馈~**\n支持一键将自己的服务部署到公有云上,目前支持百度智能云。部署后可以自动生成公网ip,无需额外配置。可以用来解决以下问题:\n"
  },
  {
    "path": "docs/BasisModule/Deployment/flask.md",
    "chars": 143,
    "preview": "# API 访问\n\n## 基础组件基于Flask提供 API访问服务\n\n请参考 [组件服务化部署](https://github.com/baidubce/app-builder/blob/master/cookbooks/componen"
  },
  {
    "path": "docs/BasisModule/Deployment/usersession.md",
    "chars": 1897,
    "preview": "# `UserSession`类\n\n## 简介\n\n会话数据管理工具,实例化后将是一个全局变量。提供保存对话数据与获取历史数据的方法。\n\n## 应用场景\n\n**必须**在 AgentRuntime 启动的服务中使用。\n\n## Python基本"
  },
  {
    "path": "docs/BasisModule/Model/get_model_list.md",
    "chars": 1456,
    "preview": "# 千帆模型列表获取能力\n\n## 简介\n该能力可以通过参数控制获取用户可用的不同类型的千帆大模型名称,从而进行大模型组件的调用,该能力获取的模型名称可以直接传参到大模型组件的model字段。\n\n## 基本用法\n\n下面是模型列表获取功能的代码"
  },
  {
    "path": "docs/BasisModule/Platform/Application/appbuilder_client.md",
    "chars": 66891,
    "preview": "# AppBuilderClient组件\n\n## 简介\n\nAppBuilderClient组件支持调用在[百度智能云千帆AppBuilder](https://cloud.baidu.com/product/AppBuilder)\n平台上通"
  },
  {
    "path": "docs/BasisModule/Platform/Application/get_app_list.md",
    "chars": 3984,
    "preview": "# 获取AppBuilder已发布的应用列表\n\n## 简介\n该接口可获取用户在 AppBuilder已发布的应用列表,包括应用名称、应用描述、应用的ID、应用类型、应用发布状态等\n\n## Python基本用法\n\n### 获取app_list"
  },
  {
    "path": "docs/BasisModule/Platform/CustomComponents/component_client.md",
    "chars": 25559,
    "preview": "# ComponentClient\n\n## 简介\n\nComponentClient组件支持调用在[百度智能云千帆AppBuilder](https://cloud.baidu.com/product/AppBuilder)平台上创建的自定义"
  },
  {
    "path": "docs/BasisModule/Platform/CustomComponents/components.md",
    "chars": 225,
    "preview": "# 基础能力组件\n\n- [组件列表](https://cloud.baidu.com/doc/AppBuilder/s/Glqb6dfiz#3%E3%80%81%E5%BC%80%E9%80%9A%E7%BB%84%E4%BB%B6%E6%"
  },
  {
    "path": "docs/BasisModule/Platform/KnowledgeBase/knowledgebase.md",
    "chars": 47886,
    "preview": "# 知识库组件(KnowledgeBase)\n\n## 简介\n\n知识库组件(KnowledgeBase)是对线上知识库操作的组件,可以通过SDK实现创建知识库、添加知识文档、查询知识库文档、删除知识文档等操作,可在平台console中查看结果"
  },
  {
    "path": "docs/BasisModule/Trace/Debug.md",
    "chars": 2099,
    "preview": "# Appbuilder-SDK Debug\n\n## 打印DEBUG日志\n\n开启DEBUG日志,可以打印出更多的日志信息,方便调试,包括且不限于:请求URL、请求头、请求参数等。\n\n```bash\n# 可以设置环境变量开启\n# 开启DEBU"
  },
  {
    "path": "docs/BasisModule/Trace/README.md",
    "chars": 234,
    "preview": "# Appbuilder Trace 文档\n\n本文档目录包含以下内容\n\n- [Appbuilder Trace跟踪功能基本用法](basic.md)\n- [Phoneix可视化软件的进阶用法](phoenix_method.md)\n- [A"
  },
  {
    "path": "docs/BasisModule/Trace/basic.md",
    "chars": 1258,
    "preview": "# Appbuilder-SDK TRACE \n\n## 使用方法\n\n### 启动Phoenix可视化软件\n\n**注意:没有可视化需求的可忽略此步骤**\n\n**如果未安装phoenix,需要先安装phoenix软件(这里提供清华园下载方式)*"
  },
  {
    "path": "docs/BasisModule/Trace/phoenix_method.md",
    "chars": 1626,
    "preview": "# Phoneix可视化软件的进阶用法\n\n## 1. 选择可视化展示的选项\n\n- 点击Columns,选择需要可视化展示的字段\n\n![选择可视化展示的选项](https://bj.bcebos.com/v1/appbuilder-sdk-c"
  },
  {
    "path": "docs/DevelopGuide/AdvancedDevelopment/README.md",
    "chars": 529,
    "preview": "# 开发指引\n\n该文档目录包含以下内容:\n\n- [二次开发基本介绍](https://github.com/baidubce/app-builder/blob/master/docs/DevelopGuide/AdvancedDevelop"
  },
  {
    "path": "docs/DevelopGuide/ChangeLog/changelog.md",
    "chars": 6582,
    "preview": "# 版本更新记录\n\n* **2023.12.19 v0.1.0版本发布**:[Release Notes](https://github.com/baidubce/app-builder/releases/tag/0.1.0)\n  * 初始"
  },
  {
    "path": "docs/DevelopGuide/EnvironmentalParameters/env.md",
    "chars": 2311,
    "preview": "# AppBuilder SDK 运行环境超参配置说明\n\n## 运行超参\n\n- `APPBUILDER_TOKEN`\n    - 超参说明:设置当前运行环境的用户Token,用于所有接口的鉴权\n    - 默认值: 空字符串\n    - 影"
  },
  {
    "path": "docs/DevelopGuide/ErrorMessage/error_message.md",
    "chars": 2170,
    "preview": "# SDK 错误信息\n\n1、 `BaseRPCException`\n\n- 报错解释: \n    - Base RPC exception,\n    - SDK基类异常\n\n2、 `BadRequestException`\n\n- 报错解释: \n"
  },
  {
    "path": "docs/DevelopGuide/HowToContributeCode/README.md",
    "chars": 16025,
    "preview": "# SDK 贡献代码规范\n\n## 组件开发规范\n\n### 组件整体介绍\n\n在无特殊情况下,一个官方组件(class Component)的实现可以拆解为以下几个关键模块,分别是\n\n* def run:组件的run函数,规范体现在该函数的输入"
  },
  {
    "path": "docs/QuickStart/CurrentlySupportedProgrammingLanguages/README.md",
    "chars": 455,
    "preview": "## SDK当前支持的编程语言\n- 平台功能 SDK: 支持Pyhon/Java/Go\n    - [应用管理](../../BasisModule/Platform/Application/get_app_list.md)\n    - ["
  },
  {
    "path": "docs/QuickStart/ExamplesOfIndustrialPracticeApplications/README.md",
    "chars": 3506,
    "preview": "# AppBuilder 功能组件\nAppBuilder面向开发者提供AI原生应用一站式开发工具,包括基础云资源、AI能力引擎、千帆大模型以及相关能力组件,提升AI原生应用开发效率。\n\n百度智能云千帆 AppBuilder 在提供零代码、低"
  },
  {
    "path": "docs/QuickStart/StartFirstAINativeApplication/README.md",
    "chars": 3874,
    "preview": "# 快速开始\n\n该文档目录包含以下内容:\n\n- [SDK安装](https://github.com/baidubce/app-builder/blob/master/docs/QuickStart/StartFirstAINativeAp"
  },
  {
    "path": "docs/QuickStart/StartFirstAINativeApplication/install.md",
    "chars": 1076,
    "preview": "# AppBuilder-SDK 安装\n\n### Python\n> 执行如下命令,快速安装Python语言的最新版本AppBuilder-SDK(要求Python >= 3.9)。使用MCP功能要求Python >= 3.10。\n\n```s"
  },
  {
    "path": "docs/README.md",
    "chars": 4990,
    "preview": "# AppBuilder-SDK Documentation\n\n## Github 文档\n- [首页](https://github.com/baidubce/app-builder/blob/master/docs/README.md)\n"
  },
  {
    "path": "docs/README_en.md",
    "chars": 14942,
    "preview": "<div align=\"center\">\n<img src='image/logo.png' alt='logo' width='700' >\n<br>\n\n[![License](https://img.shields.io/badge/l"
  },
  {
    "path": "docs/README_ja.md",
    "chars": 13194,
    "preview": "<div align=\"center\">\n<img src='image/logo.png' alt='logo' width='700' >\n<br>\n\n[![License](https://img.shields.io/badge/l"
  },
  {
    "path": "docs/Tools/DocPass/DocPass.md",
    "chars": 12,
    "preview": "# 文档更新中,敬请期待"
  },
  {
    "path": "docs/Tools/JavaAPI/JavaAPI.md",
    "chars": 111,
    "preview": "# Java API Reference\n\n- [Java API](index.html)\n    - [All API List](index-all.html)\n    - [帮助文档](help-doc.html)"
  },
  {
    "path": "docs/Tools/JavaAPI/READEME.md",
    "chars": 1175,
    "preview": "# Appbuilder-SDK Java 自动文档生成\n\n## 操作流程\n\n- 完成SDK代码开发\n- 依照google规范编写注释--仅需要对类和非私有方法进行注释\n- 进入根目录的docs/Tools/JavaAPI目录下执行java"
  },
  {
    "path": "docs/Tools/JavaAPI/java_api_update.sh",
    "chars": 433,
    "preview": "#1、清除生成文档环境\ncd ../../..\nrm -rf java/doc\nrm -rf docs/API-Reference/Java/*\n\n# 2、生成Java API文档\ncd java\njavadoc -d doc -sourc"
  },
  {
    "path": "docs/Tools/MarkdownSh/markdown2rst.py",
    "chars": 24604,
    "preview": "# The MIT License (MIT)\n\n# Copyright (c) 2016 Hitoruki Takagi\n\n# Permission is hereby granted, free of charge, to any pe"
  },
  {
    "path": "docs/Tools/MarkdownSh/markdown_parse.py",
    "chars": 8098,
    "preview": "\"\"\"\nmarkdown 文件解析工具\n使用示例:\npython markdown_parse.py \"your_file_path\"\n响应结果:\nparse file your_file_path/README.md result:   "
  },
  {
    "path": "docs/Tools/SphinxSh/Makefile",
    "chars": 638,
    "preview": "# Minimal makefile for Sphinx documentation\n#\n\n# You can set these variables from the command line, and also\n# from the "
  },
  {
    "path": "docs/Tools/SphinxSh/PythonAPI.md",
    "chars": 208,
    "preview": "# Python API Reference\n\n\n- [Python API](appbuilder.md)\n    - [Assistant API](appbuilder.core.assistant.md)\n    - [Compon"
  },
  {
    "path": "docs/Tools/SphinxSh/READEME.md",
    "chars": 3017,
    "preview": "# Appbuilder-SDK Python 自动文档生成\n\n## 操作流程\n\n- 完成SDK代码开发\n- 依照google规范编写注释--仅需要对类和非私有方法进行注释\n- 进入根目录的docs/Tools/SphinxSh目录下执行u"
  },
  {
    "path": "docs/Tools/SphinxSh/appbuilder.core.rst",
    "chars": 684,
    "preview": "appbuilder.core package\n=======================\n\nSubpackages\n-----------\n\n.. toctree::\n   :maxdepth: 2\n\n   appbuilder.co"
  },
  {
    "path": "docs/Tools/SphinxSh/get_components_md.py",
    "chars": 2237,
    "preview": "import os\n\ndef find_readme_files(base_path):\n    readme_files = []\n    for root, dirs, files in os.walk(base_path):\n    "
  },
  {
    "path": "docs/Tools/SphinxSh/make.bat",
    "chars": 804,
    "preview": "@ECHO OFF\r\n\r\npushd %~dp0\r\n\r\nREM Command file for Sphinx documentation\r\n\r\nif \"%SPHINXBUILD%\" == \"\" (\r\n\tset SPHINXBUILD=sp"
  },
  {
    "path": "docs/Tools/SphinxSh/requirements.txt",
    "chars": 47,
    "preview": "sphinx\nsphinx-markdown-builder\nsphinx_rtd_theme"
  },
  {
    "path": "docs/Tools/SphinxSh/source/conf.py",
    "chars": 1116,
    "preview": "# Configuration file for the Sphinx documentation builder.\n#\n# For the full list of built-in configuration values, see t"
  },
  {
    "path": "docs/Tools/SphinxSh/source/index.rst",
    "chars": 519,
    "preview": ".. Appbuilder-SDK documentation master file, created by\n   sphinx-quickstart on Fri Oct 11 14:36:19 2024.\n   You can ada"
  },
  {
    "path": "docs/Tools/SphinxSh/update_doc.sh",
    "chars": 4584,
    "preview": "echo \"========================开始更新文档========================\"\n\n# 1、注释@HTTPClient\\.check_param装饰器\necho \"================注"
  },
  {
    "path": "docs/Tools/SphinxSh/update_lib.py",
    "chars": 6039,
    "preview": "import subprocess\n\ndef mv_new_md(input_filename, output_filename):\n    \"\"\"\n    将新生成的Markdown文件移动到目标位置并删除原文件。\n    \n    Ar"
  },
  {
    "path": "docs/Tools/SphinxSh/update_rst.py",
    "chars": 2041,
    "preview": "import os\n\ndef process_rst_file(filepath):\n    \"\"\"\n    处理rst文件,移除包含特定文本的行。\n    \n    Args:\n        filepath (str): rst文件的"
  },
  {
    "path": "go/appbuilder/agent_builder.go",
    "chars": 5271,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/agent_builder_data.go",
    "chars": 2922,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/agent_builder_data_test.go",
    "chars": 2725,
    "preview": "package appbuilder\n\nimport (\n\t\"encoding/json\"\n\t\"testing\"\n\t\"bufio\"\n\t\"io\"\n\t\"strings\"\n)\n\n// 测试 if !ok 分支\nfunc TestAgentBuil"
  },
  {
    "path": "go/appbuilder/agent_builder_test.go",
    "chars": 11541,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/app_builder_client.go",
    "chars": 14501,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/app_builder_client_data.go",
    "chars": 15556,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/app_builder_client_test.go",
    "chars": 30294,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/component_client.go",
    "chars": 2571,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/component_client_data.go",
    "chars": 5073,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/component_client_test.go",
    "chars": 3678,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/config.go",
    "chars": 6051,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/dataset.go",
    "chars": 7891,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/dataset_data.go",
    "chars": 1520,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/dataset_test.go",
    "chars": 3059,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/go.mod",
    "chars": 101,
    "preview": "module github.com/baidubce/app-builder/go/appbuilder\n\ngo 1.18\n\nrequire github.com/google/uuid v1.6.0\n"
  },
  {
    "path": "go/appbuilder/go.sum",
    "chars": 163,
    "preview": "github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=\ngithub.com/google/uuid v1.6.0/go.mod h1:TI"
  },
  {
    "path": "go/appbuilder/knowledge_base.go",
    "chars": 27835,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/knowledge_base_data.go",
    "chars": 13705,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/knowledge_base_test.go",
    "chars": 45652,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/rag.go",
    "chars": 2332,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/rag_data.go",
    "chars": 3383,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/rag_test.go",
    "chars": 2778,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/appbuilder/util.go",
    "chars": 2100,
    "preview": "// Copyright (c) 2024 Baidu, Inc. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Licens"
  },
  {
    "path": "go/run_go_test.sh",
    "chars": 5394,
    "preview": "#!/bin/bash\n\n# 启用错误检测和管道失败检测\nset -o pipefail\n\n# 初始化错误标志\nerror_flag=0\n\n# 用于存储错误消息\nerror_messages=()\n\n# 检查并添加必要的路径\nexport "
  },
  {
    "path": "java/parse_tests_and_coverage.py",
    "chars": 13585,
    "preview": "#!/usr/bin/env python3\nimport os\nimport sys\nimport subprocess\nimport glob  # 添加这一行\nfrom lxml import etree\nfrom git impor"
  },
  {
    "path": "java/pom.xml",
    "chars": 8284,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www"
  },
  {
    "path": "java/print_coverage.sh",
    "chars": 388,
    "preview": "#!/bin/bash\n\n# 设置脚本退出时错误码\nset -e\n\n# 运行 Maven 测试并生成 JaCoCo 报告,捕获输出\necho \"运行 Maven 测试并生成 JaCoCo 报告...\"\nif mvn clean test j"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/base/component/Component.java",
    "chars": 2357,
    "preview": "package com.baidubce.appbuilder.base.component;\n\nimport com.baidubce.appbuilder.base.config.AppBuilderConfig;\nimport com"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/base/config/AppBuilderConfig.java",
    "chars": 5066,
    "preview": "package com.baidubce.appbuilder.base.config;\n\npublic class AppBuilderConfig {\n    public static final String APPBUILDER_"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/base/exception/AppBuilderServerException.java",
    "chars": 1819,
    "preview": "package com.baidubce.appbuilder.base.exception;\n\npublic class AppBuilderServerException extends Exception {\n    private "
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/base/utils/http/HttpClient.java",
    "chars": 14439,
    "preview": "package com.baidubce.appbuilder.base.utils.http;\n\nimport com.baidubce.appbuilder.base.component.Component;\nimport com.ba"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/base/utils/http/HttpResponse.java",
    "chars": 1375,
    "preview": "package com.baidubce.appbuilder.base.utils.http;\n\nimport java.util.Map;\n\npublic class HttpResponse<T> {\n    private int "
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/base/utils/iterator/StreamIterator.java",
    "chars": 2369,
    "preview": "package com.baidubce.appbuilder.base.utils.iterator;\n\nimport com.baidubce.appbuilder.base.utils.json.JsonUtils;\nimport o"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/base/utils/json/JsonUtils.java",
    "chars": 395,
    "preview": "package com.baidubce.appbuilder.base.utils.json;\n\nimport com.google.gson.Gson;\n\nimport java.lang.reflect.Type;\n\n\npublic "
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/console/agentbuilder/AgentBuilder.java",
    "chars": 5271,
    "preview": "package com.baidubce.appbuilder.console.agentbuilder;\n\n\nimport com.baidubce.appbuilder.base.component.Component;\nimport "
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/console/aisearch/AISearch.java",
    "chars": 1567,
    "preview": "package com.baidubce.appbuilder.console.aisearch;\n\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/console/appbuilderclient/App.java",
    "chars": 1734,
    "preview": "package com.baidubce.appbuilder.console.appbuilderclient;\n\nimport java.io.IOException;\nimport java.nio.charset.StandardC"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/console/appbuilderclient/AppBuilderClient.java",
    "chars": 8348,
    "preview": "package com.baidubce.appbuilder.console.appbuilderclient;\n\nimport com.baidubce.appbuilder.base.component.Component;\nimpo"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/console/appbuilderclient/AppList.java",
    "chars": 2639,
    "preview": "package com.baidubce.appbuilder.console.appbuilderclient;\n\n\nimport java.io.IOException;\nimport java.nio.charset.Standard"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/console/componentclient/ComponentClient.java",
    "chars": 3025,
    "preview": "package com.baidubce.appbuilder.console.componentclient;\n\nimport java.io.IOException;\nimport java.util.HashMap;\nimport j"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/console/dataset/Dataset.java",
    "chars": 9300,
    "preview": "package com.baidubce.appbuilder.console.dataset;\n\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.nio.char"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/console/knowledgebase/Knowledgebase.java",
    "chars": 32604,
    "preview": "package com.baidubce.appbuilder.console.knowledgebase;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.nio"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/console/rag/RAG.java",
    "chars": 2531,
    "preview": "package com.baidubce.appbuilder.console.rag;\n\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\nimpo"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/model/agentbuilder/AgentBuilderIterator.java",
    "chars": 1337,
    "preview": "package com.baidubce.appbuilder.model.agentbuilder;\n\nimport com.baidubce.appbuilder.base.utils.iterator.StreamIterator;\n"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/model/agentbuilder/AgentBuilderResponse.java",
    "chars": 2121,
    "preview": "package com.baidubce.appbuilder.model.agentbuilder;\n\nimport com.google.gson.annotations.SerializedName;\n\nimport java.uti"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/model/agentbuilder/AgentBuilderResult.java",
    "chars": 740,
    "preview": "package com.baidubce.appbuilder.model.agentbuilder;\n\n\nimport java.util.Arrays;\n\npublic class AgentBuilderResult {\n    pr"
  },
  {
    "path": "java/src/main/java/com/baidubce/appbuilder/model/agentbuilder/ConversationResponse.java",
    "chars": 826,
    "preview": "package com.baidubce.appbuilder.model.agentbuilder;\n\nimport com.google.gson.annotations.SerializedName;\n\npublic class Co"
  }
]

// ... and 682 more files (download for full content)

About this extraction

This page contains the full source code of the baidubce/app-builder GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 882 files (9.4 MB), approximately 2.5M tokens, and a symbol index with 5162 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!