|
2 | 2 |
|
3 | 3 | import com.unfbx.chatgpt.entity.Tts.TextToSpeech; |
4 | 4 | import com.unfbx.chatgpt.entity.assistant.*; |
| 5 | +import com.unfbx.chatgpt.entity.assistant.message.MessageFileResponse; |
| 6 | +import com.unfbx.chatgpt.entity.assistant.message.MessageResponse; |
| 7 | +import com.unfbx.chatgpt.entity.assistant.message.ModifyMessage; |
| 8 | +import com.unfbx.chatgpt.entity.assistant.run.*; |
| 9 | +import com.unfbx.chatgpt.entity.assistant.thread.ThreadMessage; |
5 | 10 | import com.unfbx.chatgpt.entity.billing.BillingUsage; |
6 | 11 | import com.unfbx.chatgpt.entity.billing.CreditGrantsResponse; |
7 | 12 | import com.unfbx.chatgpt.entity.billing.Subscription; |
|
33 | 38 | import com.unfbx.chatgpt.entity.models.ModelResponse; |
34 | 39 | import com.unfbx.chatgpt.entity.moderations.Moderation; |
35 | 40 | import com.unfbx.chatgpt.entity.moderations.ModerationResponse; |
36 | | -import com.unfbx.chatgpt.entity.thread.ModifyThread; |
37 | | -import com.unfbx.chatgpt.entity.thread.Thread; |
38 | | -import com.unfbx.chatgpt.entity.thread.ThreadResponse; |
| 41 | +import com.unfbx.chatgpt.entity.assistant.thread.ModifyThread; |
| 42 | +import com.unfbx.chatgpt.entity.assistant.thread.Thread; |
| 43 | +import com.unfbx.chatgpt.entity.assistant.thread.ThreadResponse; |
39 | 44 | import com.unfbx.chatgpt.entity.whisper.WhisperResponse; |
40 | 45 | import io.reactivex.Single; |
41 | 46 | import okhttp3.MultipartBody; |
@@ -582,4 +587,214 @@ Single<AssistantListResponse<AssistantFileResponse>> assistantFiles(@Path("assis |
582 | 587 | @DELETE("v1/threads/{thread_id}") |
583 | 588 | @Headers("OpenAI-Beta: assistants=v1") |
584 | 589 | Single<DeleteResponse> deleteThread(@Path("thread_id") String threadId); |
| 590 | + |
| 591 | + /** |
| 592 | + * 为线程创建消息 |
| 593 | + * |
| 594 | + * @param threadId 线程id |
| 595 | + * @param message message参数 |
| 596 | + * @return |
| 597 | + * @since 1.1.3 |
| 598 | + */ |
| 599 | + @POST("v1/threads/{thread_id}/messages") |
| 600 | + @Headers("OpenAI-Beta: assistants=v1") |
| 601 | + Single<MessageResponse> message(@Path("thread_id") String threadId, @Body ThreadMessage message); |
| 602 | + |
| 603 | + /** |
| 604 | + * 检索某一个线程对应的消息详细信息 |
| 605 | + * |
| 606 | + * @param threadId 线程id |
| 607 | + * @param messageId 消息id |
| 608 | + * @return |
| 609 | + * @since 1.1.3 |
| 610 | + */ |
| 611 | + @GET("v1/threads/{thread_id}/messages/{message_id}") |
| 612 | + @Headers("OpenAI-Beta: assistants=v1") |
| 613 | + Single<MessageResponse> retrieveMessage(@Path("thread_id") String threadId, @Path("message_id") String messageId); |
| 614 | + |
| 615 | + /** |
| 616 | + * 修改某一个线程对应的消息 |
| 617 | + * |
| 618 | + * @param threadId 线程id |
| 619 | + * @param messageId 消息id |
| 620 | + * @param message 消息体 |
| 621 | + * @return |
| 622 | + * @since 1.1.3 |
| 623 | + */ |
| 624 | + @POST("v1/threads/{thread_id}/messages/{message_id}") |
| 625 | + @Headers("OpenAI-Beta: assistants=v1") |
| 626 | + Single<MessageResponse> modifyMessage(@Path("thread_id") String threadId, @Path("message_id") String messageId, @Body ModifyMessage message); |
| 627 | + |
| 628 | + /** |
| 629 | + * 获取某一个线程的消息集合 |
| 630 | + * |
| 631 | + * @param threadId 线程id |
| 632 | + * @param limit 一页数据大小 |
| 633 | + * @param order 排序类型 |
| 634 | + * @param before 分页参数,之前的id,默认值:null |
| 635 | + * @param after 分页参数,之后的id,默认值:null |
| 636 | + * @return |
| 637 | + * @since 1.1.3 |
| 638 | + */ |
| 639 | + @GET("v1/threads/{thread_id}/messages") |
| 640 | + @Headers("OpenAI-Beta: assistants=v1") |
| 641 | + Single<AssistantListResponse<MessageResponse>> messages(@Path("thread_id") String threadId, |
| 642 | + @Query("limit") Integer limit, @Query("order") String order, @Query("before") String before, @Query("after") String after); |
| 643 | + |
| 644 | + /** |
| 645 | + * 检索某一个线程对应某一个消息的一个文件信息 |
| 646 | + * |
| 647 | + * @param threadId 线程id |
| 648 | + * @param messageId 消息id |
| 649 | + * @param fileId 文件id |
| 650 | + * @return |
| 651 | + * @since 1.1.3 |
| 652 | + */ |
| 653 | + @GET("v1/threads/{thread_id}/messages/{message_id}/files/{file_id}") |
| 654 | + @Headers("OpenAI-Beta: assistants=v1") |
| 655 | + Single<MessageFileResponse> retrieveMessageFile(@Path("thread_id") String threadId, @Path("message_id") String messageId, @Path("file_id") String fileId); |
| 656 | + |
| 657 | + /** |
| 658 | + * messageFiles集合 |
| 659 | + * |
| 660 | + * @param threadId 线程id |
| 661 | + * @param messageId 消息id |
| 662 | + * @param limit 一页数据大小 |
| 663 | + * @param order 排序类型 |
| 664 | + * @param before 分页参数,之前的id,默认值:null |
| 665 | + * @param after 分页参数,之后的id,默认值:null |
| 666 | + * @return |
| 667 | + * @since 1.1.3 |
| 668 | + */ |
| 669 | + @GET("v1/threads/{thread_id}/messages/{message_id}/files") |
| 670 | + @Headers("OpenAI-Beta: assistants=v1") |
| 671 | + Single<AssistantListResponse<MessageFileResponse>> messageFiles(@Path("thread_id") String threadId, @Path("message_id") String messageId, |
| 672 | + @Query("limit") Integer limit, @Query("order") String order, @Query("before") String before, @Query("after") String after); |
| 673 | + |
| 674 | + |
| 675 | + /** |
| 676 | + * 创建Run |
| 677 | + * |
| 678 | + * @param threadId 线程id |
| 679 | + * @param run run |
| 680 | + * @return |
| 681 | + * @since 1.1.3 |
| 682 | + */ |
| 683 | + @POST("v1/threads/{thread_id}/runs") |
| 684 | + @Headers("OpenAI-Beta: assistants=v1") |
| 685 | + Single<RunResponse> run(@Path("thread_id") String threadId, @Body Run run); |
| 686 | + |
| 687 | + |
| 688 | + /** |
| 689 | + * 检索run详细信息 |
| 690 | + * |
| 691 | + * @param threadId 线程id |
| 692 | + * @param runId run_id |
| 693 | + * @return |
| 694 | + * @since 1.1.3 |
| 695 | + */ |
| 696 | + @GET("v1/threads/{thread_id}/runs/{run_id}") |
| 697 | + @Headers("OpenAI-Beta: assistants=v1") |
| 698 | + Single<RunResponse> retrieveRun(@Path("thread_id") String threadId, @Path("run_id") String runId); |
| 699 | + |
| 700 | + /** |
| 701 | + * 修改某一个run |
| 702 | + * |
| 703 | + * @param threadId 线程id |
| 704 | + * @param runId run_id |
| 705 | + * @param run 消息体 |
| 706 | + * @return |
| 707 | + * @since 1.1.3 |
| 708 | + */ |
| 709 | + @POST("v1/threads/{thread_id}/runs/{run_id}") |
| 710 | + @Headers("OpenAI-Beta: assistants=v1") |
| 711 | + Single<RunResponse> modifyRun(@Path("thread_id") String threadId, @Path("run_id") String runId, @Body ModifyRun run); |
| 712 | + |
| 713 | + |
| 714 | + /** |
| 715 | + * 获取某一个线程的run集合 |
| 716 | + * |
| 717 | + * @param threadId 线程id |
| 718 | + * @param limit 一页数据大小 |
| 719 | + * @param order 排序类型 |
| 720 | + * @param before 分页参数,之前的id,默认值:null |
| 721 | + * @param after 分页参数,之后的id,默认值:null |
| 722 | + * @return |
| 723 | + * @since 1.1.3 |
| 724 | + */ |
| 725 | + @GET("v1/threads/{thread_id}/runs") |
| 726 | + @Headers("OpenAI-Beta: assistants=v1") |
| 727 | + Single<AssistantListResponse<RunResponse>> runs(@Path("thread_id") String threadId, |
| 728 | + @Query("limit") Integer limit, @Query("order") String order, @Query("before") String before, @Query("after") String after); |
| 729 | + |
| 730 | + |
| 731 | + /** |
| 732 | + * 获取某一个线程的run集合 |
| 733 | + * |
| 734 | + * @param threadId 线程id |
| 735 | + * @param runId run id |
| 736 | + * @param toolOutputs 为其提交输出的工具列表。 |
| 737 | + * @return |
| 738 | + * @since 1.1.3 |
| 739 | + */ |
| 740 | + @POST("v1/threads/{thread_id}/runs/{run_id}/submit_tool_outputs") |
| 741 | + @Headers("OpenAI-Beta: assistants=v1") |
| 742 | + Single<RunResponse> submitToolOutputs(@Path("thread_id") String threadId, @Path("run_id") String runId, @Body ToolOutputBody toolOutputs); |
| 743 | + |
| 744 | + |
| 745 | + /** |
| 746 | + * 取消正在进行中的run |
| 747 | + * |
| 748 | + * @param threadId 线程id |
| 749 | + * @param runId run id |
| 750 | + * @return |
| 751 | + * @since 1.1.3 |
| 752 | + */ |
| 753 | + @POST("v1/threads/{thread_id}/runs/{run_id}/cancel") |
| 754 | + @Headers("OpenAI-Beta: assistants=v1") |
| 755 | + Single<RunResponse> cancelRun(@Path("thread_id") String threadId, @Path("run_id") String runId); |
| 756 | + |
| 757 | + |
| 758 | + /** |
| 759 | + * 创建一个线程并在一个请求中运行它 |
| 760 | + * |
| 761 | + * @param threadRun 对象 |
| 762 | + * @return |
| 763 | + * @since 1.1.3 |
| 764 | + */ |
| 765 | + @POST("v1/threads/runs") |
| 766 | + @Headers("OpenAI-Beta: assistants=v1") |
| 767 | + Single<RunResponse> threadRun(@Body ThreadRun threadRun); |
| 768 | + |
| 769 | + /** |
| 770 | + * 检索run step详细信息 |
| 771 | + * |
| 772 | + * @param threadId 线程id |
| 773 | + * @param runId run_id |
| 774 | + * @param stepId step_id |
| 775 | + * @return |
| 776 | + * @since 1.1.3 |
| 777 | + */ |
| 778 | + @GET("v1/threads/{thread_id}/runs/{run_id}/steps/{step_id}") |
| 779 | + @Headers("OpenAI-Beta: assistants=v1") |
| 780 | + Single<RunStepResponse> retrieveRunStep(@Path("thread_id") String threadId, @Path("run_id") String runId, @Path("step_id") String stepId); |
| 781 | + |
| 782 | + |
| 783 | + /** |
| 784 | + * 获取某一个线程的run step集合 |
| 785 | + * |
| 786 | + * @param threadId 线程id |
| 787 | + * @param runId run_id |
| 788 | + * @param limit 一页数据大小 |
| 789 | + * @param order 排序类型 |
| 790 | + * @param before 分页参数,之前的id,默认值:null |
| 791 | + * @param after 分页参数,之后的id,默认值:null |
| 792 | + * @return |
| 793 | + * @since 1.1.3 |
| 794 | + */ |
| 795 | + @GET("v1/threads/{thread_id}/runs/{run_id}/steps") |
| 796 | + @Headers("OpenAI-Beta: assistants=v1") |
| 797 | + Single<AssistantListResponse<RunStepResponse>> runSteps(@Path("thread_id") String threadId, @Path("run_id") String runId, |
| 798 | + @Query("limit") Integer limit, @Query("order") String order, @Query("before") String before, @Query("after") String after); |
| 799 | + |
585 | 800 | } |
0 commit comments