...

Package externalfunctions

import "github.com/ansys/allie-flowkit/pkg/externalfunctions"
Overview
Index

Overview ▾

Index ▾

Variables
func AddDataRequest(collectionName string, documentData []sharedtypes.DbData)
func AisAcsSemanticHybridSearchs(acsEndpoint string, acsApiKey string, acsApiVersion string, query string, embeddedQuery []float32, indexList []string, physics []string, topK int) []sharedtypes.ACSSearchResponse
func AisChangeAcsResponsesByFactor(factors map[string]float64, semanticSearchOutput []sharedtypes.ACSSearchResponse) (changedSemanticSearchOutput []sharedtypes.ACSSearchResponse)
func AisPerformLLMFinalRequest(systemTemplate string, userTemplate string, query string, history []sharedtypes.HistoricMessage, context []sharedtypes.ACSSearchResponse, prohibitedWords []string, errorList1 []string, errorList2 []string, tokenCountEndpoint string, previousInputTokenCount int, previousOutputTokenCount int, tokenCountModelName string, isStream bool, userEmail string, jwtToken string) (message string, stream *chan string)
func AisPerformLLMRephraseRequest(systemTemplate string, userTemplate string, query string, history []sharedtypes.HistoricMessage, tokenCountModelName string) (rephrasedQuery string, inputTokenCount int, outputTokenCount int)
func AisReturnIndexList(accessPoint string, physics []string, version []string) (indexList []string)
func AnsysGPTACSSemanticHybridSearchs(acsEndpoint string, acsApiKey string, acsApiVersion string, query string, embeddedQuery []float32, indexList []string, filter map[string]string, topK int) (output []sharedtypes.ACSSearchResponse)
func AnsysGPTBuildFinalQuery(refrasedQuery string, context []sharedtypes.ACSSearchResponse) (finalQuery string, errorResponse string, displayFixedMessageToUser bool)
func AnsysGPTCheckProhibitedWords(query string, prohibitedWords []string, errorResponseMessage string) (foundProhibited bool, responseMessage string)
func AnsysGPTExtractFieldsFromQuery(query string, fieldValues map[string][]string, defaultFields []sharedtypes.AnsysGPTDefaultFields) (fields map[string]string)
func AnsysGPTGetSystemPrompt(query string, prohibitedWords []string, template string) (systemPrompt string)
func AnsysGPTPerformLLMRephraseRequest(userTemplate string, query string, history []sharedtypes.HistoricMessage, systemPrompt string) (rephrasedQuery string)
func AnsysGPTPerformLLMRephraseRequestNew(template string, query string, history []sharedtypes.HistoricMessage) (rephrasedQuery string)
func AnsysGPTPerformLLMRequest(finalQuery string, history []sharedtypes.HistoricMessage, systemPrompt string, isStream bool) (message string, stream *chan string)
func AnsysGPTRemoveNoneCitationsFromSearchResponse(semanticSearchOutput []sharedtypes.ACSSearchResponse, citations []sharedtypes.AnsysGPTCitation) (reducedSemanticSearchOutput []sharedtypes.ACSSearchResponse)
func AnsysGPTReorderSearchResponseAndReturnOnlyTopK(semanticSearchOutput []sharedtypes.ACSSearchResponse, topK int) (reorderedSemanticSearchOutput []sharedtypes.ACSSearchResponse)
func AnsysGPTReturnIndexList(indexGroups []string) (indexList []string)
func AppendMeshPilotHistory(history []map[string]string, role, content string) (updatedHistory []map[string]string)
func AppendMessageHistory(newMessage string, role AppendMessageHistoryRole, history []sharedtypes.HistoricMessage) (updatedHistory []sharedtypes.HistoricMessage)
func AppendStringSlices(slice1, slice2, slice3, slice4, slice5 []string) []string
func AppendToolHistory(toolHistory []map[string]string, toolId, toolName, toolArguments, toolResponse string) (updatedToolHistory []map[string]string)
func AssignStringToString(inputString string) (outputString string)
func BuildFinalQueryForCodeLLMRequest(request string, knowledgedbResponse []sharedtypes.DbResponse) (finalQuery string)
func BuildFinalQueryForGeneralLLMRequest(request string, knowledgedbResponse []sharedtypes.DbResponse) (finalQuery string)
func BuildLibraryContext(message string, libraryContext string) (messageWithContext string)
func CheckApiKeyAuthMongoDb(apiKey string, mongoDbUrl string, mongoDatabaseName string, mongoDbCollectionName string) (isAuthenticated bool)
func CreateCollectionRequest(collectionName string)
func CreateDbFilter(guid []string, documentId []string, documentName []string, level []string, tags sharedtypes.DbArrayFilter, keywords sharedtypes.DbArrayFilter, metadata []sharedtypes.DbJsonFilter) (databaseFilter sharedtypes.DbFilters)
func CreateEmbeddings(dense bool, sparse bool, colbert bool, isDocument bool, passages []string) (dense_vector [][]float32, lexical_weights []map[uint]float32, colbert_vecs [][][]float32, func_error error)
func CreateGeneralDataExtractionDocumentObjects(documentName string, documentChunks []string, denseEmbeddings [][]float32, sparseEmbeddings []map[uint]float32) (extractionData []interface{})
func CreateKeywordsDbFilter(keywords []string, needAll bool) (databaseFilter sharedtypes.DbArrayFilter)
func CreateMessageWithVariable(message string, variable string) (updatedMessage string)
func CreateMetadataDbFilter(fieldName string, fieldType string, filterData []string, needAll bool) (databaseFilter sharedtypes.DbJsonFilter)
func CreateTagsDbFilter(tags []string, needAll bool) (databaseFilter sharedtypes.DbArrayFilter)
func DenyCustomerAccessAndSendWarningMongoDb(apiKey string, mongoDbUrl string, mongoDatabaseName string, mongoDbCollectionName string) (customerName string, sendWarning bool)
func DownloadGithubFileContent(githubRepoName string, githubRepoOwner string, githubRepoBranch string, gihubFilePath string, githubAccessToken string) (checksum string, content []byte)
func DownloadGithubFilesContent(githubRepoName string, githubRepoOwner string, githubRepoBranch string, gihubFilePaths []string, githubAccessToken string) (filesMap map[string][]byte)
func FetchActionsPathFromPathDescription(description, nodeLabel string) (actions []map[string]string)
func FetchNodeDescriptionsFromPathDescription(description string) (actionDescriptions string)
func FetchPropertiesFromPathDescription(description string) (properties []string)
func FinalizeResult(actions []map[string]string, toolName string) (result string)
func FindRelevantPathDescriptionByPrompt(descriptions []string, instruction string) (relevantDescription string)
func GeneralNeo4jQuery(query string) (databaseResponse sharedtypes.Neo4jResponse)
func GeneralQuery(collectionName string, maxRetrievalCount int, outputFields []string, filters sharedtypes.DbFilters) (databaseResponse []sharedtypes.DbResponse)
func GenerateDocumentTree(documentName string, documentId string, documentChunks []string, embeddingsDimensions int, getSummary bool, getKeywords bool, numKeywords int, chunkSize int, numLlmWorkers int) (returnedDocumentData []sharedtypes.DbData)
func GetActionsFromConfig(toolName string) (result string)
func GetDocumentType(filePath string) (documentType string)
func GetGithubFilesToExtract(githubRepoName string, githubRepoOwner string, githubRepoBranch string, githubAccessToken string, githubFileExtensions []string, githubFilteredDirectories []string, githubExcludedDirectories []string) (githubFilesToExtract []string)
func GetListCollections() (collectionsList []string)
func GetLocalFileContent(localFilePath string) (checksum string, content []byte)
func GetLocalFilesContent(localFilePaths []string) (filesMap map[string][]byte)
func GetLocalFilesToExtract(localPath string, localFileExtensions []string, localFilteredDirectories []string, localExcludedDirectories []string) (localFilesToExtract []string)
func GetSelectedSolution(arguments string) (solution string)
func GetSolutionsToFixProblem(fmFailureCode, primeMeshFailureCode string) (solutions string)
func LangchainSplitter(bytesContent []byte, documentType string, chunkSize int, chunkOverlap int) (output []string)
func LoadAndCheckExampleDependencies(dependenciesContent []byte, elements []sharedtypes.CodeGenerationElement, instancesReplacementDict map[string]string, InstancesReplacementPriorityList []string) (checkedDependenciesMap map[string][]string, equivalencesMap map[string]map[string]string)
func LoadCodeGenerationElements(content []byte, elementsFilePath string) (elements []sharedtypes.CodeGenerationElement)
func LoadCodeGenerationExamples(source string, examplesToExtract []string, githubRepoName string, githubRepoOwner string, githubRepoBranch string, githubAccessToken string, dependencies map[string][]string, equivalencesMap map[string]map[string]string, chunkSize int, chunkOverlap int) (examples []sharedtypes.CodeGenerationExample)
func LoadUserGuideSections(source string, sectionFilePaths []string, githubRepoName string, githubRepoOwner string, githubRepoBranch string, githubAccessToken string) (sections []sharedtypes.CodeGenerationUserGuideSection)
func MeshPilotReAct(instruction string, history []map[string]string, toolsHistory []map[string]string, reActStage string) (stage, toolId, toolName, toolArgument, result string)
func MilvusCreateCollection(collectionName string, schema []map[string]interface{})
func MilvusInsertData(collectionName string, data []interface{}, idFieldName string)
func PerformBatchEmbeddingRequest(input []string) (embeddedVectors [][]float32)
func PerformBatchHybridEmbeddingRequest(input []string, maxBatchSize int) (denseEmbeddings [][]float32, sparseEmbeddings []map[uint]float32)
func PerformCodeLLMRequest(input string, history []sharedtypes.HistoricMessage, isStream bool, validateCode bool) (message string, stream *chan string)
func PerformGeneralModelSpecificationRequest(input string, history []sharedtypes.HistoricMessage, isStream bool, systemPrompt map[string]string, modelIds []string) (message string, stream *chan string)
func PerformGeneralRequest(input string, history []sharedtypes.HistoricMessage, isStream bool, systemPrompt string) (message string, stream *chan string)
func PerformGeneralRequestNoStreaming(input string, history []sharedtypes.HistoricMessage, systemPrompt string) (message string)
func PerformGeneralRequestSpecificModel(input string, history []sharedtypes.HistoricMessage, isStream bool, systemPrompt string, modelIds []string) (message string, stream *chan string)
func PerformGeneralRequestSpecificModelAndModelOptions(input string, history []sharedtypes.HistoricMessage, isStream bool, systemPrompt string, modelIds []string, modelOptions sharedtypes.ModelOptions) (message string, stream *chan string)
func PerformGeneralRequestSpecificModelNoStreamWithOpenAiTokenOutput(input string, history []sharedtypes.HistoricMessage, systemPrompt string, modelIds []string, tokenCountModelName string) (message string, tokenCount int)
func PerformGeneralRequestWithImages(input string, history []sharedtypes.HistoricMessage, isStream bool, systemPrompt string, images []string) (message string, stream *chan string)
func PerformKeywordExtractionRequest(input string, maxKeywordsSearch uint32) (keywords []string)
func PerformSummaryRequest(input string) (summary string)
func PerformVectorEmbeddingRequest(input string) (embeddedVector []float32)
func PerformVectorEmbeddingRequestWithTokenLimitCatch(input string, tokenLimitMessage string) (embeddedVector []float32, tokenLimitReached bool, responseMessage string)
func RetrieveDependencies(collectionName string, relationshipName string, relationshipDirection string, sourceDocumentId string, nodeTypesFilter sharedtypes.DbArrayFilter, maxHopsNumber int) (dependenciesIds []string)
func SendLogicAppNotificationEmail(logicAppEndpoint string, email string, subject string, content string)
func SendRestAPICall(requestType string, endpoint string, header map[string]string, query map[string]string, jsonBody string) (success bool, returnJsonBody string)
func SendVectorsToKnowledgeDB(vector []float32, keywords []string, keywordsSearch bool, collection string, similaritySearchResults int, similaritySearchMinScore float64) (databaseResponse []sharedtypes.DbResponse)
func ShortenMessageHistory(history []sharedtypes.HistoricMessage, maxLength int) (updatedHistory []sharedtypes.HistoricMessage)
func SimilaritySearch(collectionName string, embeddedVector []float32, maxRetrievalCount int, outputFields []string, filters sharedtypes.DbFilters, minScore float64, getLeafNodes bool, getSiblings bool, getParent bool, getChildren bool) (databaseResponse []sharedtypes.DbResponse)
func SimilartitySearchOnPathDescriptions(instruction string, toolName string) (descriptions []string)
func StoreElementsInGraphDatabase(elements []sharedtypes.CodeGenerationElement)
func StoreElementsInVectorDatabase(elements []sharedtypes.CodeGenerationElement, elementsCollectionName string, batchSize int)
func StoreExamplesInGraphDatabase(examples []sharedtypes.CodeGenerationExample)
func StoreExamplesInVectorDatabase(examples []sharedtypes.CodeGenerationExample, examplesCollectionName string, batchSize int)
func StoreUserGuideSectionsInGraphDatabase(sections []sharedtypes.CodeGenerationUserGuideSection, label string)
func StoreUserGuideSectionsInVectorDatabase(sections []sharedtypes.CodeGenerationUserGuideSection, userGuideCollectionName string, batchSize int, chunkSize int, chunkOverlap int)
func SynthesizeActions(instruction string, properties []string, actions []map[string]string) (updatedActions []map[string]string)
func UpdateTotalTokenCountForCustomerMongoDb(apiKey string, mongoDbUrl string, mongoDatabaseName string, mongoDbCollectionName string, additionalTokenCount int) (tokenLimitReached bool)
func ansysGPTACSSemanticHybridSearch(acsEndpoint string, acsApiKey string, acsApiVersion string, query string, embeddedQuery []float32, indexName string, filter map[string]string, topK int, isAis bool, physics []string) (output []sharedtypes.ACSSearchResponse, err error)
func codeGenerationProcessBatchEmbeddings(elements []sharedtypes.CodeGenerationElement, maxBatchSize int) (elementEmbeddings [][]float32, err error)
func codeGenerationProcessHybridSearchEmbeddings(elements []sharedtypes.CodeGenerationElement, maxBatchSize int) (denseEmbeddings [][]float32, lexicalWeights []map[uint]float32, err error)
func codeGenerationProcessHybridSearchEmbeddingsForExamples(elements []codegeneration.VectorDatabaseExample, maxBatchSize int) (denseEmbeddings [][]float32, lexicalWeights []map[uint]float32, err error)
func codeGenerationProcessHybridSearchEmbeddingsForUserGuideSections(sections []codegeneration.VectorDatabaseUserGuideSection, maxBatchSize int) (denseEmbeddings [][]float32, lexicalWeights []map[uint]float32, err error)
func convertToFloat32Slice(interfaceSlice []interface{}) ([]float32, error)
func createDbArrayFilter(filterData []string, needAll bool) (databaseFilter sharedtypes.DbArrayFilter)
func createDbJsonFilter(fieldName string, fieldType string, filterData []string, needAll bool) (databaseFilter sharedtypes.DbJsonFilter)
func createPayloadAndSendHttpRequest(url string, requestObject interface{}, responsePtr interface{}) (funcError error, statusCode int)
func dataExtractNewGithubClient(githubAccessToken string) (client *github.Client, ctx context.Context)
func dataExtractionDocumentLevelHandler(inputChannel chan *DataExtractionLLMInputChannelItem, errorChannel chan error, chunks []string, documentId string, documentPath string, getSummary bool, getKeywords bool, numKeywords uint32) (orderedChildDataObjects []*sharedtypes.DbData, err error)
func dataExtractionFilterGithubTreeEntries(tree *github.Tree, githubFilteredDirectories, githubExcludedDirectories, githubFileExtensions []string) (githubFilesToExtract []string)
func dataExtractionLLMHandlerWorker(waitgroup *sync.WaitGroup, inputChannel chan *DataExtractionLLMInputChannelItem, errorChannel chan error, embeddingsDimensions int)
func dataExtractionLocalFilepathExtractWalker(localPath string, localFileExtensions []string, localFilteredDirectories []string, localExcludedDirectories []string, filesToExtract *[]string, f os.FileInfo, err error) error
func dataExtractionPerformSplitterRequest(content []byte, documentType string, chunkSize int, chunkOverlap int) (output []string, err error)
func dataExtractionProcessBatchEmbeddings(documentData []*sharedtypes.DbData, maxBatchSize int) error
func dataExtractionTextSplitter(input string, chunkSize int, chunkOverlap int) (chunks []string, err error)
func downloadGithubFileContent(githubRepoName string, githubRepoOwner string, githubRepoBranch string, gihubFilePath string, githubAccessToken string) (checksum string, content []byte, err error)
func extractAndConvertACSResponse(body []byte, indexName string) (output []sharedtypes.ACSSearchResponse)
func extractPythonCode(markdown string) (pythonCode string, error error)
func formatTemplate(template string, data map[string]string) string
func getFieldsAndReturnProperties(indexName string) (searchedEmbeddedFields string, returnedProperties string)
func getIndexNameFromToolName(toolName string) (indexName string, err error)
func getLocalFileContent(localFilePath string) (checksum string, content []byte, err error)
func httpRequest(method string, url string, headers map[string]string, body []byte) ([]byte, error)
func initializeClient(llmHandlerEndpoint string) *websocket.Conn
func listener(c *websocket.Conn, responseChannel chan sharedtypes.HandlerResponse, singleRequest bool)
func llmHandlerPerformKeywordExtractionRequest(input string, numKeywords uint32) (keywords []string, err error)
func llmHandlerPerformSummaryRequest(input string) (summary string, err error)
func llmHandlerPerformVectorEmbeddingRequest(input []string, sparse bool) (embeddedVectors [][]float32, sparseEmbeddings []map[uint]float32, err error)
func mongoDbAddToTotalTokenCount(mongoDbContext *MongoDbContext, apiKey string, additionalTokenCount int) (err error)
func mongoDbCollectionExists(database *mongo.Database, collectionName string) (exists bool, err error)
func mongoDbUpdateAccessAndWarning(mongoDbContext *MongoDbContext, apiKey string) (err error)
func openAiTokenCount(modelName string, message string) (int, error)
func performGeneralRequest(input string, history []sharedtypes.HistoricMessage, isStream bool, systemPrompt string, options *sharedtypes.ModelOptions) (message string, stream *chan string, err error)
func randomNameGenerator() string
func sendChatRequest(data string, chatRequestType string, history []sharedtypes.HistoricMessage, maxKeywordsSearch uint32, systemPrompt interface{}, llmHandlerEndpoint string, modelIds []string, options *sharedtypes.ModelOptions, images []string) chan sharedtypes.HandlerResponse
func sendChatRequestNoHistory(data string, chatRequestType string, maxKeywordsSearch uint32, llmHandlerEndpoint string, modelIds []string, options *sharedtypes.ModelOptions) chan sharedtypes.HandlerResponse
func sendChatRequestNoStreaming(data string, chatRequestType string, history []sharedtypes.HistoricMessage, maxKeywordsSearch uint32, systemPrompt string, llmHandlerEndpoint string, modelIds []string, options *sharedtypes.ModelOptions, images []string) string
func sendEmbeddingsRequest(data interface{}, llmHandlerEndpoint string, getSparseEmbeddings bool, modelIds []string) chan sharedtypes.HandlerResponse
func sendRequest(adapter string, data interface{}, RequestChannel chan []byte, chatRequestType string, dataStream string, getSparseEmbeddings bool, history []sharedtypes.HistoricMessage, maxKeywordsSearch uint32, systemPrompt interface{}, responseChannel chan sharedtypes.HandlerResponse, modelIds []string, options *sharedtypes.ModelOptions, images []string)
func sendTokenCountToEndpoint(jwtToken string, tokenCountEndpoint string, inputTokenCount int, ouputTokenCount int) (err error)
func shutdownHandler(c *websocket.Conn)
func transferDatafromResponseToStreamChannel(responseChannel *chan sharedtypes.HandlerResponse, streamChannel *chan string, validateCode bool, sendTokenCount bool, tokenCountEndpoint string, previousInputTokenCount int, previousOutputTokenCount int, tokenCountModelName string, jwtToken string, userEmail string, sendContex bool, contex string)
func updateMeshPilotActionProperty(list []map[string]string, findKey, findValue, assignKey, assignValue string) (updated bool)
func validatePythonCode(pythonCode string) (bool, bool, error)
func writer(c *websocket.Conn, RequestChannel chan []byte, responseChannel chan sharedtypes.HandlerResponse)
type ACSSearchRequest
type ACSSearchResponseALH
type ACSSearchResponseCrtech
type ACSSearchResponseLSdyna
type ACSSearchResponseStruct
type ACSSearchResponseStructALH
type ACSSearchResponseStructCrtech
type ACSSearchResponseStructLSdyna
type ACSVectorQuery
type AppendMessageHistoryRole
type DataExtractionBranch
type DataExtractionLLMInputChannelItem
    func dataExtractionNewLlmInputChannelItem(data *sharedtypes.DbData, instructionSequenceWaitGroup *sync.WaitGroup, adapter string, chatRequestType string, maxNumberOfKeywords uint32, lock *sync.Mutex) *DataExtractionLLMInputChannelItem
