dify

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 11 Imported by: 0

README

Dify Go SDK

Golang SDK for langgenius/dify .

Quick Start

go get github.com/soulteary/dify-go-sdk

Create a Dify client that can invoke various capabilities.

APIKey := "your_dify_api_key"
APIHost := "http://your-host/v1"

client, err := dify.CreateDifyClient(dify.DifyClientConfig{Key: APIKey, Host: APIHost})
if err != nil {
    log.Fatalf("failed to create DifyClient: %v\n", err)
    return
}

see example.

Dify Client Config

type DifyClientConfig struct {
	Key     string // API Key
	Host    string // API Host
	Timeout int    // Client Request Timeout
	SkipTLS bool   // Skip TLS Certs Verify (self-sign certs)
	User    string // AppId, for analytics
}

API: /completion-messages

The most commonly used interface, used to call the model to generate content.

  • CompletionMessages
  • CompletionMessagesStreaming
payload, err := dify.PrepareCompletionPayload(map[string]interface{}{"query": "hey"})
if err != nil {
    log.Fatalf("failed to prepare payload: %v\n", err)
    return
}

// normal response
completionMessagesResponse, err := client.CompletionMessages(payload, "", nil)
if err != nil {
    log.Fatalf("failed to get completion messages: %v\n", err)
    return
}
fmt.Println(completionMessagesResponse)
fmt.Println()

// streaming response
completionMessagesStreamingResponse, err := client.CompletionMessagesStreaming(payload, "", nil)
if err != nil {
    log.Fatalf("failed to get completion messages: %v\n", err)
    return
}
fmt.Println(completionMessagesStreamingResponse)
fmt.Println()

API: /files/upload

Upload files to Dify.

  • FileUpload
fileUploadResponse, err := client.FileUpload("./README.md", "readme.md")
if err != nil {
    log.Fatalf("failed to upload file: %v\n", err)
    return
}
fmt.Println(fileUploadResponse)
fmt.Println()

API: /completion-messages/:task_id/stop

Interface for interrupting streaming output.

  • CompletionMessagesStop
completionMessagesStopResponse, err := client.CompletionMessagesStop("0d2bd315-d4de-476f-ad5e-faaa00d571ea")
if err != nil {
    log.Fatalf("failed to stop completion messages: %v\n", err)
    return
}
fmt.Println(completionMessagesStopResponse)
fmt.Println()

API: /messages/:message_id/feedbacks

Perform f on the interface output results.

  • MessagesFeedbacks
messagesFeedbacksResponse, err := client.MessagesFeedbacks(messageID, "like")
if err != nil {
    log.Fatalf("failed to get messages feedbacks: %v\n", err)
    return
}
fmt.Println(messagesFeedbacksResponse)
fmt.Println()

API: /parameters

Get Dify parameters.

  • GetParameters
parametersResponse, err := client.GetParameters()
if err != nil {
    log.Fatalf("failed to get parameters: %v\n", err)
    return
}
fmt.Println(parametersResponse)
fmt.Println()

API: /text-to-audio

text to audio.

  • TextToAudio
  • TextToAudioStreaming
textToAudioResponse, err := client.TextToAudio("hello world")
if err != nil {
    log.Fatalf("failed to get text to audio: %v\n", err)
    return
}
fmt.Println(textToAudioResponse)
fmt.Println()

textToAudioStreamingResponse, err := client.TextToAudioStreaming("hello world")
if err != nil {
    log.Fatalf("failed to get text to audio streaming: %v\n", err)
    return
}
fmt.Println(textToAudioStreamingResponse)
fmt.Println()

Documentation

Index

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"

	CONSOLE_API_FILE_UPLOAD = "/files/upload?source=datasets"
	CONSOLE_API_LOGIN       = "/login"

	CONSOLE_API_PARAM_DATASETS_ID = ":datasets_id"

	CONSOLE_API_DATASETS_CREATE      = "/datasets"
	CONSOLE_API_DATASETS_LIST        = "/datasets"
	CONSOLE_API_DATASETS_DELETE      = "/datasets/:datasets_id"
	CONSOLE_API_DATASETS_INIT        = "/datasets/init"
	CONSOLE_API_DATASETS_INIT_STATUS = "/datasets/:datasets_id/indexing-status"

	CONSOLE_API_WORKSPACES_RERANK_MODEL        = "/workspaces/current/models/model-types/rerank"
	CONSOLE_API_CURRENT_WORKSPACE_RERANK_MODEL = "/workspaces/current/default-model?model_type=rerank"
)
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 CommonRiskForSendRequest

