externalfunctions

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2025 License: MIT Imports: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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,
	"PerformGeneralRequestSpecificModelAndModelOptionsNoStreamWithOpenAiTokenOutput": PerformGeneralRequestSpecificModelAndModelOptionsNoStreamWithOpenAiTokenOutput,
	"PerformCodeLLMRequest":                                                          PerformCodeLLMRequest,
	"PerformGeneralRequestNoStreaming":                                               PerformGeneralRequestNoStreaming,
	"BuildLibraryContext":                                                            BuildLibraryContext,
	"BuildFinalQueryForGeneralLLMRequest":                                            BuildFinalQueryForGeneralLLMRequest,
	"BuildFinalQueryForCodeLLMRequest":                                               BuildFinalQueryForCodeLLMRequest,
	"AppendMessageHistory":                                                           AppendMessageHistory,
	"ShortenMessageHistory":                                                          ShortenMessageHistory,

	"SendVectorsToKnowledgeDB": SendVectorsToKnowledgeDB,
	"GetListCollections":       GetListCollections,
	"RetrieveDependencies":     RetrieveDependencies,
	"GeneralGraphDbQuery":      GeneralGraphDbQuery,
	"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,
	"PrintFeedback":        PrintFeedback,

	"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,
	"ParseHistory":                             ParseHistory,
	"SynthesizeActionsTool4":                   SynthesizeActionsTool4,

	"QdrantCreateCollection": QdrantCreateCollection,
	"QdrantInsertData":       QdrantInsertData,

	"CheckApiKeyAuthMongoDb":                        CheckApiKeyAuthMongoDb,
	"CheckCreateUserIdMongoDb":                      CheckCreateUserIdMongoDb,
	"UpdateTotalTokenCountForCustomerMongoDb":       UpdateTotalTokenCountForCustomerMongoDb,
	"UpdateTotalTokenCountForUserIdMongoDb":         UpdateTotalTokenCountForUserIdMongoDb,
	"DenyCustomerAccessAndSendWarningMongoDb":       DenyCustomerAccessAndSendWarningMongoDb,
	"DenyCustomerAccessAndSendWarningMongoDbUserId": DenyCustomerAccessAndSendWarningMongoDbUserId,
	"SendLogicAppNotificationEmail":                 SendLogicAppNotificationEmail,
	"CreateMessageWithVariable":                     CreateMessageWithVariable,
}

Functions

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 CheckCreateUserIdMongoDb

func CheckCreateUserIdMongoDb(userId string, tokenLimitForNewUsers int, mongoDbUrl string, mongoDatabaseName string, mongoDbCollectionName string) (existingUser bool)

CheckCreateUserIdMongoDb checks if a user ID exists in the MongoDB database and creates it if it doesn't.

Tags:

  • @displayName: Check and Create User ID

Parameters:

  • userId: The user ID to check.
  • tokenLimitForNewUsers: The token limit for new users.
  • mongoDbUrl: The URL of the MongoDB database.
  • mongoDatabaseName: The name of the MongoDB database.
  • mongoDbCollectionName: The name of the MongoDB collection.

Returns:

  • existingUser: A boolean indicating whether the user ID already exists.

func CreateCollectionRequest

func CreateCollectionRequest(collectionName string, vectorSize uint64, vectorDistance string)

CreateCollectionRequest sends a request to the collection endpoint.

Tags:

  • @displayName: Create Collection

Parameters:

  • collectionName: the name of the collection to create.
  • vectorSize: the length of the vector embeddings
  • vectorDistance: the vector similarity distance algorithm to use for the vector index (cosine, dot, euclid, manhattan)

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 DenyCustomerAccessAndSendWarningMongoDbUserId

func DenyCustomerAccessAndSendWarningMongoDbUserId(userId string, mongoDbUrl string, mongoDatabaseName string, mongoDbCollectionName string) (sendWarning bool)

DenyCustomerAccessAndSendWarningMongoDbUserId denies access to the customer by user ID and sends a warning if necessary.

Tags:

  • @displayName: Deny Customer Access by User ID

Parameters:

  • userId: The user ID 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:

  • 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 GeneralGraphDbQuery

func GeneralGraphDbQuery(query string) []map[string]any

GeneralGraphDbQuery executes the given Cypher query and returns the response.

The function returns the neo4j response.

Tags:

  • @displayName: General Graph DB 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 ParseHistory

func ParseHistory(historyJson string) (history []map[string]string)

ParseHistory this function parses history from json to map

Tags:

  • @displayName: ParseHistory

Parameters:

  • historyJson: history in json format

Returns:

  • history: the parsed history

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 PerformGeneralRequestSpecificModelAndModelOptionsNoStreamWithOpenAiTokenOutput

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

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