type DataExtractionSplitterServiceRequest
type DataExtractionSplitterServiceResponse
type EmailRequest
type GeneralDataExtractionDocument
type MongoDbContext
    func mongoDbInitializeClient(mongoDbEndpoint string, databaseName string, collectionName string) (mongoDbContext *MongoDbContext, err error)
type MongoDbCustomerObject
    func mongoDbGetCustomerByApiKey(mongoDbContext *MongoDbContext, apiKey string) (exists bool, customer *MongoDbCustomerObject, err error)
type TokenCountUpdateRequest
type pythonEmbeddingRequest
type pythonEmbeddingResponse
type queryInput
type queryOutput
type retrieveDependenciesInput
type retrieveDependenciesOutput
type similarityElement
type similaritySearchInput
type similaritySearchOutput
type summaryCounters

Package files

ansysgpt.go ansysmeshpilot.go auth.go dataextraction.go externalfunctions.go generic.go knowledgedb.go llmhandler.go milvus.go privatefunctions.go types.go

Variables

var ExternalFunctionsMap = map[string]interface{}{

    "PerformVectorEmbeddingRequest":                                   PerformVectorEmbeddingRequest,
    "PerformVectorEmbeddingRequestWithTokenLimitCatch":                PerformVectorEmbeddingRequestWithTokenLimitCatch,
    "PerformBatchEmbeddingRequest":                                    PerformBatchEmbeddingRequest,
    "PerformBatchHybridEmbeddingRequest":                              PerformBatchHybridEmbeddingRequest,
    "PerformKeywordExtractionRequest":                                 PerformKeywordExtractionRequest,
    "PerformGeneralRequest":                                           PerformGeneralRequest,
    "PerformGeneralRequestWithImages":                                 PerformGeneralRequestWithImages,
    "PerformGeneralModelSpecificationRequest":                         PerformGeneralModelSpecificationRequest,
    "PerformGeneralRequestSpecificModel":                              PerformGeneralRequestSpecificModel,
    "PerformGeneralRequestSpecificModelAndModelOptions":               PerformGeneralRequestSpecificModelAndModelOptions,
    "PerformGeneralRequestSpecificModelNoStreamWithOpenAiTokenOutput": PerformGeneralRequestSpecificModelNoStreamWithOpenAiTokenOutput,
    "PerformCodeLLMRequest":                                           PerformCodeLLMRequest,
    "PerformGeneralRequestNoStreaming":                                PerformGeneralRequestNoStreaming,
    "BuildLibraryContext":                                             BuildLibraryContext,
    "BuildFinalQueryForGeneralLLMRequest":                             BuildFinalQueryForGeneralLLMRequest,
    "BuildFinalQueryForCodeLLMRequest":                                BuildFinalQueryForCodeLLMRequest,
    "AppendMessageHistory":                                            AppendMessageHistory,
    "ShortenMessageHistory":                                           ShortenMessageHistory,

    "SendVectorsToKnowledgeDB": SendVectorsToKnowledgeDB,
    "GetListCollections":       GetListCollections,
    "RetrieveDependencies":     RetrieveDependencies,
    "GeneralNeo4jQuery":        GeneralNeo4jQuery,
    "GeneralQuery":             GeneralQuery,
    "SimilaritySearch":         SimilaritySearch,
    "CreateKeywordsDbFilter":   CreateKeywordsDbFilter,
    "CreateTagsDbFilter":       CreateTagsDbFilter,
    "CreateMetadataDbFilter":   CreateMetadataDbFilter,
    "CreateDbFilter":           CreateDbFilter,

    "AnsysGPTCheckProhibitedWords":                   AnsysGPTCheckProhibitedWords,
    "AnsysGPTExtractFieldsFromQuery":                 AnsysGPTExtractFieldsFromQuery,
    "AnsysGPTPerformLLMRephraseRequest":              AnsysGPTPerformLLMRephraseRequest,
    "AnsysGPTPerformLLMRephraseRequestNew":           AnsysGPTPerformLLMRephraseRequestNew,
    "AnsysGPTBuildFinalQuery":                        AnsysGPTBuildFinalQuery,
    "AnsysGPTPerformLLMRequest":                      AnsysGPTPerformLLMRequest,
    "AnsysGPTReturnIndexList":                        AnsysGPTReturnIndexList,
    "AnsysGPTACSSemanticHybridSearchs":               AnsysGPTACSSemanticHybridSearchs,
    "AnsysGPTRemoveNoneCitationsFromSearchResponse":  AnsysGPTRemoveNoneCitationsFromSearchResponse,
    "AnsysGPTReorderSearchResponseAndReturnOnlyTopK": AnsysGPTReorderSearchResponseAndReturnOnlyTopK,
    "AnsysGPTGetSystemPrompt":                        AnsysGPTGetSystemPrompt,
    "AisPerformLLMRephraseRequest":                   AisPerformLLMRephraseRequest,
    "AisReturnIndexList":                             AisReturnIndexList,
    "AisAcsSemanticHybridSearchs":                    AisAcsSemanticHybridSearchs,
    "AisChangeAcsResponsesByFactor":                  AisChangeAcsResponsesByFactor,
    "AisPerformLLMFinalRequest":                      AisPerformLLMFinalRequest,

    "GetGithubFilesToExtract":                    GetGithubFilesToExtract,
    "GetLocalFilesToExtract":                     GetLocalFilesToExtract,
    "AppendStringSlices":                         AppendStringSlices,
    "DownloadGithubFileContent":                  DownloadGithubFileContent,
    "GetLocalFileContent":                        GetLocalFileContent,
    "GetDocumentType":                            GetDocumentType,
    "LangchainSplitter":                          LangchainSplitter,
    "GenerateDocumentTree":                       GenerateDocumentTree,
    "AddDataRequest":                             AddDataRequest,
    "CreateCollectionRequest":                    CreateCollectionRequest,
    "CreateGeneralDataExtractionDocumentObjects": CreateGeneralDataExtractionDocumentObjects,

    "AssignStringToString": AssignStringToString,
    "SendRestAPICall":      SendRestAPICall,

    "LoadCodeGenerationElements":      LoadCodeGenerationElements,
    "LoadCodeGenerationExamples":      LoadCodeGenerationExamples,
    "LoadAndCheckExampleDependencies": LoadAndCheckExampleDependencies,
    "LoadUserGuideSections":           LoadUserGuideSections,

    "StoreElementsInVectorDatabase":          StoreElementsInVectorDatabase,
    "StoreElementsInGraphDatabase":           StoreElementsInGraphDatabase,
    "StoreExamplesInVectorDatabase":          StoreExamplesInVectorDatabase,
    "StoreExamplesInGraphDatabase":           StoreExamplesInGraphDatabase,
    "StoreUserGuideSectionsInVectorDatabase": StoreUserGuideSectionsInVectorDatabase,
    "StoreUserGuideSectionsInGraphDatabase":  StoreUserGuideSectionsInGraphDatabase,

    "MeshPilotReAct":                           MeshPilotReAct,
    "SimilartitySearchOnPathDescriptions":      SimilartitySearchOnPathDescriptions,
    "FindRelevantPathDescriptionByPrompt":      FindRelevantPathDescriptionByPrompt,
    "FetchPropertiesFromPathDescription":       FetchPropertiesFromPathDescription,
    "FetchNodeDescriptionsFromPathDescription": FetchNodeDescriptionsFromPathDescription,
    "FetchActionsPathFromPathDescription":      FetchActionsPathFromPathDescription,
    "SynthesizeActions":                        SynthesizeActions,
    "FinalizeResult":                           FinalizeResult,
    "GetSolutionsToFixProblem":                 GetSolutionsToFixProblem,
    "GetSelectedSolution":                      GetSelectedSolution,
    "AppendToolHistory":                        AppendToolHistory,
    "AppendMeshPilotHistory":                   AppendMeshPilotHistory,
    "GetActionsFromConfig":                     GetActionsFromConfig,

    "MilvusCreateCollection": MilvusCreateCollection,
    "MilvusInsertData":       MilvusInsertData,

    "CheckApiKeyAuthMongoDb":                  CheckApiKeyAuthMongoDb,
    "UpdateTotalTokenCountForCustomerMongoDb": UpdateTotalTokenCountForCustomerMongoDb,
    "DenyCustomerAccessAndSendWarningMongoDb": DenyCustomerAccessAndSendWarningMongoDb,
    "SendLogicAppNotificationEmail":           SendLogicAppNotificationEmail,
    "CreateMessageWithVariable":               CreateMessageWithVariable,
}