func CommonRiskForSendRequest(code int, err error) error

func CommonRiskForSendRequestWithCode

func CommonRiskForSendRequestWithCode(code int, err error, targetCode int) error

func PrepareChatPayload

func PrepareChatPayload(payload map[string]interface{}) (string, error)

func PrepareCompletionPayload

func PrepareCompletionPayload(payload map[string]interface{}) (string, error)

func SendGetRequest

func SendGetRequest(forConsole bool, dc *DifyClient, api string) (httpCode int, bodyText []byte, err error)

func SendGetRequestToAPI

func SendGetRequestToAPI(dc *DifyClient, api string) (httpCode int, bodyText []byte, err error)

func SendGetRequestToConsole

func SendGetRequestToConsole(dc *DifyClient, api string) (httpCode int, bodyText []byte, err error)

func SendPostRequest

func SendPostRequest(forConsole bool, dc *DifyClient, api string, postBody interface{}) (httpCode int, bodyText []byte, err error)

func SendPostRequestToAPI

func SendPostRequestToAPI(dc *DifyClient, api string, postBody interface{}) (httpCode int, bodyText []byte, err error)

func SendPostRequestToConsole

func SendPostRequestToConsole(dc *DifyClient, api string, postBody interface{}) (httpCode int, bodyText []byte, err error)

func UpdateAPIParam

func UpdateAPIParam(api, key, value string) string

Types

type AudioToTextResponse

type AudioToTextResponse struct {
	Text string `json:"text"`
}

type ChatMessagesPayload

type ChatMessagesPayload struct {
	Inputs         any                       `json:"inputs"`
	Query          string                    `json:"query"`
	ResponseMode   string                    `json:"response_mode"`
	ConversationID string                    `json:"conversation_id,omitempty"`
	User           string                    `json:"user"`
	Files          []ChatMessagesPayloadFile `json:"files,omitempty"`
}

type ChatMessagesPayloadFile

type ChatMessagesPayloadFile struct {
	Type           string `json:"type"`
	TransferMethod string `json:"transfer_method"`
	URL            string `json:"url,omitempty"`
	UploadFileID   string `json:"upload_file_id,omitempty"`
}

type ChatMessagesResponse

type ChatMessagesResponse struct {
	Event          string `json:"event"`
	MessageID      string `json:"message_id"`
	ConversationID string `json:"conversation_id"`
	Mode           string `json:"mode"`
	Answer         string `json:"answer"`
	Metadata       any    `json:"metadata"`
	CreatedAt      int    `json:"created_at"`
}

type ChatMessagesStopResponse

type ChatMessagesStopResponse struct {
	Result string `json:"result"`
}

type CompletionMessagesPayload

type CompletionMessagesPayload struct {
	Inputs         any    `json:"inputs"`
	ResponseMode   string `json:"response_mode,omitempty"`
	User           string `json:"user"`
	ConversationID string `json:"conversation_id,omitempty"`
}

type CompletionMessagesResponse

type CompletionMessagesResponse struct {
	Event     string `json:"event"`
	TaskID    string `json:"task_id"`
	ID        string `json:"id"`
	MessageID string `json:"message_id"`
	Mode      string `json:"mode"`
	Answer    string `json:"answer"`
	Metadata  any    `json:"metadata"`
	CreatedAt int    `json:"created_at"`
}

type CompletionMessagesStopResponse

type CompletionMessagesStopResponse struct {
	Result string `json:"result"`
}

type ConversationsResponse

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 CreateDatasetsPayload

type CreateDatasetsPayload struct {
	Name string `json:"name"`
}

type CreateDatasetsResponse

type CreateDatasetsResponse struct {
	ID                     string `json:"id"`
	Name                   string `json:"name"`
	Description            any    `json:"description"`
	Provider               string `json:"provider"`
	Permission             string `json:"permission"`
	DataSourceType         any    `json:"data_source_type"`
	IndexingTechnique      any    `json:"indexing_technique"`
	AppCount               int    `json:"app_count"`
	DocumentCount          int    `json:"document_count"`
	WordCount              int    `json:"word_count"`
	CreatedBy              string `json:"created_by"`
	CreatedAt              int    `json:"created_at"`
	UpdatedBy              string `json:"updated_by"`
	UpdatedAt              int    `json:"updated_at"`
	EmbeddingModel         any    `json:"embedding_model"`
	EmbeddingModelProvider any    `json:"embedding_model_provider"`
	EmbeddingAvailable     any    `json:"embedding_available"`
	RetrievalModelDict     struct {
		SearchMethod    string `json:"search_method"`
		RerankingEnable bool   `json:"reranking_enable"`
		RerankingModel  struct {
			RerankingProviderName string `json:"reranking_provider_name"`
			RerankingModelName    string `json:"reranking_model_name"`
		} `json:"reranking_model"`
		TopK                  int  `json:"top_k"`
		ScoreThresholdEnabled bool `json:"score_threshold_enabled"`
		ScoreThreshold        any  `json:"score_threshold"`
	} `json:"retrieval_model_dict"`
	Tags []any `json:"tags"`
}