Tags:

  • @displayName: General LLM Request (Specific Models, Model Options, 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
  • modelOptions: the model options
  • tokenCountModelName: the model name to use for token count

Returns:

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

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 PrintFeedback

func PrintFeedback(feedback sharedtypes.Feedback)

PrintFeedback prints the feedback to the console in JSON format

Tags:

  • @displayName: Print Feedback

Parameters:

  • feedback: the feedback to print

func QdrantCreateCollection

func QdrantCreateCollection(collectionName string, vectorSize uint64, vectorDistance string)

QdrantCreateCollection creates a collection in qdrant

Tags:

  • @displayName: Create Qdrant Collection

Params:

  • collectionName (string): The name of the collection
  • vectorSize (uint64): The size of the vectors stored in this collection
  • vectorDistance (string): The distance metric to use of vector similarity search (cosine, dot, euclid, manhattan)

func QdrantCreateIndex

func QdrantCreateIndex(collectionName string, fieldName string, fieldType string, wait bool)

QdrantCreateIndex creates a field index on a qdrant collection

Tags:

  • @displayName: Create Qdrant Index

Params:

  • collectionName (string): The name of the collection
  • fieldName (string): The name of the payload field to create an index on
  • fieldType (string): The qdrant type that the payload field is expected to be
  • wait (bool): Whether to wait for the index to be created or return immediately & continue indexing in background

func QdrantInsertData

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

QdrantInsertData inserts data into a collection in qdrant

Tags:

  • @displayName: Insert Data into Qdrant

Params:

  • collectionName (string): The name of the collection
  • data ([]interface{}): The data points to insert (func will fail if elements are not `map[string]any`)
  • idFieldName (string): The name of the field to use as the ID
  • vectorFieldName (string): The name of the field to use as the vector

func RetrieveDependencies

func RetrieveDependencies(
	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:

  • 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,
	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, vectorDistance string)

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.
  • vectorDistance: the distance metric to use for the vector index (cosine, dot, euclid, manhattan)

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, vectorDistance string)

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.
  • vectorDistance: the distance metric to use for the vector index (cosine, dot, euclid, manhattan)

func StoreUserGuideSectionsInGraphDatabase

func StoreUserGuideSectionsInGraphDatabase(sections []sharedtypes.CodeGenerationUserGuideSection)

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, vectorDistance string)

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.
  • vectorDistance: the distance metric to use for the vector index (cosine, dot, euclid, manhattan)

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 SynthesizeActionsTool4

func SynthesizeActionsTool4(instruction string, actions []map[string]string) (updatedActions []map[string]string)

SynthesizeActionsTool4 update action as per user instruction

Tags:

  • @displayName: SynthesizeActionsTool4

Parameters:

  • instruction: the user instruction
  • 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 UpdateTotalTokenCountForUserIdMongoDb

func UpdateTotalTokenCountForUserIdMongoDb(userId string, mongoDbUrl string, mongoDatabaseName string, mongoDbCollectionName string, additionalTokenCount int) (tokenLimitReached bool)

UpdateTotalTokenCountForUserIdMongoDb updates the total token count for the given user ID in the MongoDB database.

Tags:

  • @displayName: Update Total Token Count by User ID

Parameters:

  • userId: The user ID 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.

Types

type ACSSearchRequest

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"`
}

ACSRequest represents the request structure for the Azure Cognitive Search.

type ACSSearchResponseALH

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"`
}

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

type ACSSearchResponseCrtech

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"`
}

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

type ACSSearchResponseLSdyna

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"`
}

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

type ACSSearchResponseStruct

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

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

type ACSSearchResponseStructALH

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

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

type ACSSearchResponseStructCrtech

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

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

type ACSSearchResponseStructLSdyna

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

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

type ACSVectorQuery

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

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

type AppendMessageHistoryRole

type AppendMessageHistoryRole string

type DataExtractionBranch

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

DataExtractionBranch represents the branch structure for the data extraction.

type DataExtractionLLMInputChannelItem

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
}

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

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

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

EmailRequest represents the structure of the POST request body

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

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

MongoDbContext is the structure for the mongodb client

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"`
}

type MongoDbCustomerObjectDisco

type MongoDbCustomerObjectDisco struct {
	UserId          string `bson:"user_id"`
	AccessDenied    bool   `bson:"access_denied"`
	TotalTokenCount int    `bson:"total_token_usage"`
	TokenLimit      int    `bson:"token_limit"`
	WarningSent     bool   `bson:"warning_sent"`
}

type TokenCountUpdateRequest

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

Jump to

Keyboard shortcuts

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