func AddDataRequest

func AddDataRequest(collectionName string, documentData []sharedtypes.DbData)

AddDataRequest sends a request to the add_data endpoint.

Tags:

  • @displayName: Add Data

Parameters:

  • collectionName: name of the collection the request is sent to.
  • data: the data to add.

func AisAcsSemanticHybridSearchs

func AisAcsSemanticHybridSearchs(
    acsEndpoint string,
    acsApiKey string,
    acsApiVersion string,
    query string,
    embeddedQuery []float32,
    indexList []string,
    physics []string,
    topK int) []sharedtypes.ACSSearchResponse

AisAcsSemanticHybridSearchs performs a semantic hybrid search in ACS

Tags:

  • @displayName: AIS ACS Semantic Hybrid Search

Parameters:

  • query: the query string
  • embeddedQuery: the embedded query
  • indexList: the index list
  • physics: the physics
  • topK: the number of results to be returned

Returns:

  • output: the search results

func AisChangeAcsResponsesByFactor

func AisChangeAcsResponsesByFactor(factors map[string]float64, semanticSearchOutput []sharedtypes.ACSSearchResponse) (changedSemanticSearchOutput []sharedtypes.ACSSearchResponse)

AisChangeAcsResponsesByFactor changes the ACS responses by a factor

Tags:

  • @displayName: Change ACS Responses By Factor

Parameters:

  • factors: the factors
  • semanticSearchOutput: the search response

Returns:

  • changedSemanticSearchOutput: the changed search response

func AisPerformLLMFinalRequest

func AisPerformLLMFinalRequest(systemTemplate string,
    userTemplate string,
    query string,
    history []sharedtypes.HistoricMessage,
    context []sharedtypes.ACSSearchResponse,
    prohibitedWords []string,
    errorList1 []string,
    errorList2 []string,
    tokenCountEndpoint string,
    previousInputTokenCount int,
    previousOutputTokenCount int,
    tokenCountModelName string,
    isStream bool,
    userEmail string,
    jwtToken string) (message string, stream *chan string)

AisPerformLLMFinalRequest performs a final request to LLM

Tags:

  • @displayName: AIS Final Request

Parameters:

  • systemTemplate: the system template for the final request
  • userTemplate: the user template for the final request
  • query: the user query
  • history: the conversation history
  • prohibitedWords: the list of prohibited words
  • errorList1: the list of error words
  • errorList2: the list of error words

Returns:

  • stream: the stream channel

func AisPerformLLMRephraseRequest

func AisPerformLLMRephraseRequest(systemTemplate string, userTemplate string, query string, history []sharedtypes.HistoricMessage, tokenCountModelName string) (rephrasedQuery string, inputTokenCount int, outputTokenCount int)

AisPerformLLMRephraseRequest performs a rephrase request to LLM

Tags:

  • @displayName: AIS Rephrase Request

Parameters:

  • systemTemplate: the system template for the rephrase request
  • userTemplate: the user template for the rephrase request
  • query: the user query
  • history: the conversation history

Returns:

  • rephrasedQuery: the rephrased query

func AisReturnIndexList

func AisReturnIndexList(accessPoint string, physics []string, version []string) (indexList []string)

AisReturnIndexList returns the index list for AIS

Tags:

  • @displayName: Get AIS Index List

Parameters:

  • accessPoint: the access point

Returns:

  • indexList: the index list

func AnsysGPTACSSemanticHybridSearchs

func AnsysGPTACSSemanticHybridSearchs(
    acsEndpoint string,
    acsApiKey string,
    acsApiVersion string,
    query string,
    embeddedQuery []float32,
    indexList []string,
    filter map[string]string,
    topK int) (output []sharedtypes.ACSSearchResponse)

AnsysGPTACSSemanticHybridSearchs performs a semantic hybrid search in ACS

Tags:

  • @displayName: ACS Semantic Hybrid Search

Parameters:

  • query: the query string
  • embeddedQuery: the embedded query
  • indexList: the index list
  • typeOfAsset: the type of asset
  • physics: the physics
  • product: the product
  • productMain: the main product
  • filter: the filter
  • filterAfterVectorSearch: the flag to define the filter order
  • returnedProperties: the properties to be returned
  • topK: the number of results to be returned from vector search
  • searchedEmbeddedFields: the ACS fields to be searched

Returns:

  • output: the search results

func AnsysGPTBuildFinalQuery

func AnsysGPTBuildFinalQuery(refrasedQuery string, context []sharedtypes.ACSSearchResponse) (finalQuery string, errorResponse string, displayFixedMessageToUser bool)

AnsysGPTBuildFinalQuery builds the final query for Ansys GPT

Tags:

  • @displayName: Build Final Query

Parameters:

  • refrasedQuery: the refrased query
  • context: the context

Returns:

  • finalQuery: the final query

func AnsysGPTCheckProhibitedWords

func AnsysGPTCheckProhibitedWords(query string, prohibitedWords []string, errorResponseMessage string) (foundProhibited bool, responseMessage string)

AnsysGPTCheckProhibitedWords checks the user query for prohibited words

Tags:

  • @displayName: Check Prohibited Words

Parameters:

  • query: the user query
  • prohibitedWords: the list of prohibited words
  • errorResponseMessage: the error response message

Returns:

  • foundProhibited: the flag indicating whether prohibited words were found
  • responseMessage: the response message

func AnsysGPTExtractFieldsFromQuery

func AnsysGPTExtractFieldsFromQuery(query string, fieldValues map[string][]string, defaultFields []sharedtypes.AnsysGPTDefaultFields) (fields map[string]string)

AnsysGPTExtractFieldsFromQuery extracts the fields from the user query

Tags:

  • @displayName: Extract Fields

Parameters:

  • query: the user query
  • fieldValues: the field values that the user query can contain
  • defaultFields: the default fields that the user query can contain

Returns:

  • fields: the extracted fields

func AnsysGPTGetSystemPrompt

func AnsysGPTGetSystemPrompt(query string, prohibitedWords []string, template string) (systemPrompt string)

AnsysGPTGetSystemPrompt returns the system prompt for Ansys GPT

Tags:

  • @displayName: Get System Prompt

Parameters:

  • rephrasedQuery: the rephrased query

Returns:

  • systemPrompt: the system prompt

func AnsysGPTPerformLLMRephraseRequest

func AnsysGPTPerformLLMRephraseRequest(userTemplate string, query string, history []sharedtypes.HistoricMessage, systemPrompt string) (rephrasedQuery string)

AnsysGPTPerformLLMRephraseRequest performs a rephrase request to LLM

Tags:

  • @displayName: Rephrase Request

Parameters:

  • template: the template for the rephrase request
  • query: the user query
  • history: the conversation history

Returns:

  • rephrasedQuery: the rephrased query

func AnsysGPTPerformLLMRephraseRequestNew

func AnsysGPTPerformLLMRephraseRequestNew(template string, query string, history []sharedtypes.HistoricMessage) (rephrasedQuery string)

AnsysGPTPerformLLMRephraseRequestNew performs a rephrase request to LLM

Tags:

  • @displayName: Rephrase Request New

Parameters:

  • template: the template for the rephrase request
  • query: the user query
  • history: the conversation history

Returns:

  • rephrasedQuery: the rephrased query

func AnsysGPTPerformLLMRequest

func AnsysGPTPerformLLMRequest(finalQuery string, history []sharedtypes.HistoricMessage, systemPrompt string, isStream bool) (message string, stream *chan string)

AnsysGPTPerformLLMRequest performs a request to Ansys GPT

Tags:

  • @displayName: LLM Request

Parameters:

  • finalQuery: the final query
  • history: the conversation history
  • systemPrompt: the system prompt

Returns:

  • stream: the stream channel

func AnsysGPTRemoveNoneCitationsFromSearchResponse

func AnsysGPTRemoveNoneCitationsFromSearchResponse(semanticSearchOutput []sharedtypes.ACSSearchResponse, citations []sharedtypes.AnsysGPTCitation) (reducedSemanticSearchOutput []sharedtypes.ACSSearchResponse)

AnsysGPTRemoveNoneCitationsFromSearchResponse removes none citations from search response

Tags:

  • @displayName: Remove None Citations

Parameters:

  • semanticSearchOutput: the search response
  • citations: the citations

Returns:

  • reducedSemanticSearchOutput: the reduced search response

func AnsysGPTReorderSearchResponseAndReturnOnlyTopK

func AnsysGPTReorderSearchResponseAndReturnOnlyTopK(semanticSearchOutput []sharedtypes.ACSSearchResponse, topK int) (reorderedSemanticSearchOutput []sharedtypes.ACSSearchResponse)

AnsysGPTReorderSearchResponseAndReturnOnlyTopK reorders the search response

Tags:

  • @displayName: Reorder Search Response

Parameters:

  • semanticSearchOutput: the search response
  • topK: the number of results to be returned

Returns:

  • reorderedSemanticSearchOutput: the reordered search response

func AnsysGPTReturnIndexList

func AnsysGPTReturnIndexList(indexGroups []string) (indexList []string)

AnsysGPTReturnIndexList returns the index list for Ansys GPT

Tags:

  • @displayName: List Indexes

Parameters:

  • indexGroups: the index groups

Returns:

  • indexList: the index list

func AppendMeshPilotHistory

func AppendMeshPilotHistory(history []map[string]string, role, content string) (updatedHistory []map[string]string)

AppendMeshPilotHistory this function append mesh pilot history

Tags:

  • @displayName: AppendMeshPilotHistory

Parameters:

  • history: the tool history
  • role: the tool id
  • content: the tool name

Returns:

  • updatedHistory: the updated mesh pilot history

func AppendMessageHistory

func AppendMessageHistory(newMessage string, role AppendMessageHistoryRole, history []sharedtypes.HistoricMessage) (updatedHistory []sharedtypes.HistoricMessage)

AppendMessageHistory appends a new message to the conversation history

Tags:

  • @displayName: Append Message History

Parameters:

  • newMessage: the new message
  • role: the role of the message
  • history: the conversation history

Returns:

  • updatedHistory: the updated conversation history

func AppendStringSlices

func AppendStringSlices(slice1, slice2, slice3, slice4, slice5 []string) []string

AppendStringSlices creates a new slice by appending all elements of the provided slices.

Tags:

  • @displayName: Append String Slices

Parameters:

  • slice1, slice2, slice3, slice4, slice5: slices to append.

Returns:

  • result: a new slice with all elements appended.

func AppendToolHistory

func AppendToolHistory(toolHistory []map[string]string, toolId, toolName, toolArguments, toolResponse string) (updatedToolHistory []map[string]string)

AppendToolHistory this function append tool history

Tags:

  • @displayName: AppendToolHistory

Parameters:

  • toolHistory: the tool history
  • toolId: the tool id
  • toolName: the tool name
  • toolArguments: the tool arguments
  • toolResponse: the tool response

Returns:

  • updatedToolHistory: the updated tool history

func AssignStringToString

func AssignStringToString(inputString string) (outputString string)

AssignStringToString assigns a string to another string

Tags:

  • @displayName: Assign String to String

Parameters:

  • inputString: the input string

Returns:

  • outputString: the output string

func BuildFinalQueryForCodeLLMRequest

func BuildFinalQueryForCodeLLMRequest(request string, knowledgedbResponse []sharedtypes.DbResponse) (finalQuery string)

BuildFinalQueryForCodeLLMRequest builds the final query for a code generation request to LLM. The final query is a markdown string that contains the original request and the code examples from the KnowledgeDB.

Tags:

  • @displayName: Final Query (Code LLM Request)

Parameters:

  • request: the original request
  • knowledgedbResponse: the KnowledgeDB response

Returns:

  • finalQuery: the final query

func BuildFinalQueryForGeneralLLMRequest

func BuildFinalQueryForGeneralLLMRequest(request string, knowledgedbResponse []sharedtypes.DbResponse) (finalQuery string)

BuildFinalQueryForGeneralLLMRequest builds the final query for a general request to LLM. The final query is a markdown string that contains the original request and the examples from the KnowledgeDB.

Tags:

  • @displayName: Final Query (General LLM Request)

Parameters:

  • request: the original request
  • knowledgedbResponse: the KnowledgeDB response

Returns:

  • finalQuery: the final query