type DeleteConversationsResponse

type DeleteConversationsResponse struct {
	Result string `json:"result"`
}

type DifyClient

type DifyClient struct {
	Key          string
	Host         string
	ConsoleHost  string
	ConsoleToken string
	Timeout      time.Duration
	SkipTLS      bool
	Client       *http.Client
	User         string
}

func CreateDifyClient

func CreateDifyClient(config DifyClientConfig) (*DifyClient, error)

func (*DifyClient) AudioToText

func (dc *DifyClient) AudioToText(filePath string) (result AudioToTextResponse, err error)

func (*DifyClient) ChatMessages

func (dc *DifyClient) ChatMessages(query string, inputs string, conversation_id string, files []any) (result ChatMessagesResponse, err error)

func (*DifyClient) ChatMessagesStop

func (dc *DifyClient) ChatMessagesStop(task_id string) (result ChatMessagesStopResponse, err error)

func (*DifyClient) ChatMessagesStreaming

func (dc *DifyClient) ChatMessagesStreaming(inputs string, conversation_id string, files []any) (result string, err error)

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 (dc *DifyClient) CompletionMessagesStreaming(inputs string, conversation_id string, files []any) (result string, err error)

func (*DifyClient) Conversations

func (dc *DifyClient) Conversations(last_id string, limit int) (result ConversationsResponse, err error)

func (*DifyClient) CreateDatasets

func (dc *DifyClient) CreateDatasets(datasets_name string) (result CreateDatasetsResponse, err error)

func (*DifyClient) DatasetsFileUpload

func (dc *DifyClient) DatasetsFileUpload(filePath string, fileName string) (result FileUploadResponse, err error)

func (*DifyClient) DeleteConversation

func (dc *DifyClient) DeleteConversation(conversation_id string) (result DeleteConversationsResponse, err error)

func (*DifyClient) DeleteDatasets

func (dc *DifyClient) DeleteDatasets(datasets_id string) (ok bool, 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) GetConsoleAPI

func (dc *DifyClient) GetConsoleAPI(api string) string

func (*DifyClient) GetCurrentWorkspaceRerankDefaultModel

func (dc *DifyClient) GetCurrentWorkspaceRerankDefaultModel() (result GetCurrentWorkspaceRerankDefaultModelResponse, err error)

func (*DifyClient) GetMeta

func (dc *DifyClient) GetMeta() (result GetMetaResponse, err error)

func (*DifyClient) GetParameters

func (dc *DifyClient) GetParameters() (result GetParametersResponse, err error)

func (*DifyClient) InitDatasetsByUploadFile

func (dc *DifyClient) InitDatasetsByUploadFile(datasets_ids []string) (result InitDatasetsResponse, err error)

func (*DifyClient) InitDatasetsIndexingStatus

func (dc *DifyClient) InitDatasetsIndexingStatus(datasets_id string) (result InitDatasetsIndexingStatusResponse, err error)

func (*DifyClient) ListDatasets

func (dc *DifyClient) ListDatasets(page int, limit int) (result ListDatasetsResponse, err error)

func (*DifyClient) ListWorkspacesRerankModels

func (dc *DifyClient) ListWorkspacesRerankModels() (result ListWorkspacesRerankModelsResponse, err error)

func (*DifyClient) Messages

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

func (dc *DifyClient) MessagesSuggested(message_id string) (result MessagesSuggestedResponse, err error)

func (*DifyClient) RenameConversation

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)

func (*DifyClient) UserLogin

func (dc *DifyClient) UserLogin(email string, password string) (result UserLoginResponse, err error)

type DifyClientConfig

type DifyClientConfig struct {
	Key         string
	Host        string
	ConsoleHost string
	Timeout     int
	SkipTLS     bool
	User        string
}

type FileUploadResponse

