Documentation
¶
Index ¶
- Constants
- func PrepareChatPayload(payload map[string]interface{}) (string, error)
- func PrepareCompletionPayload(payload map[string]interface{}) (string, error)
- func UpdateAPIParam(api, key, value string) string
- type AudioToTextResponse
- type ChatMessagesPayload
- type ChatMessagesPayloadFile
- type ChatMessagesResponse
- type ChatMessagesStopResponse
- type CompletionMessagesPayload
- type CompletionMessagesResponse
- type CompletionMessagesStopResponse
- type ConversationsResponse
- type DeleteConversationsResponse
- type DifyClient
- func (dc *DifyClient) AudioToText(filePath string) (result AudioToTextResponse, err error)
- func (dc *DifyClient) ChatMessages(inputs string, conversation_id string, files []any) (result ChatMessagesResponse, err error)
- func (dc *DifyClient) ChatMessagesStop(task_id string) (result ChatMessagesStopResponse, err error)
- func (dc *DifyClient) ChatMessagesStreaming(inputs string, conversation_id string, files []any) (result string, err error)
- func (dc *DifyClient) CompletionMessages(inputs string, conversation_id string, files []any) (result CompletionMessagesResponse, err error)
- func (dc *DifyClient) CompletionMessagesStop(task_id string) (result CompletionMessagesStopResponse, err error)
- func (dc *DifyClient) CompletionMessagesStreaming(inputs string, conversation_id string, files []any) (result string, err error)
- func (dc *DifyClient) Conversations(last_id string, limit int) (result ConversationsResponse, err error)
- func (dc *DifyClient) DeleteConversation(conversation_id string) (result DeleteConversationsResponse, err error)
- func (dc *DifyClient) FileUpload(filePath string, fileName string) (result FileUploadResponse, err error)
- func (dc *DifyClient) GetAPI(api string) string
- func (dc *DifyClient) GetMeta() (result GetMetaResponse, err error)
- func (dc *DifyClient) GetParameters() (result GetParametersResponse, err error)
- func (dc *DifyClient) Messages(conversation_id string) (result MessagesResponse, err error)
- func (dc *DifyClient) MessagesFeedbacks(message_id string, rating string) (result MessagesFeedbacksResponse, err error)
- func (dc *DifyClient) MessagesSuggested(message_id string) (result MessagesSuggestedResponse, err error)
- func (dc *DifyClient) RenameConversation(conversation_id string) (result RenameConversationsResponse, err error)
- func (dc *DifyClient) TextToAudio(text string) (result any, err error)
- func (dc *DifyClient) TextToAudioStreaming(text string) (result any, err error)
- type DifyClientConfig
- type FileUploadResponse
- type GetMetaResponse
- type GetParametersResponse
- type MessagesFeedbacksResponse
- type MessagesResponse
- type MessagesSuggestedResponse
- type RenameConversationsResponse
Constants ¶
View Source
const ( API_COMPLETION_MESSAGES = "/completion-messages" API_COMPLETION_MESSAGES_STOP = "/completion-messages/:task_id/stop" API_CHAT_MESSAGES = "/chat-messages" API_CHAT_MESSAGES_STOP = "/chat-messages/:task_id/stop" API_MESSAGES = "/messages" API_MESSAGES_SUGGESTED = "/messages/:message_id/suggested" API_MESSAGES_FEEDBACKS = "/messages/:message_id/feedbacks" API_CONVERSATIONS = "/conversations" API_CONVERSATIONS_DELETE = "/conversations/:conversation_id" API_CONVERSATIONS_RENAME = "/conversations/:conversation_id/name" API_FILE_UPLOAD = "/files/upload" API_PARAMETERS = "/parameters" API_META = "/meta" API_AUDIO_TO_TEXT = "/audio-to-text" API_TEXT_TO_AUDIO = "/text-to-audio" API_PARAM_TASK_ID = ":task_id" API_PARAM_MESSAGE_ID = ":message_id" API_PARAM_CONVERSATION_ID = ":conversation_id" )
View Source
const ( DEFAULT_TIMEOUT = 10 DEFAULT_USER = "dify-go-sdk" RESPONSE_MODE_STREAMING = "streaming" RESPONSE_MODE_BLOCKING = "blocking" )
Variables ¶
This section is empty.
Functions ¶
func PrepareChatPayload ¶ added in v0.0.4
func UpdateAPIParam ¶
Types ¶
type AudioToTextResponse ¶ added in v0.0.4
type AudioToTextResponse struct {
Text string `json:"text"`
}
type ChatMessagesPayload ¶ added in v0.0.4
type ChatMessagesPayloadFile ¶ added in v0.0.4
type ChatMessagesResponse ¶ added in v0.0.4
type ChatMessagesStopResponse ¶ added in v0.0.4
type ChatMessagesStopResponse struct {
Result string `json:"result"`
}
type CompletionMessagesStopResponse ¶
type CompletionMessagesStopResponse struct {
Result string `json:"result"`
}
type ConversationsResponse ¶ added in v0.0.4
type ConversationsResponse struct { Limit int `json:"limit"` HasMore bool `json:"has_more"` Data []struct { ID string `json:"id"` Name string `json:"name,omitempty"` Inputs struct { Book string `json:"book"` MyName string `json:"myName"` } `json:"inputs,omitempty"` Status string `json:"status,omitempty"` CreatedAt int `json:"created_at,omitempty"` } `json:"data"` }
type DeleteConversationsResponse ¶ added in v0.0.4
type DeleteConversationsResponse struct {
Result string `json:"result"`
}
type DifyClient ¶
type DifyClient struct { Key string Host string Timeout time.Duration SkipTLS bool Client *http.Client User string }
func CreateDifyClient ¶
func CreateDifyClient(config DifyClientConfig) (*DifyClient, error)
func (*DifyClient) AudioToText ¶ added in v0.0.4
func (dc *DifyClient) AudioToText(filePath string) (result AudioToTextResponse, err error)
func (*DifyClient) ChatMessages ¶ added in v0.0.4
func (dc *DifyClient) ChatMessages(inputs string, conversation_id string, files []any) (result ChatMessagesResponse, err error)
func (*DifyClient) ChatMessagesStop ¶ added in v0.0.4
func (dc *DifyClient) ChatMessagesStop(task_id string) (result ChatMessagesStopResponse, err error)
func (*DifyClient) ChatMessagesStreaming ¶ added in v0.0.4
func (*DifyClient) CompletionMessages ¶
func (dc *DifyClient) CompletionMessages(inputs string, conversation_id string, files []any) (result CompletionMessagesResponse, err error)
func (*DifyClient) CompletionMessagesStop ¶
func (dc *DifyClient) CompletionMessagesStop(task_id string) (result CompletionMessagesStopResponse, err error)
func (*DifyClient) CompletionMessagesStreaming ¶
func (*DifyClient) Conversations ¶ added in v0.0.4
func (dc *DifyClient) Conversations(last_id string, limit int) (result ConversationsResponse, err error)
func (*DifyClient) DeleteConversation ¶ added in v0.0.4
func (dc *DifyClient) DeleteConversation(conversation_id string) (result DeleteConversationsResponse, err error)
func (*DifyClient) FileUpload ¶
func (dc *DifyClient) FileUpload(filePath string, fileName string) (result FileUploadResponse, err error)
func (*DifyClient) GetAPI ¶
func (dc *DifyClient) GetAPI(api string) string
func (*DifyClient) GetMeta ¶ added in v0.0.4
func (dc *DifyClient) GetMeta() (result GetMetaResponse, err error)
func (*DifyClient) GetParameters ¶
func (dc *DifyClient) GetParameters() (result GetParametersResponse, err error)
func (*DifyClient) Messages ¶ added in v0.0.4
func (dc *DifyClient) Messages(conversation_id string) (result MessagesResponse, err error)
func (*DifyClient) MessagesFeedbacks ¶
func (dc *DifyClient) MessagesFeedbacks(message_id string, rating string) (result MessagesFeedbacksResponse, err error)
func (*DifyClient) MessagesSuggested ¶ added in v0.0.4
func (dc *DifyClient) MessagesSuggested(message_id string) (result MessagesSuggestedResponse, err error)
func (*DifyClient) RenameConversation ¶ added in v0.0.4
func (dc *DifyClient) RenameConversation(conversation_id string) (result RenameConversationsResponse, err error)
func (*DifyClient) TextToAudio ¶
func (dc *DifyClient) TextToAudio(text string) (result any, err error)
func (*DifyClient) TextToAudioStreaming ¶
func (dc *DifyClient) TextToAudioStreaming(text string) (result any, err error)
type DifyClientConfig ¶
type FileUploadResponse ¶
type GetMetaResponse ¶ added in v0.0.4
type GetParametersResponse ¶
type GetParametersResponse struct { OpeningStatement string `json:"opening_statement"` SuggestedQuestions []any `json:"suggested_questions"` SuggestedQuestionsAfterAnswer struct { Enabled bool `json:"enabled"` } `json:"suggested_questions_after_answer"` SpeechToText struct { Enabled bool `json:"enabled"` } `json:"speech_to_text"` TextToSpeech struct { Enabled bool `json:"enabled"` Voice string `json:"voice"` Language string `json:"language"` } `json:"text_to_speech"` RetrieverResource struct { Enabled bool `json:"enabled"` } `json:"retriever_resource"` AnnotationReply struct { Enabled bool `json:"enabled"` } `json:"annotation_reply"` MoreLikeThis struct { Enabled bool `json:"enabled"` } `json:"more_like_this"` UserInputForm []struct { Paragraph struct { Label string `json:"label"` Variable string `json:"variable"` Required bool `json:"required"` Default string `json:"default"` } `json:"paragraph"` } `json:"user_input_form"` SensitiveWordAvoidance struct { Enabled bool `json:"enabled"` Type string `json:"type"` Configs []any `json:"configs"` } `json:"sensitive_word_avoidance"` FileUpload struct { Image struct { Enabled bool `json:"enabled"` NumberLimits int `json:"number_limits"` Detail string `json:"detail"` TransferMethods []string `json:"transfer_methods"` } `json:"image"` } `json:"file_upload"` SystemParameters struct { ImageFileSizeLimit string `json:"image_file_size_limit"` } `json:"system_parameters"` }
type MessagesFeedbacksResponse ¶
type MessagesFeedbacksResponse struct {
Result string `json:"result"`
}
type MessagesResponse ¶ added in v0.0.4
type MessagesResponse struct { Limit int `json:"limit"` HasMore bool `json:"has_more"` Data []struct { ID string `json:"id"` ConversationID string `json:"conversation_id"` Inputs struct { Name string `json:"name"` } `json:"inputs"` Query string `json:"query"` Answer string `json:"answer"` MessageFiles []any `json:"message_files"` Feedback any `json:"feedback"` RetrieverResources []struct { Position int `json:"position"` DatasetID string `json:"dataset_id"` DatasetName string `json:"dataset_name"` DocumentID string `json:"document_id"` DocumentName string `json:"document_name"` SegmentID string `json:"segment_id"` Score float64 `json:"score"` Content string `json:"content"` } `json:"retriever_resources"` AgentThoughts []any `json:"agent_thoughts"` CreatedAt int `json:"created_at"` } `json:"data"` }
type MessagesSuggestedResponse ¶ added in v0.0.4
type RenameConversationsResponse ¶ added in v0.0.4
type RenameConversationsResponse struct {
Result string `json:"result"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.