func BuildLibraryContext

func BuildLibraryContext(message string, libraryContext string) (messageWithContext string)

BuildLibraryContext builds the context string for the query

Tags:

  • @displayName: Library Context

Parameters:

  • message: the message string
  • libraryContext: the library context string

Returns:

  • messageWithContext: the message with context

func CheckApiKeyAuthMongoDb

func CheckApiKeyAuthMongoDb(apiKey string, mongoDbUrl string, mongoDatabaseName string, mongoDbCollectionName string) (isAuthenticated bool)

CheckApiKeyAuthMongoDb checks if the given API key is valid and has access to the service.

Tags:

  • @displayName: Verify API Key

Parameters:

  • apiKey: The API key to check.
  • mongoDbUrl: The URL of the MongoDB database.
  • mongoDatabaseName: The name of the MongoDB database.
  • mongoDbCollectionName: The name of the MongoDB collection.

Returns:

  • isAuthenticated: A boolean indicating whether the API key is authenticated.

func CreateCollectionRequest

func CreateCollectionRequest(collectionName string)

CreateCollectionRequest sends a request to the collection endpoint.

Tags:

  • @displayName: Create Collection

Parameters:

  • collectionName: the name of the collection to create.

func CreateDbFilter

func CreateDbFilter(
    guid []string,
    documentId []string,
    documentName []string,
    level []string,
    tags sharedtypes.DbArrayFilter,
    keywords sharedtypes.DbArrayFilter,
    metadata []sharedtypes.DbJsonFilter) (databaseFilter sharedtypes.DbFilters)

CreateDbFilter creates a filter for the KnowledgeDB.

The function returns the filter.

Tags:

  • @displayName: Create Filter

Parameters:

  • guid: the guid filter
  • documentId: the document ID filter
  • documentName: the document name filter
  • level: the level filter
  • tags: the tags filter
  • keywords: the keywords filter
  • metadata: the metadata filter

Returns:

  • databaseFilter: the filter

func CreateEmbeddings

func CreateEmbeddings(dense bool, sparse bool, colbert bool, isDocument bool, passages []string) (dense_vector [][]float32, lexical_weights []map[uint]float32, colbert_vecs [][][]float32, func_error error)

func CreateGeneralDataExtractionDocumentObjects

func CreateGeneralDataExtractionDocumentObjects(documentName string,
    documentChunks []string,
    denseEmbeddings [][]float32,
    sparseEmbeddings []map[uint]float32,
) (extractionData []interface{})

CreateGeneralDataExtractionDocumentObjects creates general data extraction document objects from the provided document chunks, dense embeddings, and sparse embeddings.

Tags:

  • @displayName: Create General Data Extraction Document Objects

Parameters:

  • documentName: name of the document.
  • documentChunks: chunks of the document.
  • denseEmbeddings: dense embeddings of the document.
  • sparseEmbeddings: sparse embeddings of the document.

Returns:

  • extractionData: general data extraction document objects in interface format.

func CreateKeywordsDbFilter

func CreateKeywordsDbFilter(keywords []string, needAll bool) (databaseFilter sharedtypes.DbArrayFilter)

CreateKeywordsDbFilter creates a keywords filter for the KnowledgeDB.

The function returns the keywords filter.

Tags:

  • @displayName: Keywords Filter

Parameters:

  • keywords: the keywords to be used for the filter
  • needAll: flag to indicate whether all keywords are needed

Returns:

  • databaseFilter: the keywords filter

func CreateMessageWithVariable

func CreateMessageWithVariable(message string, variable string) (updatedMessage string)

CreateMessageWithVariable creates a message with a variable.

Tags:

  • @displayName: Create Message with Variable

Parameters:

  • message: The message to create.
  • variable: The variable to insert into the message.

Returns:

  • updatedMessage: The updated message with the variable inserted.

func CreateMetadataDbFilter

func CreateMetadataDbFilter(fieldName string, fieldType string, filterData []string, needAll bool) (databaseFilter sharedtypes.DbJsonFilter)

CreateMetadataDbFilter creates a metadata filter for the KnowledgeDB.

The function returns the metadata filter.

Tags:

  • @displayName: Metadata Filter

Parameters:

  • fieldName: the name of the field
  • fieldType: the type of the field
  • filterData: the filter data
  • needAll: flag to indicate whether all data is needed

Returns:

  • databaseFilter: the metadata filter

func CreateTagsDbFilter

func CreateTagsDbFilter(tags []string, needAll bool) (databaseFilter sharedtypes.DbArrayFilter)

CreateTagsDbFilter creates a tags filter for the KnowledgeDB.

The function returns the tags filter.

Tags:

  • @displayName: Tags Filter

Parameters:

  • tags: the tags to be used for the filter
  • needAll: flag to indicate whether all tags are needed

Returns:

  • databaseFilter: the tags filter

func DenyCustomerAccessAndSendWarningMongoDb

func DenyCustomerAccessAndSendWarningMongoDb(apiKey string, mongoDbUrl string, mongoDatabaseName string, mongoDbCollectionName string) (customerName string, sendWarning bool)

DenyCustomerAccessAndSendWarningMongoDb denies access to the customer and sends a warning if necessary.

Tags:

  • @displayName: Deny Customer Access

Parameters:

  • apiKey: The API key of the customer.
  • mongoDbUrl: The URL of the MongoDB database.
  • mongoDatabaseName: The name of the MongoDB database.
  • mongoDbCollectionName: The name of the MongoDB collection.

Returns:

  • customerName: The name of the customer.
  • sendWarning: A boolean indicating whether a warning should be sent to the customer.

func DownloadGithubFileContent

func DownloadGithubFileContent(githubRepoName string, githubRepoOwner string,
    githubRepoBranch string, gihubFilePath string, githubAccessToken string) (checksum string, content []byte)

DownloadGithubFileContent downloads file content from github and returns checksum and content.

Tags:

  • @displayName: Download Github File Content

Parameters:

  • githubRepoName: name of the github repository.
  • githubRepoOwner: owner of the github repository.
  • githubRepoBranch: branch of the github repository.
  • gihubFilePath: path to file in the github repository.
  • githubAccessToken: access token for github.

Returns:

  • checksum: checksum of file.
  • content: content of file.

func DownloadGithubFilesContent

func DownloadGithubFilesContent(githubRepoName string, githubRepoOwner string,
    githubRepoBranch string, gihubFilePaths []string, githubAccessToken string) (filesMap map[string][]byte)

DownloadGithubFilesContent downloads file content from github and returns checksum and content.

Tags:

  • @displayName: Download Github Files Content

Parameters:

  • githubRepoName: name of the github repository.
  • githubRepoOwner: owner of the github repository.
  • githubRepoBranch: branch of the github repository.
  • gihubFilePath: path to file in the github repository.
  • githubAccessToken: access token for github.

Returns:

  • filesMap: map of file paths to file content.

func FetchActionsPathFromPathDescription

func FetchActionsPathFromPathDescription(description, nodeLabel string) (actions []map[string]string)

FetchActionsPathFromPathDescription fetch actions from path description

Tags:

  • @displayName: FetchActionsPathFromPathDescription

Parameters:

  • description: the desctiption of path
  • nodeLabel: the label of the node

Returns:

  • actions: the list of actions to execute

func FetchNodeDescriptionsFromPathDescription

func FetchNodeDescriptionsFromPathDescription(description string) (actionDescriptions string)

FetchNodeDescriptionsFromPathDescription get node descriptions from path description

Tags:

  • @displayName: FetchNodeDescriptionsFromPathDescription

Parameters:

  • description: the desctiption of path

Returns:

  • actionDescriptions: action descriptions

func FetchPropertiesFromPathDescription

func FetchPropertiesFromPathDescription(description string) (properties []string)

FetchPropertiesFromPathDescription get properties from path description

Tags:

  • @displayName: FetchPropertiesFromPathDescription

Parameters:

  • description: the desctiption of path

Returns:

  • properties: the list of descriptions

func FinalizeResult

func FinalizeResult(actions []map[string]string, toolName string) (result string)

FinalizeResult converts actions to json string to send back data

Tags:

  • @displayName: FinalizeResult

Parameters:

  • actions: the executable actions
  • toolName: tool name to create customize messages

Returns:

  • result: the actions in json format

func FindRelevantPathDescriptionByPrompt

func FindRelevantPathDescriptionByPrompt(descriptions []string, instruction string) (relevantDescription string)

FindRelevantPathDescriptionByPrompt finds the relevant description by prompting

Tags:

  • @displayName: FindRelevantPathDescriptionByPrompt

Parameters:

  • descriptions: the list of descriptions
  • instruction: the user instruction

Returns:

  • relevantDescription: the relevant desctiption

func GeneralNeo4jQuery

func GeneralNeo4jQuery(query string) (databaseResponse sharedtypes.Neo4jResponse)

GeneralNeo4jQuery executes the given Neo4j query and returns the response.

The function returns the neo4j response.

Tags:

  • @displayName: General Neo4J Query

Parameters:

  • query: the Neo4j query to be executed.

Returns:

  • databaseResponse: the Neo4j response

func GeneralQuery

func GeneralQuery(collectionName string, maxRetrievalCount int, outputFields []string, filters sharedtypes.DbFilters) (databaseResponse []sharedtypes.DbResponse)

GeneralQuery performs a general query in the KnowledgeDB.

The function returns the query results.

Tags:

  • @displayName: Query

Parameters:

  • collectionName: the name of the collection to which the data objects will be added.
  • maxRetrievalCount: the maximum number of results to be retrieved.
  • outputFields: the fields to be included in the output.
  • filters: the filter for the query.

Returns:

  • databaseResponse: the query results

func GenerateDocumentTree

func GenerateDocumentTree(documentName string, documentId string, documentChunks []string,
    embeddingsDimensions int, getSummary bool, getKeywords bool, numKeywords int, chunkSize int, numLlmWorkers int) (returnedDocumentData []sharedtypes.DbData)

GenerateDocumentTree generates a tree structure from the document chunks.

Tags:

  • @displayName: Document Tree

Parameters:

  • documentName: name of the document.
  • documentId: id of the document.
  • documentChunks: chunks of the document.
  • embeddingsDimensions: dimensions of the embeddings.
  • getSummary: whether to get summary.
  • getKeywords: whether to get keywords.
  • numKeywords: number of keywords.
  • chunkSize: size of the chunks.
  • numLlmWorkers: number of llm workers.

Returns:

  • documentData: tree structure of the document.

func GetActionsFromConfig

func GetActionsFromConfig(toolName string) (result string)

FinalizeResult converts actions to json string to send back data

Tags:

  • @displayName: GetActionsFromConfig

Parameters:

  • toolName: tool name to create customize messages

Returns:

  • result: the actions in json format

func GetDocumentType

func GetDocumentType(filePath string) (documentType string)

GetDocumentType returns the document type of a file.

Tags:

  • @displayName: Get Document Type

Parameters:

  • filePath: path to file.

Returns:

  • documentType: file extension.

func GetGithubFilesToExtract

func GetGithubFilesToExtract(githubRepoName string, githubRepoOwner string,
    githubRepoBranch string, githubAccessToken string, githubFileExtensions []string,
    githubFilteredDirectories []string, githubExcludedDirectories []string) (githubFilesToExtract []string)

GetGithubFilesToExtract gets all files from github that need to be extracted.

Tags:

  • @displayName: List Github Files

Parameters:

  • githubRepoName: name of the github repository.
  • githubRepoOwner: owner of the github repository.
  • githubRepoBranch: branch of the github repository.
  • githubAccessToken: access token for github.
  • githubFileExtensions: github file extensions.
  • githubFilteredDirectories: github filtered directories.
  • githubExcludedDirectories: github excluded directories.

Returns:

  • githubFilesToExtract: github files to extract.

func GetListCollections

func GetListCollections() (collectionsList []string)

GetListCollections retrieves the list of collections from the KnowledgeDB.

Tags:

  • @displayName: List Collections

The function returns the list of collections.

Parameters:

  • knowledgeDbEndpoint: the KnowledgeDB endpoint

Returns:

  • collectionsList: the list of collections

func GetLocalFileContent

func GetLocalFileContent(localFilePath string) (checksum string, content []byte)

GetLocalFileContent reads local file and returns checksum and content.

Tags:

  • @displayName: Get Local File Content

Parameters:

  • localFilePath: path to file.

Returns:

  • checksum: checksum of file.
  • content: content of file.

func GetLocalFilesContent

func GetLocalFilesContent(localFilePaths []string) (filesMap map[string][]byte)

GetLocalFilesContent reads local files and returns content.

Tags:

  • @displayName: Get Local Files Content

Parameters:

  • localFilePaths: paths to files.

Returns:

  • filesMap: map of file paths to file content.

func GetLocalFilesToExtract

func GetLocalFilesToExtract(localPath string, localFileExtensions []string,
    localFilteredDirectories []string, localExcludedDirectories []string) (localFilesToExtract []string)

GetLocalFilesToExtract gets all files from local that need to be extracted.

Tags:

  • @displayName: List Local Files

Parameters:

  • localPath: path to the local directory.
  • localFileExtensions: local file extensions.
  • localFilteredDirectories: local filtered directories.
  • localExcludedDirectories: local excluded directories.

Returns:

  • localFilesToExtract: local files to extract.

func GetSelectedSolution

func GetSelectedSolution(arguments string) (solution string)

GetSelectedSolution get user selected solutions from the options provided

Tags:

  • @displayName: GetSelectedSolution

Parameters:

  • arguments: these are the arguments ReAct found based on user choice

Returns:

  • solution: the selected solution

func GetSolutionsToFixProblem

func GetSolutionsToFixProblem(fmFailureCode, primeMeshFailureCode string) (solutions string)

GetSolutionsToFixProblem do similarity search on path description

Tags:

  • @displayName: GetSolutionsToFixProblem

Parameters:

  • fmFailureCode: FM failure Code
  • primeMeshFailureCode: Prime Mesh Failure Code

Returns:

  • solutions: the list of solutions in json

func LangchainSplitter

func LangchainSplitter(bytesContent []byte, documentType string, chunkSize int, chunkOverlap int) (output []string)

LangchainSplitter splits content into chunks using langchain.

Tags:

  • @displayName: Split Content

Parameters:

  • content: content to split.
  • documentType: type of document.
  • chunkSize: size of the chunks.
  • chunkOverlap: overlap of the chunks.

Returns:

  • output: chunks as an slice of strings.

func LoadAndCheckExampleDependencies

func LoadAndCheckExampleDependencies(
    dependenciesContent []byte,
    elements []sharedtypes.CodeGenerationElement,
    instancesReplacementDict map[string]string,
    InstancesReplacementPriorityList []string,
) (checkedDependenciesMap map[string][]string, equivalencesMap map[string]map[string]string)

LoadAndCheckExampleDependencies loads and checks the dependencies of the examples.

Tags:

  • @displayName: Load and Check Example Dependencies

Parameters:

  • dependenciesContent: content of the dependencies file in []byte format.
  • elements: code generation elements.
  • instancesReplacementDict: dictionary of instances replacements.
  • InstancesReplacementPriorityList: list of instances replacement priority.

Returns:

  • checkedDependenciesMap: checked dependencies.
  • equivalencesMap: equivalences.

func LoadCodeGenerationElements

func LoadCodeGenerationElements(content []byte, elementsFilePath string) (elements []sharedtypes.CodeGenerationElement)

LoadCodeGenerationElements loads code generation elements from an xml or json file.

Tags:

  • @displayName: Load Code Generation Elements

Parameters:

  • content: content of the file in []byte format.
  • elementsFilePath: path to the file.

Returns:

  • elements: code generation elements.

func LoadCodeGenerationExamples

func LoadCodeGenerationExamples(
    source string,
    examplesToExtract []string,
    githubRepoName string,
    githubRepoOwner string,
    githubRepoBranch string,
    githubAccessToken string,
    dependencies map[string][]string,
    equivalencesMap map[string]map[string]string,
    chunkSize int,
    chunkOverlap int) (examples []sharedtypes.CodeGenerationExample)

LoadCodeGenerationExamples loads code generation examples from the provided paths.

Tags:

  • @displayName: Load Code Generation Examples

Parameters:

  • source: source of the examples (local or github).
  • examplesToExtract: paths to the examples.
  • githubRepoName: name of the github repository.
  • githubRepoOwner: owner of the github repository.
  • githubRepoBranch: branch of the github repository.
  • githubAccessToken: access token for the github repository.
  • dependencies: dependencies of the examples.
  • equivalencesMap: equivalences of the examples.
  • chunkSize: size of the chunks.
  • chunkOverlap: overlap of the chunks.

Returns:

  • examples: code generation examples.

func LoadUserGuideSections

func LoadUserGuideSections(source string, sectionFilePaths []string, githubRepoName string, githubRepoOwner string,
    githubRepoBranch string, githubAccessToken string) (sections []sharedtypes.CodeGenerationUserGuideSection)

LoadUserGuideSections loads user guide sections from the provided paths.

Tags:

  • @displayName: Load User Guide Sections

Parameters:

  • source: source of the sections (local or github).
  • sectionFilePaths: paths to the sections.
  • githubRepoName: name of the github repository.
  • githubRepoOwner: owner of the github repository.
  • githubRepoBranch: branch of the github repository.
  • githubAccessToken: access token for the github repository.

Returns:

  • sections: user guide sections.

func MeshPilotReAct

func MeshPilotReAct(instruction string,
    history []map[string]string,
    toolsHistory []map[string]string,
    reActStage string) (stage, toolId, toolName, toolArgument, result string)

MeshPilotReAct decides which tool to use based on user input

Tags:

  • @displayName: MeshPilotReAct

Parameters:

  • instruction: the user query
  • history: the chat history
  • toolsHistory: the tool history
  • reActStage: the reason and action stage

Returns:

  • stage: the reason and action
  • toolId: the tool id
  • toolName: the tool name
  • toolArgument: the tool arguments
  • result: the result

func MilvusCreateCollection

func MilvusCreateCollection(collectionName string, schema []map[string]interface{})

MilvusCreateCollection creates a collection in Milvus

Tags:

  • @displayName: Create Milvus Collection

Params:

  • collectionName (string): The name of the collection
  • schema (map[string]interface{}): The schema of the collection

func MilvusInsertData

func MilvusInsertData(collectionName string, data []interface{}, idFieldName string)

MilvusInsertData inserts data into a collection in Milvus

Tags:

  • @displayName: Insert Data into Milvus

Params:

  • collectionName (string): The name of the collection
  • data ([]interface{}): The data to insert
  • idFieldName (string): The name of the field to use as the ID
  • idField (string): The ID field

func PerformBatchEmbeddingRequest

func PerformBatchEmbeddingRequest(input []string) (embeddedVectors [][]float32)

PerformBatchEmbeddingRequest performs a batch vector embedding request to LLM

Tags:

  • @displayName: Batch Embeddings

Parameters:

  • input: the input strings

Returns:

  • embeddedVectors: the embedded vectors in float32 format

func PerformBatchHybridEmbeddingRequest

func PerformBatchHybridEmbeddingRequest(input []string, maxBatchSize int) (denseEmbeddings [][]float32, sparseEmbeddings []map[uint]float32)

PerformBatchHybridEmbeddingRequest performs a batch hybrid embedding request to LLM returning the sparse and dense embeddings

Tags:

  • @displayName: Batch Hybrid Embeddings

Parameters:

  • input: the input strings

Returns:

  • denseEmbeddings: the dense embeddings in float32 format
  • sparseEmbeddings: the sparse embeddings in map format

func PerformCodeLLMRequest

func PerformCodeLLMRequest(input string, history []sharedtypes.HistoricMessage, isStream bool, validateCode bool) (message string, stream *chan string)

PerformCodeLLMRequest performs a code generation request to LLM

Tags:

  • @displayName: Code LLM Request

Parameters:

  • input: the input string
  • history: the conversation history
  • isStream: the stream flag

Returns:

  • message: the generated code
  • stream: the stream channel

func PerformGeneralModelSpecificationRequest

func PerformGeneralModelSpecificationRequest(input string, history []sharedtypes.HistoricMessage, isStream bool, systemPrompt map[string]string, modelIds []string) (message string, stream *chan string)

PerformGeneralModelSpecificationRequest performs a specified request to LLM with a configured model and Systemprompt.

Tags:

  • @displayName: General LLM Request (Specified System Prompt)

Parameters:

  • input: the user input
  • history: the conversation history
  • isStream: the flag to indicate whether the response should be streamed
  • systemPrompt: the system prompt
  • modelId: the model ID

Returns:

  • message: the response message
  • stream: the stream channel

func PerformGeneralRequest

func PerformGeneralRequest(input string, history []sharedtypes.HistoricMessage, isStream bool, systemPrompt string) (message string, stream *chan string)

PerformGeneralRequest performs a general chat completion request to LLM

Tags:

  • @displayName: General LLM Request

Parameters:

  • input: the input string
  • history: the conversation history
  • isStream: the stream flag
  • systemPrompt: the system prompt

Returns:

  • message: the generated message
  • stream: the stream channel

func PerformGeneralRequestNoStreaming

func PerformGeneralRequestNoStreaming(input string, history []sharedtypes.HistoricMessage, systemPrompt string) (message string)

PerformGeneralRequestNoStreaming performs a general chat completion request to LLM without streaming

Tags:

  • @displayName: General LLM Request (no streaming)

Parameters:

  • input: the input string
  • history: the conversation history
  • systemPrompt: the system prompt

Returns:

  • message: the generated message

func PerformGeneralRequestSpecificModel

func PerformGeneralRequestSpecificModel(input string, history []sharedtypes.HistoricMessage, isStream bool, systemPrompt string, modelIds []string) (message string, stream *chan string)

PerformGeneralRequestSpecificModel performs a general request to LLM with a specific model

Tags:

  • @displayName: General LLM Request (Specific Models)

Parameters:

  • input: the user input
  • history: the conversation history
  • isStream: the flag to indicate whether the response should be streamed
  • systemPrompt: the system prompt
  • modelId: the model ID

Returns:

  • message: the response message
  • stream: the stream channel

func PerformGeneralRequestSpecificModelAndModelOptions

func PerformGeneralRequestSpecificModelAndModelOptions(input string, history []sharedtypes.HistoricMessage, isStream bool, systemPrompt string, modelIds []string, modelOptions sharedtypes.ModelOptions) (message string, stream *chan string)

PerformGeneralRequestSpecificModel performs a general request to LLM with a specific model

Tags:

  • @displayName: General LLM Request (Specific Models & Model Options)

Parameters:

  • input: the user input
  • history: the conversation history
  • isStream: the flag to indicate whether the response should be streamed
  • systemPrompt: the system prompt
  • modelId: the model ID
  • modelOptions: the model options

Returns:

  • message: the response message
  • stream: the stream channel

func PerformGeneralRequestSpecificModelNoStreamWithOpenAiTokenOutput

func PerformGeneralRequestSpecificModelNoStreamWithOpenAiTokenOutput(input string, history []sharedtypes.HistoricMessage, systemPrompt string, modelIds []string, tokenCountModelName string) (message string, tokenCount int)

PerformGeneralRequestSpecificModelNoStreamWithOpenAiTokenOutput performs a general request to LLM with a specific model and returns the token count using OpenAI token count model. Does not stream the response.

Tags:

  • @displayName: General LLM Request (Specific Models, No Stream, OpenAI Token Output)

Parameters:

  • input: the user input
  • history: the conversation history
  • systemPrompt: the system prompt
  • modelIds: the model IDs of the AI models to use
  • tokenCountModelName: the model name to use for token count

Returns:

  • message: the response message
  • tokenCount: the token count

func PerformGeneralRequestWithImages

func PerformGeneralRequestWithImages(input string, history []sharedtypes.HistoricMessage, isStream bool, systemPrompt string, images []string) (message string, stream *chan string)

PerformGeneralRequestWithImages performs a general request to LLM with images

Tags:

  • @displayName: General LLM Request (with Images)

Parameters:

  • input: the user input
  • history: the conversation history
  • isStream: the flag to indicate whether the response should be streamed
  • systemPrompt: the system prompt
  • images: the images

Returns:

  • message: the response message
  • stream: the stream channel

func PerformKeywordExtractionRequest

func PerformKeywordExtractionRequest(input string, maxKeywordsSearch uint32) (keywords []string)

PerformKeywordExtractionRequest performs a keywords extraction request to LLM

Tags:

  • @displayName: Keyword Extraction

Parameters:

  • input: the input string
  • maxKeywordsSearch: the maximum number of keywords to search for

Returns:

  • keywords: the keywords extracted from the input string as a slice of strings

func PerformSummaryRequest

func PerformSummaryRequest(input string) (summary string)

PerformSummaryRequest performs a summary request to LLM

Tags:

  • @displayName: Summary

Parameters:

  • input: the input string

Returns:

  • summary: the summary extracted from the input string

func PerformVectorEmbeddingRequest

func PerformVectorEmbeddingRequest(input string) (embeddedVector []float32)

PerformVectorEmbeddingRequest performs a vector embedding request to LLM

Tags:

  • @displayName: Embeddings

Parameters:

  • input: the input string

Returns:

  • embeddedVector: the embedded vector in float32 format

func PerformVectorEmbeddingRequestWithTokenLimitCatch

func PerformVectorEmbeddingRequestWithTokenLimitCatch(input string, tokenLimitMessage string) (embeddedVector []float32, tokenLimitReached bool, responseMessage string)

PerformVectorEmbeddingRequestWithTokenLimitCatch performs a vector embedding request to LLM and catches the token limit error message

Tags:

  • @displayName: Embeddings with Token Limit Catch

Parameters:

  • input: the input string

Returns:

  • embeddedVector: the embedded vector in float32 format

func RetrieveDependencies

func RetrieveDependencies(
    collectionName string,
    relationshipName string,
    relationshipDirection string,
    sourceDocumentId string,
    nodeTypesFilter sharedtypes.DbArrayFilter,
    maxHopsNumber int) (dependenciesIds []string)

RetrieveDependencies retrieves the dependencies of the specified source node.

The function returns the list of dependencies.

Tags:

  • @displayName: Retrieve Dependencies

Parameters:

  • collectionName: the name of the collection to which the data objects will be added.
  • relationshipName: the name of the relationship to retrieve dependencies for.
  • relationshipDirection: the direction of the relationship to retrieve dependencies for.
  • sourceDocumentId: the document ID of the source node.
  • nodeTypesFilter: filter based on node types.
  • maxHopsNumber: maximum number of hops to traverse.

Returns:

  • dependenciesIds: the list of dependencies

func SendLogicAppNotificationEmail

func SendLogicAppNotificationEmail(logicAppEndpoint string, email string, subject string, content string)

SendLogicAppNotificationEmail sends a POST request to the email service.

Tags:

  • @displayName: Send Email Notification

Parameters:

  • endpoint: The email service endpoint.
  • email: The email address.
  • subject: The email subject.
  • content: The email content.

func SendRestAPICall

func SendRestAPICall(requestType string, endpoint string, header map[string]string, query map[string]string, jsonBody string) (success bool, returnJsonBody string)

SendAPICall sends an API call to the specified URL with the specified headers and query parameters.

Tags:

  • @displayName: REST Call

Parameters:

  • requestType: the type of the request (GET, POST, PUT, PATCH, DELETE)
  • urlString: the URL to send the request to
  • headers: the headers to include in the request
  • query: the query parameters to include in the request
  • jsonBody: the body of the request as a JSON string

Returns:

  • success: a boolean indicating whether the request was successful
  • returnJsonBody: the JSON body of the response as a string

func SendVectorsToKnowledgeDB

func SendVectorsToKnowledgeDB(vector []float32, keywords []string, keywordsSearch bool, collection string, similaritySearchResults int, similaritySearchMinScore float64) (databaseResponse []sharedtypes.DbResponse)

SendVectorsToKnowledgeDB sends the given vector to the KnowledgeDB and returns the most relevant data. The number of results is specified in the config file. The keywords are used to filter the results. The min score filter is also specified in the config file. If it is not specified, the default value is used.

The function returns the most relevant data.

Tags:

  • @displayName: Similarity Search

Parameters:

  • vector: the vector to be sent to the KnowledgeDB
  • keywords: the keywords to be used to filter the results
  • keywordsSearch: the flag to enable the keywords search
  • collection: the collection name
  • similaritySearchResults: the number of results to be returned
  • similaritySearchMinScore: the minimum score for the results

Returns:

  • databaseResponse: an array of the most relevant data

func ShortenMessageHistory

func ShortenMessageHistory(history []sharedtypes.HistoricMessage, maxLength int) (updatedHistory []sharedtypes.HistoricMessage)

ShortenMessageHistory shortens the conversation history to a maximum length. It will retain only the most recent messages and older messages will be removed.

Tags:

  • @displayName: Shorten History

Parameters:

  • history: the conversation history
  • maxLength: the maximum length of the conversation history

Returns:

  • updatedHistory: the updated conversation history

func SimilaritySearch

func SimilaritySearch(
    collectionName string,
    embeddedVector []float32,
    maxRetrievalCount int,
    outputFields []string,
    filters sharedtypes.DbFilters,
    minScore float64,
    getLeafNodes bool,
    getSiblings bool,
    getParent bool,
    getChildren bool) (databaseResponse []sharedtypes.DbResponse)

SimilaritySearch performs a similarity search in the KnowledgeDB.

The function returns the similarity search results.

Tags:

  • @displayName: Similarity Search (Filtered)

Parameters:

  • collectionName: the name of the collection to which the data objects will be added.
  • embeddedVector: the embedded vector used for searching.
  • maxRetrievalCount: the maximum number of results to be retrieved.
  • outputFields: the fields to be included in the output.
  • filters: the filter for the query.
  • minScore: the minimum score filter.
  • getLeafNodes: flag to indicate whether to retrieve all the leaf nodes in the result node branch.
  • getSiblings: flag to indicate whether to retrieve the previous and next node to the result nodes.
  • getParent: flag to indicate whether to retrieve the parent object.
  • getChildren: flag to indicate whether to retrieve the children objects.

Returns:

  • databaseResponse: the similarity search results

func SimilartitySearchOnPathDescriptions

func SimilartitySearchOnPathDescriptions(instruction string, toolName string) (descriptions []string)

SimilartitySearchOnPathDescriptions do similarity search on path description

Tags:

  • @displayName: SimilartitySearchOnPathDescriptions

Parameters:

  • instruction: the user query
  • toolName: the tool name

Returns:

  • descriptions: the list of descriptions

func StoreElementsInGraphDatabase

func StoreElementsInGraphDatabase(elements []sharedtypes.CodeGenerationElement)

StoreElementsInGraphDatabase stores elements in the graph database.

Tags:

  • @displayName: Store Elements in Graph Database

Parameters:

  • elements: code generation elements.

func StoreElementsInVectorDatabase

func StoreElementsInVectorDatabase(elements []sharedtypes.CodeGenerationElement, elementsCollectionName string, batchSize int)

StoreElementsInVectorDatabase stores elements in the vector database.

Tags:

  • @displayName: Store Elements in Vector Database

Parameters:

  • elements: code generation elements.
  • elementsCollectionName: name of the collection.
  • batchSize: batch size for embeddings.

func StoreExamplesInGraphDatabase

func StoreExamplesInGraphDatabase(examples []sharedtypes.CodeGenerationExample)

StoreExamplesInGraphDatabase stores examples in the graph database.

Tags:

  • @displayName: Store Examples in Graph Database

Parameters:

  • examples: code generation examples.

func StoreExamplesInVectorDatabase

func StoreExamplesInVectorDatabase(examples []sharedtypes.CodeGenerationExample, examplesCollectionName string, batchSize int)

StoreExamplesInVectorDatabase stores examples in the vector database.

Tags:

  • @displayName: Store Examples in Vector Database

Parameters:

  • examples: code generation examples.
  • examplesCollectionName: name of the collection.
  • batchSize: batch size for embeddings.

func StoreUserGuideSectionsInGraphDatabase

func StoreUserGuideSectionsInGraphDatabase(sections []sharedtypes.CodeGenerationUserGuideSection, label string)

StoreUserGuideSectionsInGraphDatabase stores user guide sections in the graph database.

Tags:

  • @displayName: Store User Guide Sections in Graph Database

Parameters:

  • elements: user guide sections.
  • label: label for the sections (UserGuide by default).

func StoreUserGuideSectionsInVectorDatabase

func StoreUserGuideSectionsInVectorDatabase(sections []sharedtypes.CodeGenerationUserGuideSection, userGuideCollectionName string, batchSize int, chunkSize int, chunkOverlap int)

StoreUserGuideSectionsInVectorDatabase stores user guide sections in the vector database.

Tags:

  • @displayName: Store User Guide Sections in Vector Database

Parameters:

  • sections: user guide sections.
  • userGuideCollectionName: name of the collection.
  • batchSize: batch size for embeddings.
  • chunkSize: size of the chunks.
  • chunkOverlap: overlap of the chunks.

func SynthesizeActions

func SynthesizeActions(instruction string, properties []string, actions []map[string]string) (updatedActions []map[string]string)

SynthesizeActions update action as per user instruction

Tags:

  • @displayName: SynthesizeActions

Parameters:

  • instruction: the user instruction
  • properties: the list of properties
  • actions: the list of actions

Returns:

  • updatedActions: the list of synthesized actions

func UpdateTotalTokenCountForCustomerMongoDb

func UpdateTotalTokenCountForCustomerMongoDb(apiKey string, mongoDbUrl string, mongoDatabaseName string, mongoDbCollectionName string, additionalTokenCount int) (tokenLimitReached bool)

UpdateTotalTokenCountForCustomerMongoDb updates the total token count for the given customer in the MongoDB database.

Tags:

  • @displayName: Update Total Token Count

Parameters:

  • apiKey: The API key of the customer.
  • mongoDbUrl: The URL of the MongoDB database.
  • mongoDatabaseName: The name of the MongoDB database.
  • mongoDbCollectionName: The name of the MongoDB collection.
  • additionalTokenCount: The number of additional tokens to add to the total token count.

Returns:

  • tokenLimitReached: A boolean indicating whether the customer has reached the token limit.

func ansysGPTACSSemanticHybridSearch

func ansysGPTACSSemanticHybridSearch(
    acsEndpoint string,
    acsApiKey string,
    acsApiVersion string,
    query string,
    embeddedQuery []float32,
    indexName string,
    filter map[string]string,
    topK int,
    isAis bool,
    physics []string) (output []sharedtypes.ACSSearchResponse, err error)

ansysGPTACSSemanticHybridSearch performs a semantic hybrid search in ACS