type FileUploadResponse struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Size      int    `json:"size"`
	Extension string `json:"extension"`
	MimeType  string `json:"mime_type"`
	CreatedBy string `json:"created_by"`
	CreatedAt int    `json:"created_at"`
}

type GetCurrentWorkspaceRerankDefaultModelResponse

type GetCurrentWorkspaceRerankDefaultModelResponse struct {
	Data any `json:"data"`
}

type GetMetaResponse

type GetMetaResponse struct {
	ToolIcons struct {
		Dalle2  string `json:"dalle2"`
		APITool struct {
			Background string `json:"background"`
			Content    string `json:"content"`
		} `json:"api_tool"`
	} `json:"tool_icons"`
}

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 InitDatasetsIndexingStatusData

type InitDatasetsIndexingStatusData struct {
	ID                   string `json:"id"`
	IndexingStatus       string `json:"indexing_status"`
	ProcessingStartedAt  int    `json:"processing_started_at"`
	ParsingCompletedAt   any    `json:"parsing_completed_at"`
	CleaningCompletedAt  any    `json:"cleaning_completed_at"`
	SplittingCompletedAt any    `json:"splitting_completed_at"`
	CompletedAt          any    `json:"completed_at"`
	PausedAt             any    `json:"paused_at"`
	Error                any    `json:"error"`
	StoppedAt            any    `json:"stopped_at"`
	CompletedSegments    int    `json:"completed_segments"`
	TotalSegments        int    `json:"total_segments"`
}

type InitDatasetsIndexingStatusResponse

type InitDatasetsIndexingStatusResponse struct {
	Data []InitDatasetsIndexingStatusData `json:"data"`
}

type InitDatasetsPayload

type InitDatasetsPayload struct {
	DataSource        InitDatasetsPayloadDataSource     `json:"data_source"`
	IndexingTechnique string                            `json:"indexing_technique"`
	ProcessRule       InitDatasetsPayloadProcessRule    `json:"process_rule"`
	DocForm           string                            `json:"doc_form"`
	DocLanguage       string                            `json:"doc_language"`
	RetrievalModel    InitDatasetsPayloadRetrievalModel `json:"retrieval_model"`
}

type InitDatasetsPayloadDataSource

type InitDatasetsPayloadDataSource struct {
	Type     string                                `json:"type"`
	InfoList InitDatasetsPayloadDataSourceInfoList `json:"info_list"`
}

type InitDatasetsPayloadDataSourceFileInfoList

type InitDatasetsPayloadDataSourceFileInfoList struct {
	FileIds []string `json:"file_ids"`
}

type InitDatasetsPayloadDataSourceInfoList

type InitDatasetsPayloadDataSourceInfoList struct {
	DataSourceType string                                    `json:"data_source_type"`
	FileInfoList   InitDatasetsPayloadDataSourceFileInfoList `json:"file_info_list"`
}

type InitDatasetsPayloadProcessRule

type InitDatasetsPayloadProcessRule struct {
	Rules struct {
	} `json:"rules"`
	Mode string `json:"mode"`
}

type InitDatasetsPayloadRerankingModel

type InitDatasetsPayloadRerankingModel struct {
	RerankingProviderName string `json:"reranking_provider_name"`
	RerankingModelName    string `json:"reranking_model_name"`
}

type InitDatasetsPayloadRetrievalModel

type InitDatasetsPayloadRetrievalModel struct {
	SearchMethod          string                            `json:"search_method"`
	RerankingEnable       bool                              `json:"reranking_enable"`
	RerankingModel        InitDatasetsPayloadRerankingModel `json:"reranking_model"`
	TopK                  int                               `json:"top_k"`
	ScoreThresholdEnabled bool                              `json:"score_threshold_enabled"`
	ScoreThreshold        float64                           `json:"score_threshold"`
}

type InitDatasetsResponse

type InitDatasetsResponse struct {
	Dataset   InitDatasetsResponseDataset           `json:"dataset"`
	Documents []InitDatasetsResponseDatasetDocument `json:"documents"`
	Batch     string                                `json:"batch"`
}

type InitDatasetsResponseDataset

type InitDatasetsResponseDataset struct {
	ID                string `json:"id"`
	Name              string `json:"name"`
	Description       string `json:"description"`
	Permission        string `json:"permission"`
	DataSourceType    string `json:"data_source_type"`
	IndexingTechnique string `json:"indexing_technique"`
	CreatedBy         string `json:"created_by"`
	CreatedAt         int    `json:"created_at"`
}

