sashirestela / simple-openai

A Java library to use the OpenAI Api in the simplest possible way.
MIT License
181 stars 17 forks source link

thread.run.step.delta function error #79

Closed hlzhangxt closed 7 months ago

hlzhangxt commented 7 months ago

Hi, Thanks for your codes. When I run it, there's a bug, output: {"id":"step_euW1AwmD9GCR8MNEDiQrhFf0","object":"thread.run.step.delta","delta":{"step_details":{"type":"tool_calls","tool_calls":[{"index":0,"id":"call_H38Y41KBneAlPFBrnrbwbx9j","type":"function","function":{"name":"§HANGUP","arguments":"","output":null}}]}}}

See the function name is "§HANGUP" output. But the name should be "HANGUP“. How the "§" comes? it comes up random. Some time dose not appear. Sometimes dose.

sashirestela commented 7 months ago

@hlzhangxt thanks for using simple-openai. Please, could you share your complete request data?

hlzhangxt commented 7 months ago

Here: "object": "list", "data": [ { "id": "run_TejmGUzKan9410MFWbprOWY4", "object": "thread.run", "created_at": 1712539609, "assistant_id": "asst_avZFQkOkE9w3JLhhdg0HZ3Fh", "thread_id": "thread_zagAsFg661WW04IkqzNoU43j", "status": "completed", "started_at": 1712539609, "expires_at": null, "cancelled_at": null, "failed_at": null, "completed_at": 1712539611, "required_action": null, "last_error": null, "model": "gpt-4-0125-preview", "instructions": "You are a Heights Digital Repair Assistant working for the Heights Real Estate Company . Your name is Nova. You are now answering the tenant call for repair issue. Please response as soon as possible and as short as possible! If you can not get responses from the tenant for more than 2 times, please hangup to end the conversation.\r\nIf the tenant speaks a non-English language, You should speak the tenant's language too. After you answered the tenant call, you do the following steps(Please note that you can skip any step if you had already got the answer information of the step) :\r\n1, Answers with greeting; Ask how are they doing with standard reply.\r\n2, Ask who are they speaking to; Ask the building address and unit#.\r\n After you got the building address from the tenant, the address maybe not exactly same with address in the attached building address json file. So you need to retrieve the right address in the file and confim it with the tenant. And also retrieve the building code. \r\n But if you can not get the right address in the file, ask tenant to speak the address again to check and confirm.\r\n And after you get the super name by invoking the getsuper function, you should tell the tenant the super name.\r\n3, Asks name of person they are speaking to.\r\n4, Confirm identity of person spoken to.\r\n5, Asks what is the service issue.\r\n6, Asks What type of repair is this? Electrical, plumbing, painting or something else?\r\n7, Asks When did problem start.\r\n8, Asks Was this reported to the super. \r\n9, If it was reported to the super then asks the following questions: \r\n Reported on what date?\r\n What happened after it was reported\r\n Asks Was this condition ever inspected?\r\n10. Ask Can I conference in the super right now to help schedule an appointment?\r\n If the tenant agrees, let the tenant on hold please, then start calling( invoke conference super function) the super into the conference.\r\n or else say good bye and goodwill to end the conversation.", "tools": [ { "type": "function", "function": { "name": "HANGUP", "description": "while caller or called person wants to end the conversation, hangup to disconnect the call", "parameters": { "type": "object", "properties": {} } } }, { "type": "function", "function": { "name": "GETSUPER", "description": "After retrieved building address confrimed with the tenant ,the building code from the attached building json file and the unit number with the tenant name the tenant provided, invoke this function to get super's details including name and phone number, and also return the building address, building code and unit number with the tenant name.", "parameters": { "type": "object", "properties": { "building_addr": { "type": "string", "description": "the confimed building address from the file attached, for example: 61 Main Street" }, "building_code": { "type": "string", "description": "the building code retrieved from the attached building json file " }, "tenant_name": { "type": "string", "description": "the tenant name the tenant provided" }, "unit_no": { "type": "string", "description": "the unit number the tenant provided" } } } } }, { "type": "function", "function": { "name": "CONFSUPER", "description": "After the tenant agrees that we make an appointment with the super, then we invoke this function to call super to let the super join the conference", "parameters": { "type": "object", "properties": {} } } }, { "type": "function", "function": { "name": "SAVEAPPOINTMENTDATE", "description": "After confirmed the appointment date and time with the super and the tenant, invoke this function to save them", "parameters": { "type": "object", "properties": { "appmtdate": { "type": "string", "description": "the appointment date confirmed with the super and the tenant, the format is mm/dd/yyyy" }, "appmttime": { "type": "string", "description": "the appointment time confirmed with the super and the tenant, the format is hh:mm in 24 hours" } } } } }, { "type": "function", "function": { "name": "SETSPANISHLANG", "description": "If you have detected that the tenant speaks Spanish, invoke this function", "parameters": { "type": "object", "properties": {} } } }, { "type": "retrieval" } ], "file_ids": [ "file-dSM5gE19t8hmlDFewYq8Ool6" ], "metadata": {}, "temperature": 1.0, "usage": { "prompt_tokens": 1430, "completion_tokens": 26, "total_tokens": 1456 } } ], "first_id": "run_TejmGUzKan9410MFWbprOWY4", "last_id": "run_TejmGUzKan9410MFWbprOWY4", "has_more": false }

hlzhangxt commented 7 months ago

And also, to process the function request, I code: private void processFunction(io.github.sashirestela.openai.domain.assistant.ThreadRunStep.Function functionTool, String threadId, io.github.sashirestela.openai.domain.assistant.ThreadRunStep.ToolCall toolCall, BaseAgiScript agi) { String funname = functionTool.getName().trim();

    if (funname.startsWith("§"))
        funname = funname.substring(1);
    String funargs = functionTool.getArguments();
    if (funargs.trim().equals(""))
        funargs = "{}";

    ChatFunctionCall cfc = new ChatFunctionCall(funname, funargs);

    System.out.print("\n\rfunctioncall stream arguments = " + cfc.getArguments());

    // var result;
    // = new HashMap<String,String>();
    ToolOutput tooloutput = ToolOutput.of(toolCall.getId(), "OK");

    Object result = null;
    try {
        result = functionExecutor.execute(cfc);

        tooloutput = ToolOutput.of(toolCall.getId(), JSON.toJSONString(result));

        // ToolOutputs.add(tooloutput);
        System.out.print("\n\rtooloutput = " + tooloutput.getOutput());

        // var runId = runStepDelta.getId();
        System.out.print("\n\rrun id = " + runId);
        System.out.print("\n\rthread id = " + threadId);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        tooloutput = ToolOutput.of(toolCall.getId(), e.toString());
    } finally {
        ToolOutputSubmission tosm = ToolOutputSubmission.builder().toolOutput(tooloutput).stream(true).build();
        var re = openAI.threads().submitToolOutputsStream(threadId, runId, tosm).join(); // System.out.print("\n\rafter

        processResponse(re, agi, threadId);
    }

    try {
        if (result != null)
            runFurtherAgi(cfc, result, agi);
    } catch (AgiException e1) {
        // TODO Auto-generated
        e1.printStackTrace();
    }
}

See I have to create a chatFunction from Function to run it. The function name and parameters I have to make some changes.

sashirestela commented 7 months ago

@hlzhangxt I've tried your code several times but I cannot replicate the issue.

This is the code:

package io.github.sashirestela.openai.playground;

import com.fasterxml.jackson.annotation.JsonPropertyDescription;

import io.github.sashirestela.openai.SimpleOpenAI;
import io.github.sashirestela.openai.domain.assistant.AssistantFunction;
import io.github.sashirestela.openai.domain.assistant.AssistantRequest;
import io.github.sashirestela.openai.domain.assistant.AssistantTool;
import io.github.sashirestela.openai.domain.assistant.Events;
import io.github.sashirestela.openai.domain.assistant.TextContent;
import io.github.sashirestela.openai.domain.assistant.ThreadMessageDelta;
import io.github.sashirestela.openai.domain.assistant.ThreadMessageRequest;
import io.github.sashirestela.openai.domain.assistant.ThreadRequest;
import io.github.sashirestela.openai.domain.assistant.ThreadRunRequest;
import io.github.sashirestela.openai.domain.chat.tool.ChatFunction;
import io.github.sashirestela.openai.function.Functional;

public class ReplicateFunctionNameIssue {

    public static void main(String[] args) {
        var openai = SimpleOpenAI.builder().apiKey(System.getenv("OPENAI_API_KEY")).build();
        var assistantService = openai.assistants();
        var threadService = openai.threads();

        var assistant = assistantService.create(AssistantRequest.builder()
                .model("gpt-4-0125-preview")
                .name("Nova Assistant")
                .instructions(
                        "You are a Heights Digital Repair Assistant working for the Heights Real Estate Company . Your name is Nova. You are now answering the tenant call for repair issue. Please response as soon as possible and as short as possible! If you can not get responses from the tenant for more than 2 times, please hangup to end the conversation.\r\nIf the tenant speaks a non-English language, You should speak the tenant's language too. After you answered the tenant call, you do the following steps(Please note that you can skip any step if you had already got the answer information of the step) :\r\n1, Answers with greeting; Ask how are they doing with standard reply.\r\n2, Ask who are they speaking to; Ask the building address and unit#.\r\n After you got the building address from the tenant, the address maybe not exactly same with address in the attached building address json file. So you need to retrieve the right address in the file and confim it with the tenant. And also retrieve the building code. \r\n But if you can not get the right address in the file, ask tenant to speak the address again to check and confirm.\r\n And after you get the super name by invoking the getsuper function, you should tell the tenant the super name.\r\n3, Asks name of person they are speaking to.\r\n4, Confirm identity of person spoken to.\r\n5, Asks what is the service issue.\r\n6, Asks What type of repair is this? Electrical, plumbing, painting or something else?\r\n7, Asks When did problem start.\r\n8, Asks Was this reported to the super. \r\n9, If it was reported to the super then asks the following questions: \r\n Reported on what date?\r\n What happened after it was reported\r\n Asks Was this condition ever inspected?\r\n10. Ask Can I conference in the super right now to help schedule an appointment?\r\n If the tenant agrees, let the tenant on hold please, then start calling( invoke conference super function) the super into the conference.\r\n or else say good bye and goodwill to end the conversation.")
                .tool(AssistantTool.builder().function(AssistantFunction.function(ChatFunction.builder()
                        .name("HANGUP")
                        .description(
                                "while caller or called person wants to end the conversation, hangup to disconnect the call")
                        .functionalClass(HANGUP.class)
                        .build())).build())
                .tool(AssistantTool.builder().function(AssistantFunction.function(ChatFunction.builder()
                        .name("GETSUPER")
                        .description(
                                "After retrieved building address confrimed with the tenant ,the building code from the attached building json file and the unit number with the tenant name the tenant provided, invoke this function to get super's details including name and phone number, and also return the building address, building code and unit number with the tenant name.")
                        .functionalClass(GETSUPER.class)
                        .build())).build())
                .tool(AssistantTool.builder().function(AssistantFunction.function(ChatFunction.builder()
                        .name("CONFSUPER")
                        .description(
                                "After the tenant agrees that we make an appointment with the super, then we invoke this function to call super to let the super join the conference")
                        .functionalClass(CONFSUPER.class)
                        .build())).build())
                .tool(AssistantTool.builder().function(AssistantFunction.function(ChatFunction.builder()
                        .name("SAVEAPPOINTMENTDATE")
                        .description(
                                "After confirmed the appointment date and time with the super and the tenant, invoke this function to save them")
                        .functionalClass(SAVEAPPOINTMENTDATE.class)
                        .build())).build())
                .tool(AssistantTool.builder().function(AssistantFunction.function(ChatFunction.builder()
                        .name("SETSPANISHLANG")
                        .description(
                                "If you have detected that the tenant speaks Spanish, invoke this function")
                        .functionalClass(SETSPANISHLANG.class)
                        .build())).build())
                .tool(AssistantTool.RETRIEVAL)
                .build()).join();
        var assistantId = assistant.getId();
        System.out.println("Assistant was created with id: " + assistantId);

        var thread = threadService.create(ThreadRequest.builder()
                .message(ThreadMessageRequest.builder()
                        .role("user")
                        .content("Hi, can you help me?")
                        .build())
                .build()).join();
        var threadId = thread.getId();
        System.out.println("Thread was created with id: " + threadId);

        var stream = threadService.createRunStream(threadId, ThreadRunRequest.builder()
                .assistantId(assistantId)
                .build()).join();
        System.out.println("-".repeat(80));
        stream.filter(event -> event.getName().equals(Events.THREAD_MESSAGE_DELTA))
                .map(event -> ((TextContent) ((ThreadMessageDelta) event.getData())
                        .getDelta().getContent().get(0)).getValue())
                .forEach(System.out::print);
        System.out.println();

        var threadRun = threadService.getRunList(threadId).join();
        threadRun.forEach(System.out::println);

        var deletedThread = threadService.delete(threadId).join();
        var deletedAssistant = assistantService.delete(assistantId).join();

        System.out.println("Thread was deleted: " + deletedThread.getDeleted());
        System.out.println("Assistant was deleted: " + deletedAssistant.getDeleted());
    }

    public static class HANGUP implements Functional {

        @Override
        public Object execute() {
            return "DONE";
        }

    }

    public static class GETSUPER implements Functional {

        @JsonPropertyDescription("the confimed building address from the file attached, for example: 61 Main Street")
        public String building_addr;

        @JsonPropertyDescription("the building code retrieved from the attached building json file ")
        public String building_code;

        @JsonPropertyDescription("the tenant name the tenant provided")
        public String tenant_name;

        @JsonPropertyDescription("the unit number the tenant provided")
        public String unit_no;

        @Override
        public Object execute() {
            return "DONE";
        }

    }

    public static class CONFSUPER implements Functional {

        @Override
        public Object execute() {
            return "DONE";
        }

    }

    public static class SAVEAPPOINTMENTDATE implements Functional {

        @JsonPropertyDescription("the appointment date confirmed with the super and the tenant, the format is mm/dd/yyyy")
        public String appmtdate;

        @JsonPropertyDescription("the appointment time confirmed with the super and the tenant, the format is hh:mm in 24 hours")
        public String appmttime;

        @Override
        public Object execute() {
            return "DONE";
        }

    }

    public static class SETSPANISHLANG implements Functional {

        @Override
        public Object execute() {
            return "DONE";
        }

    }

}

This is the log result, where you can check in the line 246 the function name is correct:

2024-04-13 01:30:05.156+0000 [main] DEBUG io.github.sashirestela.cleverclient.CleverClient - CleverClient has been created.
2024-04-13 01:30:05.335+0000 [main] DEBUG io.github.sashirestela.cleverclient.metadata.InterfaceMetadataStore - The interface Assistants was saved
2024-04-13 01:30:05.337+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Created Instance : Assistants
2024-04-13 01:30:05.356+0000 [main] DEBUG io.github.sashirestela.cleverclient.metadata.InterfaceMetadataStore - The interface Threads was saved
2024-04-13 01:30:05.360+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Created Instance : Threads
2024-04-13 01:30:06.238+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Invoked Method : Assistants.create()
2024-04-13 01:30:06.355+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Http Call : POST https://api.openai.com/v1/assistants
2024-04-13 01:30:06.356+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Request Headers : {Authorization = **********, Content-Type = application/json, OpenAI-Beta = assistants=v1}
2024-04-13 01:30:06.356+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Request Body : {"model":"gpt-4-0125-preview","name":"Nova Assistant","instructions":"You are a Heights Digital Repair Assistant working for the Heights Real Estate Company . Your name is Nova. You are now answering the tenant call for repair issue. Please response as soon as possible and as short as possible! If you can not get responses from the tenant for more than 2 times, please hangup to end the conversation.\r\nIf the tenant speaks a non-English language, You should speak the tenant's language too. After you answered the tenant call, you do the following steps(Please note that you can skip any step if you had already got the answer information of the step) :\r\n1, Answers with greeting; Ask how are they doing with standard reply.\r\n2, Ask who are they speaking to; Ask the building address and unit#.\r\n After you got the building address from the tenant, the address maybe not exactly same with address in the attached building address json file. So you need to retrieve the right address in the file and confim it with the tenant. And also retrieve the building code. \r\n But if you can not get the right address in the file, ask tenant to speak the address again to check and confirm.\r\n And after you get the super name by invoking the getsuper function, you should tell the tenant the super name.\r\n3, Asks name of person they are speaking to.\r\n4, Confirm identity of person spoken to.\r\n5, Asks what is the service issue.\r\n6, Asks What type of repair is this? Electrical, plumbing, painting or something else?\r\n7, Asks When did problem start.\r\n8, Asks Was this reported to the super. \r\n9, If it was reported to the super then asks the following questions: \r\n Reported on what date?\r\n What happened after it was reported\r\n Asks Was this condition ever inspected?\r\n10. Ask Can I conference in the super right now to help schedule an appointment?\r\n If the tenant agrees, let the tenant on hold please, then start calling( invoke conference super function) the super into the conference.\r\n or else say good bye and goodwill to end the conversation.","tools":[{"type":"function","function":{"description":"while caller or called person wants to end the conversation, hangup to disconnect the call","name":"HANGUP","parameters":{"type":"object","properties":{}}}},{"type":"function","function":{"description":"After retrieved building address confrimed with the tenant ,the building code from the attached building json file and the unit number with the tenant name the tenant provided, invoke this function to get super's details including name and phone number, and also return the building address, building code and unit number with the tenant name.","name":"GETSUPER","parameters":{"type":"object","properties":{"building_addr":{"type":"string","description":"the confimed building address from the file attached, for example: 61 Main Street"},"building_code":{"type":"string","description":"the building code retrieved from the attached building json file "},"tenant_name":{"type":"string","description":"the tenant name the tenant provided"},"unit_no":{"type":"string","description":"the unit number the tenant provided"}}}}},{"type":"function","function":{"description":"After the tenant agrees that we make an appointment with the super, then we invoke this function to call super to let the super join the conference","name":"CONFSUPER","parameters":{"type":"object","properties":{}}}},{"type":"function","function":{"description":"After confirmed the appointment date and time with the super and the tenant, invoke this function to save them","name":"SAVEAPPOINTMENTDATE","parameters":{"type":"object","properties":{"appmtdate":{"type":"string","description":"the appointment date confirmed with the super and the tenant, the format is mm/dd/yyyy"},"appmttime":{"type":"string","description":"the appointment time confirmed with the super and the tenant, the format is hh:mm in 24 hours"}}}}},{"type":"function","function":{"description":"If you have detected that the tenant speaks Spanish, invoke this function","name":"SETSPANISHLANG","parameters":{"type":"object","properties":{}}}},{"type":"retrieval"}]}
2024-04-13 01:30:06.369+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSenderFactory - Created Sender : HttpAsyncCustomSender
2024-04-13 01:30:06.437+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Received Response
2024-04-13 01:30:07.112+0000 [Thread-0] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response Code : 200
2024-04-13 01:30:07.113+0000 [Thread-0] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : {
  "id": "asst_bazEBg1hiaKZZcYd5nxjyWEE",
  "object": "assistant",
  "created_at": 1712971807,
  "name": "Nova Assistant",
  "description": null,
  "model": "gpt-4-0125-preview",
  "instructions": "You are a Heights Digital Repair Assistant working for the Heights Real Estate Company . Your name is Nova. You are now answering the tenant call for repair issue. Please response as soon as possible and as short as possible! If you can not get responses from the tenant for more than 2 times, please hangup to end the conversation.\r\nIf the tenant speaks a non-English language, You should speak the tenant's language too. After you answered the tenant call, you do the following steps(Please note that you can skip any step if you had already got the answer information of the step) :\r\n1, Answers with greeting; Ask how are they doing with standard reply.\r\n2, Ask who are they speaking to; Ask the building address and unit#.\r\n After you got the building address from the tenant, the address maybe not exactly same with address in the attached building address json file. So you need to retrieve the right address in the file and confim it with the tenant. And also retrieve the building code. \r\n But if you can not get the right address in the file, ask tenant to speak the address again to check and confirm.\r\n And after you get the super name by invoking the getsuper function, you should tell the tenant the super name.\r\n3, Asks name of person they are speaking to.\r\n4, Confirm identity of person spoken to.\r\n5, Asks what is the service issue.\r\n6, Asks What type of repair is this? Electrical, plumbing, painting or something else?\r\n7, Asks When did problem start.\r\n8, Asks Was this reported to the super. \r\n9, If it was reported to the super then asks the following questions: \r\n Reported on what date?\r\n What happened after it was reported\r\n Asks Was this condition ever inspected?\r\n10. Ask Can I conference in the super right now to help schedule an appointment?\r\n If the tenant agrees, let the tenant on hold please, then start calling( invoke conference super function) the super into the conference.\r\n or else say good bye and goodwill to end the conversation.",
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "HANGUP",
        "description": "while caller or called person wants to end the conversation, hangup to disconnect the call",
        "parameters": {
          "type": "object",
          "properties": {}
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "GETSUPER",
        "description": "After retrieved building address confrimed with the tenant ,the building code from the attached building json file and the unit number with the tenant name the tenant provided, invoke this function to get super's details including name and phone number, and also return the building address, building code and unit number with the tenant name.",
        "parameters": {
          "type": "object",
          "properties": {
            "building_addr": {
              "type": "string",
              "description": "the confimed building address from the file attached, for example: 61 Main Street"
            },
            "building_code": {
              "type": "string",
              "description": "the building code retrieved from the attached building json file "
            },
            "tenant_name": {
              "type": "string",
              "description": "the tenant name the tenant provided"
            },
            "unit_no": {
              "type": "string",
              "description": "the unit number the tenant provided"
            }
          }
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "CONFSUPER",
        "description": "After the tenant agrees that we make an appointment with the super, then we invoke this function to call super to let the super join the conference",
        "parameters": {
          "type": "object",
          "properties": {}
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "SAVEAPPOINTMENTDATE",
        "description": "After confirmed the appointment date and time with the super and the tenant, invoke this function to save them",
        "parameters": {
          "type": "object",
          "properties": {
            "appmtdate": {
              "type": "string",
              "description": "the appointment date confirmed with the super and the tenant, the format is mm/dd/yyyy"
            },
            "appmttime": {
              "type": "string",
              "description": "the appointment time confirmed with the super and the tenant, the format is hh:mm in 24 hours"
            }
          }
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "SETSPANISHLANG",
        "description": "If you have detected that the tenant speaks Spanish, invoke this function",
        "parameters": {
          "type": "object",
          "properties": {}
        }
      }
    },
    {
      "type": "retrieval"
    }
  ],
  "file_ids": [],
  "metadata": {}
}
2024-04-13 01:30:07.150+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Invoked Method : Threads.create()
2024-04-13 01:30:07.154+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Http Call : POST https://api.openai.com/v1/threads
2024-04-13 01:30:07.154+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Request Headers : {Authorization = **********, Content-Type = application/json, OpenAI-Beta = assistants=v1}
2024-04-13 01:30:07.154+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Request Body : {"messages":[{"role":"user","content":"Hi, can you help me?"}]}
2024-04-13 01:30:07.155+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSenderFactory - Created Sender : HttpAsyncCustomSender
2024-04-13 01:30:07.155+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Received Response
2024-04-13 01:30:07.335+0000 [Thread-1] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response Code : 200
2024-04-13 01:30:07.335+0000 [Thread-1] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : {
  "id": "thread_EyZhVYluMGpdpcVqu5coBIDB",
  "object": "thread",
  "created_at": 1712971807,
  "metadata": {}
}
2024-04-13 01:30:07.338+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Invoked Method : Threads.createRunStream()
2024-04-13 01:30:07.341+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Invoked Method : Threads.__createRunStream()
2024-04-13 01:30:07.344+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Http Call : POST https://api.openai.com/v1/threads/thread_EyZhVYluMGpdpcVqu5coBIDB/runs
2024-04-13 01:30:07.344+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Request Headers : {Authorization = **********, Content-Type = application/json, OpenAI-Beta = assistants=v1}
2024-04-13 01:30:07.344+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Request Body : {"assistant_id":"asst_bazEBg1hiaKZZcYd5nxjyWEE","stream":true}
2024-04-13 01:30:07.344+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSenderFactory - Created Sender : HttpAsyncStreamEventSender
2024-04-13 01:30:07.345+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Received Response
2024-04-13 01:30:07.762+0000 [Thread-2] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response Code : 200
2024-04-13 01:30:07.764+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.run.created
2024-04-13 01:30:07.765+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"run_E86HuCZzkeZwlhJWXPYTptKV","object":"thread.run","created_at":1712971807,"assistant_id":"asst_bazEBg1hiaKZZcYd5nxjyWEE","thread_id":"thread_EyZhVYluMGpdpcVqu5coBIDB","status":"queued","started_at":null,"expires_at":1712972407,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-0125-preview","instructions":"You are a Heights Digital Repair Assistant working for the Heights Real Estate Company . Your name is Nova. You are now answering the tenant call for repair issue. Please response as soon as possible and as short as possible! If you can not get responses from the tenant for more than 2 times, please hangup to end the conversation.\r\nIf the tenant speaks a non-English language, You should speak the tenant's language too. After you answered the tenant call, you do the following steps(Please note that you can skip any step if you had already got the answer information of the step) :\r\n1, Answers with greeting; Ask how are they doing with standard reply.\r\n2, Ask who are they speaking to; Ask the building address and unit#.\r\n After you got the building address from the tenant, the address maybe not exactly same with address in the attached building address json file. So you need to retrieve the right address in the file and confim it with the tenant. And also retrieve the building code. \r\n But if you can not get the right address in the file, ask tenant to speak the address again to check and confirm.\r\n And after you get the super name by invoking the getsuper function, you should tell the tenant the super name.\r\n3, Asks name of person they are speaking to.\r\n4, Confirm identity of person spoken to.\r\n5, Asks what is the service issue.\r\n6, Asks What type of repair is this? Electrical, plumbing, painting or something else?\r\n7, Asks When did problem start.\r\n8, Asks Was this reported to the super. \r\n9, If it was reported to the super then asks the following questions: \r\n Reported on what date?\r\n What happened after it was reported\r\n Asks Was this condition ever inspected?\r\n10. Ask Can I conference in the super right now to help schedule an appointment?\r\n If the tenant agrees, let the tenant on hold please, then start calling( invoke conference super function) the super into the conference.\r\n or else say good bye and goodwill to end the conversation.","tools":[{"type":"function","function":{"name":"HANGUP","description":"while caller or called person wants to end the conversation, hangup to disconnect the call","parameters":{"type":"object","properties":{}}}},{"type":"function","function":{"name":"GETSUPER","description":"After retrieved building address confrimed with the tenant ,the building code from the attached building json file and the unit number with the tenant name the tenant provided, invoke this function to get super's details including name and phone number, and also return the building address, building code and unit number with the tenant name.","parameters":{"type":"object","properties":{"building_addr":{"type":"string","description":"the confimed building address from the file attached, for example: 61 Main Street"},"building_code":{"type":"string","description":"the building code retrieved from the attached building json file "},"tenant_name":{"type":"string","description":"the tenant name the tenant provided"},"unit_no":{"type":"string","description":"the unit number the tenant provided"}}}}},{"type":"function","function":{"name":"CONFSUPER","description":"After the tenant agrees that we make an appointment with the super, then we invoke this function to call super to let the super join the conference","parameters":{"type":"object","properties":{}}}},{"type":"function","function":{"name":"SAVEAPPOINTMENTDATE","description":"After confirmed the appointment date and time with the super and the tenant, invoke this function to save them","parameters":{"type":"object","properties":{"appmtdate":{"type":"string","description":"the appointment date confirmed with the super and the tenant, the format is mm/dd/yyyy"},"appmttime":{"type":"string","description":"the appointment time confirmed with the super and the tenant, the format is hh:mm in 24 hours"}}}}},{"type":"function","function":{"name":"SETSPANISHLANG","description":"If you have detected that the tenant speaks Spanish, invoke this function","parameters":{"type":"object","properties":{}}}},{"type":"retrieval"}],"file_ids":[],"metadata":{},"temperature":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"}
2024-04-13 01:30:07.774+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:07.774+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.run.queued
2024-04-13 01:30:07.775+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"run_E86HuCZzkeZwlhJWXPYTptKV","object":"thread.run","created_at":1712971807,"assistant_id":"asst_bazEBg1hiaKZZcYd5nxjyWEE","thread_id":"thread_EyZhVYluMGpdpcVqu5coBIDB","status":"queued","started_at":null,"expires_at":1712972407,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-0125-preview","instructions":"You are a Heights Digital Repair Assistant working for the Heights Real Estate Company . Your name is Nova. You are now answering the tenant call for repair issue. Please response as soon as possible and as short as possible! If you can not get responses from the tenant for more than 2 times, please hangup to end the conversation.\r\nIf the tenant speaks a non-English language, You should speak the tenant's language too. After you answered the tenant call, you do the following steps(Please note that you can skip any step if you had already got the answer information of the step) :\r\n1, Answers with greeting; Ask how are they doing with standard reply.\r\n2, Ask who are they speaking to; Ask the building address and unit#.\r\n After you got the building address from the tenant, the address maybe not exactly same with address in the attached building address json file. So you need to retrieve the right address in the file and confim it with the tenant. And also retrieve the building code. \r\n But if you can not get the right address in the file, ask tenant to speak the address again to check and confirm.\r\n And after you get the super name by invoking the getsuper function, you should tell the tenant the super name.\r\n3, Asks name of person they are speaking to.\r\n4, Confirm identity of person spoken to.\r\n5, Asks what is the service issue.\r\n6, Asks What type of repair is this? Electrical, plumbing, painting or something else?\r\n7, Asks When did problem start.\r\n8, Asks Was this reported to the super. \r\n9, If it was reported to the super then asks the following questions: \r\n Reported on what date?\r\n What happened after it was reported\r\n Asks Was this condition ever inspected?\r\n10. Ask Can I conference in the super right now to help schedule an appointment?\r\n If the tenant agrees, let the tenant on hold please, then start calling( invoke conference super function) the super into the conference.\r\n or else say good bye and goodwill to end the conversation.","tools":[{"type":"function","function":{"name":"HANGUP","description":"while caller or called person wants to end the conversation, hangup to disconnect the call","parameters":{"type":"object","properties":{}}}},{"type":"function","function":{"name":"GETSUPER","description":"After retrieved building address confrimed with the tenant ,the building code from the attached building json file and the unit number with the tenant name the tenant provided, invoke this function to get super's details including name and phone number, and also return the building address, building code and unit number with the tenant name.","parameters":{"type":"object","properties":{"building_addr":{"type":"string","description":"the confimed building address from the file attached, for example: 61 Main Street"},"building_code":{"type":"string","description":"the building code retrieved from the attached building json file "},"tenant_name":{"type":"string","description":"the tenant name the tenant provided"},"unit_no":{"type":"string","description":"the unit number the tenant provided"}}}}},{"type":"function","function":{"name":"CONFSUPER","description":"After the tenant agrees that we make an appointment with the super, then we invoke this function to call super to let the super join the conference","parameters":{"type":"object","properties":{}}}},{"type":"function","function":{"name":"SAVEAPPOINTMENTDATE","description":"After confirmed the appointment date and time with the super and the tenant, invoke this function to save them","parameters":{"type":"object","properties":{"appmtdate":{"type":"string","description":"the appointment date confirmed with the super and the tenant, the format is mm/dd/yyyy"},"appmttime":{"type":"string","description":"the appointment time confirmed with the super and the tenant, the format is hh:mm in 24 hours"}}}}},{"type":"function","function":{"name":"SETSPANISHLANG","description":"If you have detected that the tenant speaks Spanish, invoke this function","parameters":{"type":"object","properties":{}}}},{"type":"retrieval"}],"file_ids":[],"metadata":{},"temperature":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"}
2024-04-13 01:30:07.776+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:07.899+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.run.in_progress
2024-04-13 01:30:07.899+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"run_E86HuCZzkeZwlhJWXPYTptKV","object":"thread.run","created_at":1712971807,"assistant_id":"asst_bazEBg1hiaKZZcYd5nxjyWEE","thread_id":"thread_EyZhVYluMGpdpcVqu5coBIDB","status":"in_progress","started_at":1712971807,"expires_at":1712972407,"cancelled_at":null,"failed_at":null,"completed_at":null,"required_action":null,"last_error":null,"model":"gpt-4-0125-preview","instructions":"You are a Heights Digital Repair Assistant working for the Heights Real Estate Company . Your name is Nova. You are now answering the tenant call for repair issue. Please response as soon as possible and as short as possible! If you can not get responses from the tenant for more than 2 times, please hangup to end the conversation.\r\nIf the tenant speaks a non-English language, You should speak the tenant's language too. After you answered the tenant call, you do the following steps(Please note that you can skip any step if you had already got the answer information of the step) :\r\n1, Answers with greeting; Ask how are they doing with standard reply.\r\n2, Ask who are they speaking to; Ask the building address and unit#.\r\n After you got the building address from the tenant, the address maybe not exactly same with address in the attached building address json file. So you need to retrieve the right address in the file and confim it with the tenant. And also retrieve the building code. \r\n But if you can not get the right address in the file, ask tenant to speak the address again to check and confirm.\r\n And after you get the super name by invoking the getsuper function, you should tell the tenant the super name.\r\n3, Asks name of person they are speaking to.\r\n4, Confirm identity of person spoken to.\r\n5, Asks what is the service issue.\r\n6, Asks What type of repair is this? Electrical, plumbing, painting or something else?\r\n7, Asks When did problem start.\r\n8, Asks Was this reported to the super. \r\n9, If it was reported to the super then asks the following questions: \r\n Reported on what date?\r\n What happened after it was reported\r\n Asks Was this condition ever inspected?\r\n10. Ask Can I conference in the super right now to help schedule an appointment?\r\n If the tenant agrees, let the tenant on hold please, then start calling( invoke conference super function) the super into the conference.\r\n or else say good bye and goodwill to end the conversation.","tools":[{"type":"function","function":{"name":"HANGUP","description":"while caller or called person wants to end the conversation, hangup to disconnect the call","parameters":{"type":"object","properties":{}}}},{"type":"function","function":{"name":"GETSUPER","description":"After retrieved building address confrimed with the tenant ,the building code from the attached building json file and the unit number with the tenant name the tenant provided, invoke this function to get super's details including name and phone number, and also return the building address, building code and unit number with the tenant name.","parameters":{"type":"object","properties":{"building_addr":{"type":"string","description":"the confimed building address from the file attached, for example: 61 Main Street"},"building_code":{"type":"string","description":"the building code retrieved from the attached building json file "},"tenant_name":{"type":"string","description":"the tenant name the tenant provided"},"unit_no":{"type":"string","description":"the unit number the tenant provided"}}}}},{"type":"function","function":{"name":"CONFSUPER","description":"After the tenant agrees that we make an appointment with the super, then we invoke this function to call super to let the super join the conference","parameters":{"type":"object","properties":{}}}},{"type":"function","function":{"name":"SAVEAPPOINTMENTDATE","description":"After confirmed the appointment date and time with the super and the tenant, invoke this function to save them","parameters":{"type":"object","properties":{"appmtdate":{"type":"string","description":"the appointment date confirmed with the super and the tenant, the format is mm/dd/yyyy"},"appmttime":{"type":"string","description":"the appointment time confirmed with the super and the tenant, the format is hh:mm in 24 hours"}}}}},{"type":"function","function":{"name":"SETSPANISHLANG","description":"If you have detected that the tenant speaks Spanish, invoke this function","parameters":{"type":"object","properties":{}}}},{"type":"retrieval"}],"file_ids":[],"metadata":{},"temperature":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":null,"response_format":"auto","tool_choice":"auto"}
2024-04-13 01:30:07.901+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.484+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.run.step.created
2024-04-13 01:30:09.484+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"step_oHgc7BArwfmsUQNsaBrOSiYL","object":"thread.run.step","created_at":1712971809,"run_id":"run_E86HuCZzkeZwlhJWXPYTptKV","assistant_id":"asst_bazEBg1hiaKZZcYd5nxjyWEE","thread_id":"thread_EyZhVYluMGpdpcVqu5coBIDB","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1712972407,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf"}},"usage":null}
2024-04-13 01:30:09.500+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.500+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.run.step.in_progress
2024-04-13 01:30:09.500+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"step_oHgc7BArwfmsUQNsaBrOSiYL","object":"thread.run.step","created_at":1712971809,"run_id":"run_E86HuCZzkeZwlhJWXPYTptKV","assistant_id":"asst_bazEBg1hiaKZZcYd5nxjyWEE","thread_id":"thread_EyZhVYluMGpdpcVqu5coBIDB","type":"message_creation","status":"in_progress","cancelled_at":null,"completed_at":null,"expires_at":1712972407,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf"}},"usage":null}
2024-04-13 01:30:09.501+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.522+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.created
2024-04-13 01:30:09.523+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message","created_at":1712971809,"assistant_id":"asst_bazEBg1hiaKZZcYd5nxjyWEE","thread_id":"thread_EyZhVYluMGpdpcVqu5coBIDB","run_id":"run_E86HuCZzkeZwlhJWXPYTptKV","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"file_ids":[],"metadata":{}}
2024-04-13 01:30:09.538+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.538+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.in_progress
2024-04-13 01:30:09.538+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message","created_at":1712971809,"assistant_id":"asst_bazEBg1hiaKZZcYd5nxjyWEE","thread_id":"thread_EyZhVYluMGpdpcVqu5coBIDB","run_id":"run_E86HuCZzkeZwlhJWXPYTptKV","status":"in_progress","incomplete_details":null,"incomplete_at":null,"completed_at":null,"role":"assistant","content":[],"file_ids":[],"metadata":{}}
2024-04-13 01:30:09.538+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.551+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.551+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"Hello","annotations":[]}}]}}
2024-04-13 01:30:09.563+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.563+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.563+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"!"}}]}}
2024-04-13 01:30:09.564+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.574+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.574+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" Of"}}]}}
2024-04-13 01:30:09.574+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.590+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.590+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" course"}}]}}
2024-04-13 01:30:09.591+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.604+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.604+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":","}}]}}
2024-04-13 01:30:09.604+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.620+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.620+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" I"}}]}}
2024-04-13 01:30:09.620+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.634+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.634+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"'m"}}]}}
2024-04-13 01:30:09.634+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.651+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.651+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" here"}}]}}
2024-04-13 01:30:09.651+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.663+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.663+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" to"}}]}}
2024-04-13 01:30:09.664+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.675+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.675+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" help"}}]}}
2024-04-13 01:30:09.675+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.688+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.688+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"."}}]}}
2024-04-13 01:30:09.688+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.701+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.701+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" How"}}]}}
2024-04-13 01:30:09.701+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.714+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.714+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" are"}}]}}
2024-04-13 01:30:09.714+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.726+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.726+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" you"}}]}}
2024-04-13 01:30:09.726+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.747+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.747+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" doing"}}]}}
2024-04-13 01:30:09.747+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.755+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.755+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":" today"}}]}}
2024-04-13 01:30:09.756+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.763+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.delta
2024-04-13 01:30:09.763+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message.delta","delta":{"content":[{"index":0,"type":"text","text":{"value":"?"}}]}}
2024-04-13 01:30:09.764+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.799+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.message.completed
2024-04-13 01:30:09.799+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf","object":"thread.message","created_at":1712971809,"assistant_id":"asst_bazEBg1hiaKZZcYd5nxjyWEE","thread_id":"thread_EyZhVYluMGpdpcVqu5coBIDB","run_id":"run_E86HuCZzkeZwlhJWXPYTptKV","status":"completed","incomplete_details":null,"incomplete_at":null,"completed_at":1712971809,"role":"assistant","content":[{"type":"text","text":{"value":"Hello! Of course, I'm here to help. How are you doing today?","annotations":[]}}],"file_ids":[],"metadata":{}}
2024-04-13 01:30:09.800+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:09.890+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.run.step.completed
2024-04-13 01:30:09.890+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"step_oHgc7BArwfmsUQNsaBrOSiYL","object":"thread.run.step","created_at":1712971809,"run_id":"run_E86HuCZzkeZwlhJWXPYTptKV","assistant_id":"asst_bazEBg1hiaKZZcYd5nxjyWEE","thread_id":"thread_EyZhVYluMGpdpcVqu5coBIDB","type":"message_creation","status":"completed","cancelled_at":null,"completed_at":1712971809,"expires_at":1712972407,"failed_at":null,"last_error":null,"step_details":{"type":"message_creation","message_creation":{"message_id":"msg_vYdgNDBi7nO6SKOV1HXAlLYf"}},"usage":{"prompt_tokens":1357,"completion_tokens":19,"total_tokens":1376}}
2024-04-13 01:30:09.891+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:10.079+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: thread.run.completed
2024-04-13 01:30:10.080+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: {"id":"run_E86HuCZzkeZwlhJWXPYTptKV","object":"thread.run","created_at":1712971807,"assistant_id":"asst_bazEBg1hiaKZZcYd5nxjyWEE","thread_id":"thread_EyZhVYluMGpdpcVqu5coBIDB","status":"completed","started_at":1712971807,"expires_at":null,"cancelled_at":null,"failed_at":null,"completed_at":1712971809,"required_action":null,"last_error":null,"model":"gpt-4-0125-preview","instructions":"You are a Heights Digital Repair Assistant working for the Heights Real Estate Company . Your name is Nova. You are now answering the tenant call for repair issue. Please response as soon as possible and as short as possible! If you can not get responses from the tenant for more than 2 times, please hangup to end the conversation.\r\nIf the tenant speaks a non-English language, You should speak the tenant's language too. After you answered the tenant call, you do the following steps(Please note that you can skip any step if you had already got the answer information of the step) :\r\n1, Answers with greeting; Ask how are they doing with standard reply.\r\n2, Ask who are they speaking to; Ask the building address and unit#.\r\n After you got the building address from the tenant, the address maybe not exactly same with address in the attached building address json file. So you need to retrieve the right address in the file and confim it with the tenant. And also retrieve the building code. \r\n But if you can not get the right address in the file, ask tenant to speak the address again to check and confirm.\r\n And after you get the super name by invoking the getsuper function, you should tell the tenant the super name.\r\n3, Asks name of person they are speaking to.\r\n4, Confirm identity of person spoken to.\r\n5, Asks what is the service issue.\r\n6, Asks What type of repair is this? Electrical, plumbing, painting or something else?\r\n7, Asks When did problem start.\r\n8, Asks Was this reported to the super. \r\n9, If it was reported to the super then asks the following questions: \r\n Reported on what date?\r\n What happened after it was reported\r\n Asks Was this condition ever inspected?\r\n10. Ask Can I conference in the super right now to help schedule an appointment?\r\n If the tenant agrees, let the tenant on hold please, then start calling( invoke conference super function) the super into the conference.\r\n or else say good bye and goodwill to end the conversation.","tools":[{"type":"function","function":{"name":"HANGUP","description":"while caller or called person wants to end the conversation, hangup to disconnect the call","parameters":{"type":"object","properties":{}}}},{"type":"function","function":{"name":"GETSUPER","description":"After retrieved building address confrimed with the tenant ,the building code from the attached building json file and the unit number with the tenant name the tenant provided, invoke this function to get super's details including name and phone number, and also return the building address, building code and unit number with the tenant name.","parameters":{"type":"object","properties":{"building_addr":{"type":"string","description":"the confimed building address from the file attached, for example: 61 Main Street"},"building_code":{"type":"string","description":"the building code retrieved from the attached building json file "},"tenant_name":{"type":"string","description":"the tenant name the tenant provided"},"unit_no":{"type":"string","description":"the unit number the tenant provided"}}}}},{"type":"function","function":{"name":"CONFSUPER","description":"After the tenant agrees that we make an appointment with the super, then we invoke this function to call super to let the super join the conference","parameters":{"type":"object","properties":{}}}},{"type":"function","function":{"name":"SAVEAPPOINTMENTDATE","description":"After confirmed the appointment date and time with the super and the tenant, invoke this function to save them","parameters":{"type":"object","properties":{"appmtdate":{"type":"string","description":"the appointment date confirmed with the super and the tenant, the format is mm/dd/yyyy"},"appmttime":{"type":"string","description":"the appointment time confirmed with the super and the tenant, the format is hh:mm in 24 hours"}}}}},{"type":"function","function":{"name":"SETSPANISHLANG","description":"If you have detected that the tenant speaks Spanish, invoke this function","parameters":{"type":"object","properties":{}}}},{"type":"retrieval"}],"file_ids":[],"metadata":{},"temperature":1.0,"max_completion_tokens":null,"max_prompt_tokens":null,"truncation_strategy":{"type":"auto","last_messages":null},"incomplete_details":null,"usage":{"prompt_tokens":1357,"completion_tokens":19,"total_tokens":1376},"response_format":"auto","tool_choice":"auto"}
2024-04-13 01:30:10.080+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:10.096+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : event: done
2024-04-13 01:30:10.096+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : data: [DONE]
2024-04-13 01:30:10.096+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : 
2024-04-13 01:30:10.096+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Invoked Method : Threads.getRunList()
2024-04-13 01:30:10.098+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Invoked Method : Threads.getRunList()
2024-04-13 01:30:10.102+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Http Call : GET https://api.openai.com/v1/threads/thread_EyZhVYluMGpdpcVqu5coBIDB/runs
2024-04-13 01:30:10.102+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Request Headers : {Authorization = **********, OpenAI-Beta = assistants=v1}
2024-04-13 01:30:10.102+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Request Body : (Empty)
2024-04-13 01:30:10.103+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSenderFactory - Created Sender : HttpAsyncGenericSender
2024-04-13 01:30:10.103+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Received Response
2024-04-13 01:30:10.287+0000 [Thread-3] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response Code : 200
2024-04-13 01:30:10.287+0000 [Thread-3] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : {
  "object": "list",
  "data": [
    {
      "id": "run_E86HuCZzkeZwlhJWXPYTptKV",
      "object": "thread.run",
      "created_at": 1712971807,
      "assistant_id": "asst_bazEBg1hiaKZZcYd5nxjyWEE",
      "thread_id": "thread_EyZhVYluMGpdpcVqu5coBIDB",
      "status": "completed",
      "started_at": 1712971807,
      "expires_at": null,
      "cancelled_at": null,
      "failed_at": null,
      "completed_at": 1712971809,
      "required_action": null,
      "last_error": null,
      "model": "gpt-4-0125-preview",
      "instructions": "You are a Heights Digital Repair Assistant working for the Heights Real Estate Company . Your name is Nova. You are now answering the tenant call for repair issue. Please response as soon as possible and as short as possible! If you can not get responses from the tenant for more than 2 times, please hangup to end the conversation.\r\nIf the tenant speaks a non-English language, You should speak the tenant's language too. After you answered the tenant call, you do the following steps(Please note that you can skip any step if you had already got the answer information of the step) :\r\n1, Answers with greeting; Ask how are they doing with standard reply.\r\n2, Ask who are they speaking to; Ask the building address and unit#.\r\n After you got the building address from the tenant, the address maybe not exactly same with address in the attached building address json file. So you need to retrieve the right address in the file and confim it with the tenant. And also retrieve the building code. \r\n But if you can not get the right address in the file, ask tenant to speak the address again to check and confirm.\r\n And after you get the super name by invoking the getsuper function, you should tell the tenant the super name.\r\n3, Asks name of person they are speaking to.\r\n4, Confirm identity of person spoken to.\r\n5, Asks what is the service issue.\r\n6, Asks What type of repair is this? Electrical, plumbing, painting or something else?\r\n7, Asks When did problem start.\r\n8, Asks Was this reported to the super. \r\n9, If it was reported to the super then asks the following questions: \r\n Reported on what date?\r\n What happened after it was reported\r\n Asks Was this condition ever inspected?\r\n10. Ask Can I conference in the super right now to help schedule an appointment?\r\n If the tenant agrees, let the tenant on hold please, then start calling( invoke conference super function) the super into the conference.\r\n or else say good bye and goodwill to end the conversation.",
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "HANGUP",
            "description": "while caller or called person wants to end the conversation, hangup to disconnect the call",
            "parameters": {
              "type": "object",
              "properties": {}
            }
          }
        },
        {
          "type": "function",
          "function": {
            "name": "GETSUPER",
            "description": "After retrieved building address confrimed with the tenant ,the building code from the attached building json file and the unit number with the tenant name the tenant provided, invoke this function to get super's details including name and phone number, and also return the building address, building code and unit number with the tenant name.",
            "parameters": {
              "type": "object",
              "properties": {
                "building_addr": {
                  "type": "string",
                  "description": "the confimed building address from the file attached, for example: 61 Main Street"
                },
                "building_code": {
                  "type": "string",
                  "description": "the building code retrieved from the attached building json file "
                },
                "tenant_name": {
                  "type": "string",
                  "description": "the tenant name the tenant provided"
                },
                "unit_no": {
                  "type": "string",
                  "description": "the unit number the tenant provided"
                }
              }
            }
          }
        },
        {
          "type": "function",
          "function": {
            "name": "CONFSUPER",
            "description": "After the tenant agrees that we make an appointment with the super, then we invoke this function to call super to let the super join the conference",
            "parameters": {
              "type": "object",
              "properties": {}
            }
          }
        },
        {
          "type": "function",
          "function": {
            "name": "SAVEAPPOINTMENTDATE",
            "description": "After confirmed the appointment date and time with the super and the tenant, invoke this function to save them",
            "parameters": {
              "type": "object",
              "properties": {
                "appmtdate": {
                  "type": "string",
                  "description": "the appointment date confirmed with the super and the tenant, the format is mm/dd/yyyy"
                },
                "appmttime": {
                  "type": "string",
                  "description": "the appointment time confirmed with the super and the tenant, the format is hh:mm in 24 hours"
                }
              }
            }
          }
        },
        {
          "type": "function",
          "function": {
            "name": "SETSPANISHLANG",
            "description": "If you have detected that the tenant speaks Spanish, invoke this function",
            "parameters": {
              "type": "object",
              "properties": {}
            }
          }
        },
        {
          "type": "retrieval"
        }
      ],
      "file_ids": [],
      "metadata": {},
      "temperature": 1.0,
      "max_completion_tokens": null,
      "max_prompt_tokens": null,
      "truncation_strategy": {
        "type": "auto",
        "last_messages": null
      },
      "incomplete_details": null,
      "usage": {
        "prompt_tokens": 1357,
        "completion_tokens": 19,
        "total_tokens": 1376
      },
      "response_format": "auto",
      "tool_choice": "auto"
    }
  ],
  "first_id": "run_E86HuCZzkeZwlhJWXPYTptKV",
  "last_id": "run_E86HuCZzkeZwlhJWXPYTptKV",
  "has_more": false
}
2024-04-13 01:30:10.348+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Invoked Method : Threads.delete()
2024-04-13 01:30:10.349+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Http Call : DELETE https://api.openai.com/v1/threads/thread_EyZhVYluMGpdpcVqu5coBIDB
2024-04-13 01:30:10.349+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Request Headers : {Authorization = **********, OpenAI-Beta = assistants=v1}
2024-04-13 01:30:10.349+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Request Body : (Empty)
2024-04-13 01:30:10.349+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSenderFactory - Created Sender : HttpAsyncCustomSender
2024-04-13 01:30:10.349+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Received Response
2024-04-13 01:30:10.515+0000 [Thread-4] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response Code : 200
2024-04-13 01:30:10.515+0000 [Thread-4] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : {
  "id": "thread_EyZhVYluMGpdpcVqu5coBIDB",
  "object": "thread.deleted",
  "deleted": true
}
2024-04-13 01:30:10.517+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Invoked Method : Assistants.delete()
2024-04-13 01:30:10.517+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Http Call : DELETE https://api.openai.com/v1/assistants/asst_bazEBg1hiaKZZcYd5nxjyWEE
2024-04-13 01:30:10.517+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Request Headers : {Authorization = **********, OpenAI-Beta = assistants=v1}
2024-04-13 01:30:10.517+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpConnector - Request Body : (Empty)
2024-04-13 01:30:10.517+0000 [main] DEBUG io.github.sashirestela.cleverclient.sender.HttpSenderFactory - Created Sender : HttpAsyncCustomSender
2024-04-13 01:30:10.517+0000 [main] DEBUG io.github.sashirestela.cleverclient.http.HttpProcessor - Received Response
2024-04-13 01:30:10.702+0000 [Thread-5] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response Code : 200
2024-04-13 01:30:10.702+0000 [Thread-5] DEBUG io.github.sashirestela.cleverclient.sender.HttpSender - Response : {
  "id": "asst_bazEBg1hiaKZZcYd5nxjyWEE",
  "object": "assistant.deleted",
  "deleted": true
}

I'm afraid that your issue cannot be replicated. Maybe it is something about your local configuration or with the OpenAI model. I would suggest using the latest model gpt-4-turbo-2024-04-09.

If you don't have more observations, I think we could close this issue.

hlzhangxt commented 7 months ago

Thanks for patience of test. I will try the new model. I have one question is that how to process the function Require_Action in stream mode. var threadRun = threadService.getRunList(threadId).join(); threadRun.forEach(System.out::println);

If we don't submit tool ouput of the function result, the stream will stuck in Require_Action. How to submit outputs in stream mode?

sashirestela commented 7 months ago

@hlzhangxt I'm going to convert this issue into a Discussion item, it is more appropriate. In general, if you have questions, use the Discussion section instead of creating an issue.