Parameters:

  • query: the query string
  • embeddedQuery: the embedded query
  • indexName: the index name
  • filter: string build in specific format (https://learn.microsoft.com/en-us/azure/search/search-filters)
  • filterAfterVectorSearch: the flag to define the filter order (recommended true)
  • returnedProperties: the properties to be returned
  • topK: the number of results to be returned from vector search
  • searchedEmbeddedFields: the ACS fields to be searched

Returns:

  • output: the search results

func codeGenerationProcessBatchEmbeddings

func codeGenerationProcessBatchEmbeddings(elements []sharedtypes.CodeGenerationElement, maxBatchSize int) (elementEmbeddings [][]float32, err error)

codeGenerationProcessBatchEmbeddings processes the data extraction batch embeddings.

Parameters:

  • documentData: the document data.
  • maxBatchSize: the max batch size.

Returns:

  • error: an error if any

func codeGenerationProcessHybridSearchEmbeddings

func codeGenerationProcessHybridSearchEmbeddings(elements []sharedtypes.CodeGenerationElement, maxBatchSize int) (denseEmbeddings [][]float32, lexicalWeights []map[uint]float32, err error)

codeGenerationProcessHybridSearchEmbeddings processes the data extraction batch embeddings.

Parameters:

  • elements: the elements.
  • maxBatchSize: the max batch size.

Returns:

  • error: an error if any

func codeGenerationProcessHybridSearchEmbeddingsForExamples

func codeGenerationProcessHybridSearchEmbeddingsForExamples(elements []codegeneration.VectorDatabaseExample, maxBatchSize int) (denseEmbeddings [][]float32, lexicalWeights []map[uint]float32, err error)

codeGenerationProcessHybridSearchEmbeddings processes the data extraction batch embeddings.

Parameters:

  • elements: the elements.
  • maxBatchSize: the max batch size.

Returns:

  • error: an error if any

func codeGenerationProcessHybridSearchEmbeddingsForUserGuideSections

func codeGenerationProcessHybridSearchEmbeddingsForUserGuideSections(sections []codegeneration.VectorDatabaseUserGuideSection, maxBatchSize int) (denseEmbeddings [][]float32, lexicalWeights []map[uint]float32, err error)

func convertToFloat32Slice

func convertToFloat32Slice(interfaceSlice []interface{}) ([]float32, error)

convertToFloat32Slice converts an interface slice to a float32 slice.

Parameters:

  • interfaceSlice: the interface slice.

Returns:

  • float32Slice: the float32 slice.
  • error: an error if any.

func createDbArrayFilter

func createDbArrayFilter(filterData []string, needAll bool) (databaseFilter sharedtypes.DbArrayFilter)

createDbArrayFilter creates an array filter for the KnowledgeDB.

The function returns the array filter.

Parameters:

  • filterData: the filter data
  • needAll: flag to indicate whether all data is needed

Returns:

  • databaseFilter: the array filter

func createDbJsonFilter

func createDbJsonFilter(fieldName string, fieldType string, filterData []string, needAll bool) (databaseFilter sharedtypes.DbJsonFilter)

createDbJsonFilter creates a JSON filter for the KnowledgeDB.

The function returns the JSON filter.

Parameters:

  • fieldName: the name of the field
  • fieldType: the type of the field
  • filterData: the filter data
  • needAll: flag to indicate whether all data is needed

Returns:

  • databaseFilter: the JSON filter

func createPayloadAndSendHttpRequest

func createPayloadAndSendHttpRequest(url string, requestObject interface{}, responsePtr interface{}) (funcError error, statusCode int)

createPayloadAndSendHttpRequest creates a JSON payload and sends an HTTP POST request.

Parameters:

  • url: the URL to send the request to.
  • requestObject: the object to send in the request body.
  • responsePtr: a pointer to the object to store the response in.

Returns:

  • error: the error returned by the function.

func dataExtractNewGithubClient

func dataExtractNewGithubClient(githubAccessToken string) (client *github.Client, ctx context.Context)

dataExtractNewGithubClient initializes a new GitHub client with the given access token.

Parameters:

  • githubAccessToken: the GitHub access token.

Returns:

  • *github.Client: the GitHub client.
  • context.Context: the context.

func dataExtractionDocumentLevelHandler

func dataExtractionDocumentLevelHandler(inputChannel chan *DataExtractionLLMInputChannelItem, errorChannel chan error, chunks []string, documentId string, documentPath string, getSummary bool,
    getKeywords bool, numKeywords uint32) (orderedChildDataObjects []*sharedtypes.DbData, err error)

dataExtractionDocumentLevelHandler handles the data extraction at document level.

Parameters:

  • inputChannel: the input channel.
  • chunks: the document chunks.
  • documentId: the document ID.
  • documentPath: the document path.
  • getSummary: the flag to indicate whether to get the summary.
  • getKeywords: the flag to indicate whether to get the keywords.
  • numKeywords: the number of keywords.

Returns:

  • orderedChildDataObjects: the ordered child data objects.

func dataExtractionFilterGithubTreeEntries

func dataExtractionFilterGithubTreeEntries(tree *github.Tree, githubFilteredDirectories, githubExcludedDirectories, githubFileExtensions []string) (githubFilesToExtract []string)

dataExtractionFilterGithubTreeEntries filters the Github tree entries based on the specified filters.

Parameters:

  • tree: the Github tree.
  • githubFilteredDirectories: the Github filtered directories.
  • githubExcludedDirectories: the Github excluded directories.
  • githubFileExtensions: the Github file extensions.

Returns:

  • []string: the files to extract.

func dataExtractionLLMHandlerWorker

func dataExtractionLLMHandlerWorker(waitgroup *sync.WaitGroup, inputChannel chan *DataExtractionLLMInputChannelItem, errorChannel chan error, embeddingsDimensions int)

dataExtractionLLMHandlerWorker is a worker function for the LLM Handler requests during data extraction.

Parameters:

  • waitgroup: the wait group
  • inputChannel: the input channel
  • errorChannel: the error channel
  • embeddingsDimensions: the embeddings dimensions

Returns:

  • error: an error if any

func dataExtractionLocalFilepathExtractWalker

func dataExtractionLocalFilepathExtractWalker(localPath string, localFileExtensions []string,
    localFilteredDirectories []string, localExcludedDirectories []string, filesToExtract *[]string, f os.FileInfo, err error) error

dataExtractionLocalFilepathExtractWalker is the walker function for the local file extraction.

Parameters:

  • localPath: the local path.
  • localFileExtensions: the local file extensions.
  • localFilteredDirectories: the local filtered directories.
  • localExcludedDirectories: the local excluded directories.
  • filesToExtract: the files to extract.
  • f: the file info

Returns:

  • error: error that occured during execution.

func dataExtractionPerformSplitterRequest

func dataExtractionPerformSplitterRequest(content []byte, documentType string, chunkSize int, chunkOverlap int) (output []string, err error)

dataExtractionPerformSplitterRequest performs a data extraction splitter request to the Python service.

Parameters:

  • content: the content.
  • documentType: the document type.
  • chunkSize: the chunk size.
  • chunkOverlap: the chunk overlap.

Returns:

  • output: the output.
  • error: an error if any.

func dataExtractionProcessBatchEmbeddings

func dataExtractionProcessBatchEmbeddings(documentData []*sharedtypes.DbData, maxBatchSize int) error

dataExtractionProcessBatchEmbeddings processes the data extraction batch embeddings.

Parameters:

  • documentData: the document data.
  • maxBatchSize: the max batch size.

Returns:

  • error: an error if any

func dataExtractionTextSplitter

func dataExtractionTextSplitter(input string, chunkSize int, chunkOverlap int) (chunks []string, err error)

func downloadGithubFileContent

func downloadGithubFileContent(githubRepoName string, githubRepoOwner string,
    githubRepoBranch string, gihubFilePath string, githubAccessToken string) (checksum string, content []byte, err error)

downloadGithubFileContent downloads file content from github and returns checksum and content.

Parameters:

  • githubRepoName: name of the github repository.
  • githubRepoOwner: owner of the github repository.
  • githubRepoBranch: branch of the github repository.
  • gihubFilePath: path to file in the github repository.
  • githubAccessToken: access token for github.

Returns:

  • checksum: checksum of file.
  • content: content of file.

func extractAndConvertACSResponse

func extractAndConvertACSResponse(body []byte, indexName string) (output []sharedtypes.ACSSearchResponse)

extractAndConvertACSResponse extracts and converts the ACS response to ACSSearchResponse

Parameters:

  • body: the response body
  • indexName: the index name

Returns:

  • output: the search results

func extractPythonCode

func extractPythonCode(markdown string) (pythonCode string, error error)

extractPythonCode extracts the Python code from a markdown string. If the string does not contain a code block, it is assumed that the string is Python code and is returned as is.

Parameters:

  • markdown: the markdown string

Returns:

  • string: the Python code
  • error: error if any

func formatTemplate

func formatTemplate(template string, data map[string]string) string

formatTemplate formats a template string with the given data

Parameters:

  • template: the template string
  • data: the data to be used for formatting

Returns:

  • string: the formatted template string

func getFieldsAndReturnProperties

func getFieldsAndReturnProperties(indexName string) (searchedEmbeddedFields string, returnedProperties string)

getFieldsAndReturnProperties returns the searchedEmbeddedFields and returnedProperties based on the index name

Parameters:

  • indexName: the index name

Returns:

  • searchedEmbeddedFields: the ACS fields to be searched
  • returnedProperties: the properties to be returned

func getIndexNameFromToolName

func getIndexNameFromToolName(toolName string) (indexName string, err error)

getIndexNameFromToolName index name by tool

Parameters:

  • toolName: path to file.

Returns:

  • indexName: index name.
  • err: error if any.

func getLocalFileContent

func getLocalFileContent(localFilePath string) (checksum string, content []byte, err error)

getLocalFileContent reads local file and returns checksum and content.

Parameters:

  • localFilePath: path to file.

Returns:

  • checksum: checksum of file.
  • content: content of file.
  • error: error if any.

func httpRequest

func httpRequest(method string, url string, headers map[string]string, body []byte) ([]byte, error)

httpRequest is a general function for making HTTP requests.

Parameters:

  • method: HTTP method.
  • url: URL to make the request to.
  • headers: headers to include in the request.
  • body: body of the request.

Returns:

  • response body.
  • error.

func initializeClient

func initializeClient(llmHandlerEndpoint string) *websocket.Conn

initializeClient initializes the LLM Handler client

Returns:

  • *websocket.Conn: the websocket connection

func listener

func listener(c *websocket.Conn, responseChannel chan sharedtypes.HandlerResponse, singleRequest bool)

listener listens for messages from the LLM Handler

Parameters:

  • c: the websocket connection
  • responseChannel: the response channel

func llmHandlerPerformKeywordExtractionRequest

func llmHandlerPerformKeywordExtractionRequest(input string, numKeywords uint32) (keywords []string, err error)

llmHandlerPerformKeywordExtractionRequest performs a keyword extraction request to LLM Handler.

Parameters:

  • input: the input string.
  • numKeywords: the number of keywords.

Returns:

  • keywords: the keywords.
  • error: an error if any.

func llmHandlerPerformSummaryRequest

func llmHandlerPerformSummaryRequest(input string) (summary string, err error)

llmHandlerPerformSummaryRequest performs a summary request to LLM Handler.

Parameters:

  • input: the input string.

Returns:

  • summary: the summary.
  • error: an error if any.

func llmHandlerPerformVectorEmbeddingRequest

func llmHandlerPerformVectorEmbeddingRequest(input []string, sparse bool) (embeddedVectors [][]float32, sparseEmbeddings []map[uint]float32, err error)

llmHandlerPerformVectorEmbeddingRequest performs a vector embedding request to LLM Handler.

Parameters:

  • input: slice of input strings.

Returns:

  • embeddedVector: the embedded vectors.
  • error: an error if any.

func mongoDbAddToTotalTokenCount

func mongoDbAddToTotalTokenCount(mongoDbContext *MongoDbContext, apiKey string, additionalTokenCount int) (err error)

mongoDbAddToTotalTokenCount increments the total token count for a customer

Parameters:

  • mongoDbContext: The MongoDB context.
  • apiKey: The API key.
  • additionalTokenCount: The number of tokens to add.

Returns:

  • err: An error if any.

func mongoDbCollectionExists

func mongoDbCollectionExists(database *mongo.Database, collectionName string) (exists bool, err error)

mongoDbCollectionExists checks if a collection exists in the database

Parameters:

  • database: The MongoDB database.
  • collectionName: The name of the collection.

Returns:

  • exists: True if the collection exists, false otherwise.
  • err: An error if any.

func mongoDbUpdateAccessAndWarning

func mongoDbUpdateAccessAndWarning(mongoDbContext *MongoDbContext, apiKey string) (err error)

mongoDbUpdateAccessAndWarning updates the access_denied and warning_sent fields

Parameters:

  • mongoDbContext: The MongoDB context.
  • apiKey: The API key.

Returns:

  • err: An error if any.

func openAiTokenCount

func openAiTokenCount(modelName string, message string) (int, error)

openAiTokenCount returns the number of tokens in a message for a given model.

Parameters:

  • modelName: the model name.
  • message: the message.

Returns:

  • int: the number of tokens.
  • error: an error if any.

func performGeneralRequest

func performGeneralRequest(input string, history []sharedtypes.HistoricMessage, isStream bool, systemPrompt string, options *sharedtypes.ModelOptions) (message string, stream *chan string, err error)

performGeneralRequest performs a general chat completion request to LLM.

Parameters:

  • input: the input string.
  • history: the conversation history.
  • isStream: the stream flag.
  • systemPrompt: the system prompt.

Returns:

  • message: the generated message.
  • stream: the stream channel.
  • err: the error.

func randomNameGenerator

func randomNameGenerator() string

randomNameGenerator generates a random name for the temporary Python script file

Returns:

  • string: the name of the temporary Python script file

func sendChatRequest

func sendChatRequest(data string, chatRequestType string, history []sharedtypes.HistoricMessage, maxKeywordsSearch uint32, systemPrompt interface{}, llmHandlerEndpoint string, modelIds []string, options *sharedtypes.ModelOptions, images []string) chan sharedtypes.HandlerResponse

sendChatRequest sends a chat request to LLM

Parameters:

  • data: the input string
  • chatRequestType: the chat request type
  • history: the conversation history
  • maxKeywordsSearch: the maximum number of keywords to search for
  • systemPrompt: the system prompt
  • llmHandlerEndpoint: the LLM Handler endpoint
  • modelIds: the model IDs
  • options: the model options

Returns:

  • chan sharedtypes.HandlerResponse: the response channel

func sendChatRequestNoHistory

func sendChatRequestNoHistory(data string, chatRequestType string, maxKeywordsSearch uint32, llmHandlerEndpoint string, modelIds []string, options *sharedtypes.ModelOptions) chan sharedtypes.HandlerResponse

sendChatRequestNoHistory sends a chat request to LLM without history

Parameters:

  • data: the input string
  • chatRequestType: the chat request type
  • maxKeywordsSearch: the maximum number of keywords to search for
  • llmHandlerEndpoint: the LLM Handler endpoint
  • modelIds: the model IDs
  • options: the model options

Returns:

  • chan sharedtypes.HandlerResponse: the response channel

func sendChatRequestNoStreaming

func sendChatRequestNoStreaming(data string, chatRequestType string, history []sharedtypes.HistoricMessage, maxKeywordsSearch uint32, systemPrompt string, llmHandlerEndpoint string, modelIds []string, options *sharedtypes.ModelOptions, images []string) string

sendChatRequestNoStreaming sends a chat request to LLM without streaming

Parameters:

  • data: the input string
  • chatRequestType: the chat request type
  • history: the conversation history
  • maxKeywordsSearch: the maximum number of keywords to search for
  • systemPrompt: the system prompt
  • llmHandlerEndpoint: the LLM Handler endpoint
  • modelIds: the model IDs
  • options: the model options

Returns:

  • string: the response

func sendEmbeddingsRequest

func sendEmbeddingsRequest(data interface{}, llmHandlerEndpoint string, getSparseEmbeddings bool, modelIds []string) chan sharedtypes.HandlerResponse

sendEmbeddingsRequest sends an embeddings request to LLM

Parameters:

  • data: the input string
  • llmHandlerEndpoint: the LLM Handler endpoint
  • getSparseEmbeddings: the flag to indicate whether to get sparse embeddings
  • modelIds: the model IDs

Returns:

  • chan sharedtypes.HandlerResponse: the response channel

func sendRequest

func sendRequest(adapter string, data interface{}, RequestChannel chan []byte, chatRequestType string, dataStream string, getSparseEmbeddings bool, history []sharedtypes.HistoricMessage, maxKeywordsSearch uint32, systemPrompt interface{}, responseChannel chan sharedtypes.HandlerResponse, modelIds []string, options *sharedtypes.ModelOptions, images []string)

sendRequest sends a request to LLM

Parameters:

  • adapter: the adapter type. Types: "chat", "embeddings"
  • data: the input string
  • RequestChannel: the request channel
  • chatRequestType: the chat request type. Types: "summary", "code", "keywords"
  • dataStream: the data stream flag
  • history: the conversation history
  • sc: the session context

func sendTokenCountToEndpoint

func sendTokenCountToEndpoint(jwtToken string, tokenCountEndpoint string, inputTokenCount int, ouputTokenCount int) (err error)

sendTokenCount sends the token count to the token count endpoint

Parameters: - userEmail: the email of the user - tokenCountEndpoint: the endpoint to send the token count to - inputTokenCount: the number of input tokens - ouputTokenCount: the number of output tokens

Returns: - err: an error if the request fails

func shutdownHandler

func shutdownHandler(c *websocket.Conn)

shutdownHandler handles the shutdown of the LLM Handler

Parameters:

  • c: the websocket connection
  • RequestChannel: the request channel

func transferDatafromResponseToStreamChannel

func transferDatafromResponseToStreamChannel(
    responseChannel *chan sharedtypes.HandlerResponse,
    streamChannel *chan string,
    validateCode bool,
    sendTokenCount bool,
    tokenCountEndpoint string,
    previousInputTokenCount int,
    previousOutputTokenCount int,
    tokenCountModelName string,
    jwtToken string,
    userEmail string,
    sendContex bool,
    contex string)

transferDatafromResponseToStreamChannel transfers the data from the response channel to the stream channel

Parameters:

  • responseChannel: the response channel
  • streamChannel: the stream channel
  • validateCode: the flag to indicate whether the code should be validated

func updateMeshPilotActionProperty

func updateMeshPilotActionProperty(list []map[string]string, findKey, findValue, assignKey, assignValue string) (updated bool)

updateMeshPilotActionProperty update action property by given key-value pair.

Parameters:

  • list: list of actions
  • findKey: key for search
  • findValue: value for search
  • assignKey: need update for a key
  • assignValue: assign value to a assignKey

Returns:

  • updated: boolean returns true if updated else false.

func validatePythonCode

func validatePythonCode(pythonCode string) (bool, bool, error)

validatePythonCode validates the Python code using a Python code analysis tool (pyright) and returns several values to indicate the validity of the Python code.

Parameters:

  • pythonCode: the Python code to be validated

Returns:

  • bool: true if the Python code is valid, false otherwise
  • bool: true if the Python code has potential errors, false otherwise
  • error: an error message if the Python code is invalid

func writer

func writer(c *websocket.Conn, RequestChannel chan []byte, responseChannel chan sharedtypes.HandlerResponse)

writer writes messages to the LLM Handler

Parameters:

  • c: the websocket connection
  • RequestChannel: the request channel

type ACSSearchRequest

ACSRequest represents the request structure for the Azure Cognitive Search.

type ACSSearchRequest struct {
    Search                string           `json:"search"`
    VectorQueries         []ACSVectorQuery `json:"vectorQueries"`
    VectorFilterMode      string           `json:"vectorFilterMode"`
    Filter                string           `json:"filter"`
    QueryType             string           `json:"queryType"`
    SemanticConfiguration string           `json:"semanticConfiguration"`
    Top                   int              `json:"top"`
    Select                string           `json:"select"`
    Count                 bool             `json:"count"`
}

type ACSSearchResponseALH

ACSSearchResponse represents the response structure for the Azure Cognitive Search for ansysgpt-alh & ansysgpt-scbu.

type ACSSearchResponseALH struct {
    SourcetitleSAP      string  `json:"sourcetitleSAP"`
    SourceURLSAP        string  `json:"sourceURLSAP"`
    SourcetitleDCB      string  `json:"sourcetitleDCB"`
    SourceURLDCB        string  `json:"sourceURLDCB"`
    Content             string  `json:"content"`
    TypeOFasset         string  `json:"typeOFasset"`
    Physics             string  `json:"physics"`
    Product             string  `json:"product"`
    Version             string  `json:"version"`
    Weight              float64 `json:"weight"`
    TokenSize           int     `json:"token_size"`
    SearchScore         float64 `json:"@search.score"`
    SearchRerankerScore float64 `json:"@search.rerankerScore"`
    IndexName           string  `json:"indexName"`
}

type ACSSearchResponseCrtech

ACSSearchResponseCrtech represents the response structure for the Azure Cognitive Search for external-crtech-thermal-desktop.

type ACSSearchResponseCrtech struct {
    Physics             string  `json:"physics"`
    SourceTitleLvl3     string  `json:"sourceTitle_lvl3"`
    SourceURLLvl3       string  `json:"sourceURL_lvl3"`
    TokenSize           int     `json:"token_size"`
    SourceTitleLvl2     string  `json:"sourceTitle_lvl2"`
    Weight              float64 `json:"weight"`
    SourceURLLvl2       string  `json:"sourceURL_lvl2"`
    Product             string  `json:"product"`
    Content             string  `json:"content"`
    TypeOFasset         string  `json:"typeOFasset"`
    Version             string  `json:"version"`
    BridgeId            string  `json:"bridge_id"`
    SearchScore         float64 `json:"@search.score"`
    SearchRerankerScore float64 `json:"@search.rerankerScore"`
    IndexName           string  `json:"indexName"`
}

type ACSSearchResponseLSdyna

ACSSearchResponse represents the response structure for the Azure Cognitive Search for lsdyna-documentation-r14.

type ACSSearchResponseLSdyna struct {
    Title               string  `json:"title"`
    Url                 string  `json:"url"`
    Content             string  `json:"content"`
    TypeOFasset         string  `json:"typeOFasset"`
    Physics             string  `json:"physics"`
    Product             string  `json:"product"`
    TokenSize           int     `json:"token_size"`
    SearchScore         float64 `json:"@search.score"`
    SearchRerankerScore float64 `json:"@search.rerankerScore"`
    IndexName           string  `json:"indexName"`
}

type ACSSearchResponseStruct

ACSSearchResponseStruct represents the response structure for the Azure Cognitive Search for granular-ansysgpt, ansysgpt-documentation-2023r2, scade-documentation-2023r2, ansys-dot-com-marketing.

type ACSSearchResponseStruct struct {
    OdataContext string                          `json:"@odata.context"`
    OdataCount   int                             `json:"@odata.count"`
    Value        []sharedtypes.ACSSearchResponse `json:"value"`
}

type ACSSearchResponseStructALH

ACSSearchResponseStruct represents the response structure for the Azure Cognitive Search for ansysgpt-alh & ansysgpt-scbu.

type ACSSearchResponseStructALH struct {
    OdataContext string                 `json:"@odata.context"`
    OdataCount   int                    `json:"@odata.count"`
    Value        []ACSSearchResponseALH `json:"value"`
}

type ACSSearchResponseStructCrtech

ACSSearchResponseStructCrtech represents the response structure for the Azure Cognitive Search for external-crtech-thermal-desktop.

type ACSSearchResponseStructCrtech struct {
    OdataContext string                    `json:"@odata.context"`
    OdataCount   int                       `json:"@odata.count"`
    Value        []ACSSearchResponseCrtech `json:"value"`
}

type ACSSearchResponseStructLSdyna

ACSSearchResponseStruct represents the response structure for the Azure Cognitive Search for lsdyna-documentation-r14.

type ACSSearchResponseStructLSdyna struct {
    OdataContext string                    `json:"@odata.context"`
    OdataCount   int                       `json:"@odata.count"`
    Value        []ACSSearchResponseLSdyna `json:"value"`
}

type ACSVectorQuery

ACSVectorQuery represents the vector query structure for the Azure Cognitive Search.

type ACSVectorQuery struct {
    Kind   string    `json:"kind"`
    K      int       `json:"k"`
    Vector []float32 `json:"vector"`
    Fields string    `json:"fields"`
}

type AppendMessageHistoryRole

type AppendMessageHistoryRole string
const (
    user      AppendMessageHistoryRole = "user"
    assistant AppendMessageHistoryRole = "assistant"
    system    AppendMessageHistoryRole = "system"
)

type DataExtractionBranch

DataExtractionBranch represents the branch structure for the data extraction.

type DataExtractionBranch struct {
    Text             string
    ChildDataObjects []*sharedtypes.DbData
    ChildDataIds     []string
}

type DataExtractionLLMInputChannelItem

DataExtractionLLMInputChannelItem represents the input channel item for the data extraction llm handler workers.

type DataExtractionLLMInputChannelItem struct {
    Data                *sharedtypes.DbData
    Adapter             string
    ChatRequestType     string
    MaxNumberOfKeywords uint32

    InstructionSequenceWaitGroup *sync.WaitGroup
    Lock                         *sync.Mutex

    EmbeddingVector []float32
    Summary         string
    Keywords        []string
    CollectionName  string
}

func dataExtractionNewLlmInputChannelItem

func dataExtractionNewLlmInputChannelItem(data *sharedtypes.DbData, instructionSequenceWaitGroup *sync.WaitGroup, adapter string, chatRequestType string, maxNumberOfKeywords uint32, lock *sync.Mutex) *DataExtractionLLMInputChannelItem

dataExtractionNewLlmInputChannelItem creates a new llm input channel item.

Parameters:

  • data: data.
  • instructionSequenceWaitGroup: instruction sequence wait group.
  • adapter: adapter.
  • chatRequestType: chat request type.
  • maxNumberOfKeywords: max number of keywords.
  • lock: lock.

Returns:

  • llmInputChannelItem: llm input channel item.

type DataExtractionSplitterServiceRequest

type DataExtractionSplitterServiceRequest struct {
    DocumentContent []byte `json:"document_content"`
    ChunkSize       int    `json:"chunk_size"`
    ChunkOverlap    int    `json:"chunk_overlap"`
}

type DataExtractionSplitterServiceResponse

type DataExtractionSplitterServiceResponse struct {
    Chunks []string `json:"chunks"`
}

type EmailRequest

EmailRequest represents the structure of the POST request body

type EmailRequest struct {
    Email   string `json:"email"`
    Subject string `json:"subject"`
    Content string `json:"content"`
}

type GeneralDataExtractionDocument

type GeneralDataExtractionDocument struct {
    DocumentName  string           `json:"document_name"`
    Guid          string           `json:"guid"`
    PreviousChunk string           `json:"previous_chunk"`
    NextChunk     string           `json:"next_chunk"`
    DenseVector   []float32        `json:"dense_vector"`
    SparseVector  map[uint]float32 `json:"sparse_vector"`
    Text          string           `json:"text"`
}

type MongoDbContext

MongoDbContext is the structure for the mongodb client

type MongoDbContext struct {
    Client     *mongo.Client
    Database   *mongo.Database
    Collection *mongo.Collection
}

func mongoDbInitializeClient

func mongoDbInitializeClient(mongoDbEndpoint string, databaseName string, collectionName string) (mongoDbContext *MongoDbContext, err error)

mongoDbInitializeClient initializes the mongodb client This function should be called at the beginning of the agent to initialize the mongodb client

Parameters:

  • mongoDbEndpoint: The MongoDB endpoint.
  • databaseName: The name of the database.

Returns:

  • mongoDbClient: The MongoDB client.
  • err: An error if any.

type MongoDbCustomerObject

type MongoDbCustomerObject struct {
    ApiKey          string `bson:"api_key"`
    CustomerName    string `bson:"customer_name"`
    AccessDenied    bool   `bson:"access_denied"`
    TotalTokenCount int    `bson:"total_token_usage"`
    TokenLimit      int    `bson:"token_limit"`
    WarningSent     bool   `bson:"warning_sent"`
}

func mongoDbGetCustomerByApiKey

func mongoDbGetCustomerByApiKey(mongoDbContext *MongoDbContext, apiKey string) (exists bool, customer *MongoDbCustomerObject, err error)

mongoDbGetCustomerByApiKey retrieves the customer object from the database using the API key

Parameters:

  • mongoDbContext: The MongoDB context.
  • apiKey: The API key.

Returns:

  • exists: True if the customer exists, false otherwise.
  • customer: The customer object.
  • err: An error if any.

type TokenCountUpdateRequest

type TokenCountUpdateRequest struct {
    InputToken  int    `json:"input_token"`
    OutputToken int    `json:"output_token"`
    Platform    string `json:"platform"`
}

type pythonEmbeddingRequest

type pythonEmbeddingRequest struct {
    Passages          []string `json:"passages"`
    ReturnDense       bool     `json:"return_dense"`
    ReturnSparse      bool     `json:"return_sparse"`
    ReturnColbertVecs bool     `json:"return_colbert_vecs"`
    IsDocument        bool     `json:"is_document"`
}

type pythonEmbeddingResponse

type pythonEmbeddingResponse struct {
    ColbertVecs    [][][]float32      `json:"colbert_vecs"`
    LexicalWeights []map[uint]float32 `json:"lexical_weights"`
    DenseVecs      [][]float32        `json:"dense_vecs"`
}

type queryInput

queryInput represents the input for the query function.

type queryInput struct {
    CollectionName    string                `json:"collection_name" description:"Name of the collection to which the data objects will be added. Required for adding data." required:"true"`
    MaxRetrievalCount int                   `json:"max_retrieval_count" description:"Maximum number of results to be retrieved. If not specified, the default value is retrieve all database. If the number of results is too big for the database, the request will be cancelled. Optional." required:"false"`
    OutputFields      []string              `json:"output_fields" description:"Fields to be included in the output. If not specified all fields will be retrieved.Optional" required:"false"`
    Filters           sharedtypes.DbFilters `json:"filters" description:"Filter for the query. At least one filter must be defined." required:"true"`
}

type queryOutput

queryOutput represents the output for the query function.

type queryOutput struct {
    QueryResult []sharedtypes.DbResponse `json:"queryResult" description:"Returns the results of the query."`
}

type retrieveDependenciesInput

retrieveDependenciesInput represents the input for the retrieveDependencies function.

type retrieveDependenciesInput struct {
    CollectionName        string                    `json:"collection_name" description:"Name of the collection to which the data objects will be added. Required for adding data." required:"true"`
    RelationshipName      string                    `json:"relationship_name" description:"Name of the relationship to retrieve dependencies for. Required for retrieving dependencies." required:"true"`
    RelationshipDirection string                    `json:"relationship_direction" description:"Direction of the relationship to retrieve dependencies for. It can be either 'in', 'out' or 'both'. Required for retrieving dependencies." required:"true"`
    SourceDocumentId      string                    `json:"source_document_id" description:"Document ID of the source node. Required for retrieving dependencies." required:"true"`
    NodeTypesFilter       sharedtypes.DbArrayFilter `json:"node_types_filter" description:"Filter based on node types. Use MilvusArrayFilter for specifying node type filtering criteria. Optional." required:"false"`
    DocumentTypesFilter   []string                  `json:"document_types_filter" description:"Filter based on document types. Use MilvusArrayFilter for specifying document type filtering criteria. Optional." required:"false"`
    MaxHopsNumber         int                       `json:"max_hops_number" description:"Maximum number of hops to traverse. Optional." required:"true"`
}

type retrieveDependenciesOutput

retrieveDependenciesOutput represents the output for the retrieveDependencies function.

type retrieveDependenciesOutput struct {
    Success         bool     `json:"success" description:"Returns true if the collections were listed successfully. Returns false or an error if not."`
    DependenciesIds []string `json:"dependencies_ids" description:"A list of document IDs that are dependencies of the specified source node."`
}

type similarityElement

similarityElement represents a single element in the similarity search result.

type similarityElement struct {
    Score float64                `json:"distance"`
    Data  sharedtypes.DbResponse `json:"data"`
}

type similaritySearchInput

similaritySearchInput represents the input for the similarity search function.

type similaritySearchInput struct {
    CollectionName    string                `json:"collection_name" description:"Name of the collection to which the data objects will be added. Required for adding data." required:"true"`
    EmbeddedVector    []float32             `json:"embedded_vector" description:"Embedded vector used for searching. Required for retrieval." required:"true"`
    MaxRetrievalCount int                   `json:"max_retrieval_count" description:"Maximum number of results to be retrieved. If it is not specified, the default value is milvus.MaxSearchRetrievalCount. Optional." required:"false"`
    OutputFields      []string              `json:"output_fields" description:"Fields to be included in the output. If not specified all fields will be retrieved.Optional" required:"false"`
    Filters           sharedtypes.DbFilters `json:"filters" description:"Filter for the query. Optional." required:"false"`
    MinScore          float64               `json:"min_score" description:"Filter objects with a score higher than the specified minimum. Optional." required:"false"`
    GetLeafNodes      bool                  `json:"get_leaf_nodes" description:"Flag to indicate whether to retrieve all the leaf nodes in the result node branch. Set to true to include the leaf nodes. Optional." required:"false"`
    GetSiblings       bool                  `json:"get_siblings" description:"Flag to indicate whether to retrieve the previous and next node to the result nodes. Set to true to include the siblings. Optional." required:"false"`
    GetParent         bool                  `json:"get_parent" description:"Flag to indicate whether to retrieve the parent object. Set to true to include the parent object. Optional." required:"false"`
    GetChildren       bool                  `json:"get_children" description:"Flag to indicate whether to retrieve the children objects. Set to true to include the children objects. Optional." required:"false"`
}

type similaritySearchOutput

similaritySearchOutput represents the output for the similarity search function.

type similaritySearchOutput struct {
    SimilarityResult []similarityElement `json:"similarity_result" description:"Similarity Result"`
}

type summaryCounters

summaryCounters represents the summary counters structure for the Neo4j query.

type summaryCounters struct {
    NodesCreated         int `json:"nodes_created"`
    NodesDeleted         int `json:"nodes_deleted"`
    RelationshipsCreated int `json:"relationships_created"`
    RelationshipsDeleted int `json:"relationships_deleted"`
    PropertiesSet        int `json:"properties_set"`
    LabelsAdded          int `json:"labels_added"`
    LabelsRemoved        int `json:"labels_removed"`
    IndexesAdded         int `json:"indexes_added"`
    IndexesRemoved       int `json:"indexes_removed"`
    ConstraintsAdded     int `json:"constraints_added"`
    ConstraintsRemoved   int `json:"constraints_removed"`
}