type InitDatasetsResponseDatasetDocument

type InitDatasetsResponseDatasetDocument struct {
	ID             string `json:"id"`
	Position       int    `json:"position"`
	DataSourceType string `json:"data_source_type"`
	DataSourceInfo struct {
		UploadFileID string `json:"upload_file_id"`
	} `json:"data_source_info"`
	DatasetProcessRuleID string `json:"dataset_process_rule_id"`
	Name                 string `json:"name"`
	CreatedFrom          string `json:"created_from"`
	CreatedBy            string `json:"created_by"`
	CreatedAt            int    `json:"created_at"`
	Tokens               int    `json:"tokens"`
	IndexingStatus       string `json:"indexing_status"`
	Error                any    `json:"error"`
	Enabled              bool   `json:"enabled"`
	DisabledAt           any    `json:"disabled_at"`
	DisabledBy           any    `json:"disabled_by"`
	Archived             bool   `json:"archived"`
	DisplayStatus        string `json:"display_status"`
	WordCount            int    `json:"word_count"`
	HitCount             int    `json:"hit_count"`
	DocForm              string `json:"doc_form"`
}

type ListDatasetsItem

type ListDatasetsItem struct {
	ID             string                  `json:"id"`
	Name           string                  `json:"name"`
	Description    string                  `json:"description"`
	Mode           string                  `json:"mode"`
	Icon           string                  `json:"icon"`
	IconBackground string                  `json:"icon_background"`
	ModelConfig    ListDatasetsModelConfig `json:"model_config"`
	CreatedAt      int                     `json:"created_at"`
	Tags           []any                   `json:"tags"`
}

type ListDatasetsModelConfig

type ListDatasetsModelConfig struct {
	Model     ListDatasetsModelConfigDetail `json:"model"`
	PrePrompt string                        `json:"pre_prompt"`
}

type ListDatasetsModelConfigDetail

type ListDatasetsModelConfigDetail struct {
	Provider         string `json:"provider"`
	Name             string `json:"name"`
	Mode             string `json:"mode"`
	CompletionParams struct {
	} `json:"completion_params"`
}

type ListDatasetsResponse

type ListDatasetsResponse struct {
	Page    int                `json:"page"`
	Limit   int                `json:"limit"`
	Total   int                `json:"total"`
	HasMore bool               `json:"has_more"`
	Data    []ListDatasetsItem `json:"data"`
}

type ListWorkspacesRerankItem

type ListWorkspacesRerankItem struct {
	Provider string `json:"provider"`
	Label    struct {
		ZhHans string `json:"zh_Hans"`
		EnUS   string `json:"en_US"`
	} `json:"label"`
	IconSmall struct {
		ZhHans string `json:"zh_Hans"`
		EnUS   string `json:"en_US"`
	} `json:"icon_small"`
	IconLarge struct {
		ZhHans string `json:"zh_Hans"`
		EnUS   string `json:"en_US"`
	} `json:"icon_large"`
	Status string                      `json:"status"`
	Models []ListWorkspacesRerankModel `json:"models"`
}

type ListWorkspacesRerankModel

type ListWorkspacesRerankModel struct {
	Model string `json:"model"`
	Label struct {
		ZhHans string `json:"zh_Hans"`
		EnUS   string `json:"en_US"`
	} `json:"label"`
	ModelType       string `json:"model_type"`
	Features        any    `json:"features"`
	FetchFrom       string `json:"fetch_from"`
	ModelProperties struct {
		ContextSize int `json:"context_size"`
	} `json:"model_properties"`
	Deprecated bool   `json:"deprecated"`
	Status     string `json:"status"`
}

type ListWorkspacesRerankModelsResponse

type ListWorkspacesRerankModelsResponse struct {
	Data []ListWorkspacesRerankItem `json:"data"`
}

type MessagesFeedbacksResponse

type MessagesFeedbacksResponse struct {
	Result string `json:"result"`
}

type MessagesResponse

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

type MessagesSuggestedResponse struct {
	Result string   `json:"result"`
	Data   []string `json:"data"`
}

type RenameConversationsResponse

type RenameConversationsResponse struct {
	Result string `json:"result"`
}

type UserLoginParams

type UserLoginParams struct {
	Email      string `json:"email"`
	Password   string `json:"password"`
	RememberMe bool   `json:"remember_me"`
}

type UserLoginResponse

type UserLoginResponse struct {
	Result string `json:"result"`
	Data   string `json:"data"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL