Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

update for dte test #752

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions go/appbuilder/app_builder_client_test2.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright (c) 2024 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.

package appbuilder

import (
"bytes"
"encoding/json"
"fmt"
"os"
"strings"
"testing"
)

func TestNewAppBuilderClient2(t *testing.T) {
// 设置环境中的TOKEN,以下TOKEN请替换为您的个人TOKEN,个人TOKEN可通过该页面【获取鉴权参数】或控制台页【密钥管理】处获取
os.Setenv("APPBUILDER_TOKEN", "bce-v3/ALTAK-TnXvQ6z8XCvkZTzP5ShMP/fbd28a8e80f8c3fa1ad9d505db4f843c913858f9")
// 从AppBuilder控制台【个人空间】-【应用】网页获取已发布应用的ID
appID := "bc78732b-b6a6-474b-b2f8-475f60759426"
config, err := appbuilder.NewSDKConfig("", "")
if err != nil {
fmt.Println("new config failed: ", err)
return
}

builder, err := appbuilder.NewAppBuilderClient(appID, config)
if err != nil {
fmt.Println("new agent builder failed: ", err)
return
}
conversationID, err := builder.CreateConversation()
if err != nil {
fmt.Println("create conversation failed: ", err)
return
}

i, err := builder.Run(conversationID, "你好,你能做什么?", nil, false)
if err != nil {
fmt.Println("run failed: ", err)
return
}

var answer *appbuilder.AppBuilderClientAnswer
for answer, err = i.Next(); err == nil; answer, err = i.Next() {
fmt.Println(answer.Answer)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.baidubce.appbuilder;

import java.io.IOException;
import java.nio.file.Paths;
import java.nio.file.Files;
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;
import java.util.List;
import org.junit.Before;
import org.junit.Test;

import com.baidubce.appbuilder.model.appbuilderclient.AppBuilderClientIterator;
import com.baidubce.appbuilder.model.appbuilderclient.AppBuilderClientResult;
import com.baidubce.appbuilder.base.exception.AppBuilderServerException;
import com.baidubce.appbuilder.console.appbuilderclient.AppBuilderClient;
import com.baidubce.appbuilder.console.appbuilderclient.AppList;
import com.baidubce.appbuilder.model.appbuilderclient.AppListRequest;
import com.baidubce.appbuilder.model.appbuilderclient.AppsDescribeRequest;
import com.baidubce.appbuilder.model.appbuilderclient.Event;
import com.baidubce.appbuilder.model.appbuilderclient.EventContent;
import com.baidubce.appbuilder.model.appbuilderclient.AppBuilderClientRunRequest;


import static org.junit.Assert.*;

public class AppBuilderClientTest {
public static void main(String[] args) throws IOException, AppBuilderServerException {
// 设置环境中的TOKEN,以下TOKEN请替换为您的个人TOKEN,个人TOKEN可通过该页面【获取鉴权参数】或控制台页【密钥管理】处获取
System.setProperty("APPBUILDER_TOKEN", "bce-v3/ALTAK-TnXvQ6z8XCvkZTzP5ShMP/fbd28a8e80f8c3fa1ad9d505db4f843c913858f9");
// 从AppBuilder控制台【个人空间】-【应用】网页获取已发布应用的ID
String appId = "bc78732b-b6a6-474b-b2f8-475f60759426";
AppBuilderClient builder = new AppBuilderClient(appId);
String conversationId = builder.createConversation();

AppBuilderClientIterator itor = builder.run("你好,你能做什么?", conversationId, new String[] {}, false);
StringBuilder answer = new StringBuilder();
while (itor.hasNext()) {
AppBuilderClientResult response = itor.next();
answer.append(response.getAnswer());
}
System.out.println(answer);
}
}
1 change: 0 additions & 1 deletion python/utils/model_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
("ERNIE-Bot-turbo", "eb-turbo"),
("EB-turbo-AppBuilder专用版", "eb-turbo-appbuilder"),
("EB-turbo-AppBuilder专用版", "ernie_speed_appbuilder"),
("EB-turbo-AppBuilder专用版", "Qianfan-Agent-Speed-8K"),
]

class RemoteModel(object):
Expand Down
Loading