@memberjunction/core-entities 2.77.0 → 2.78.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8688,6 +8688,94 @@ exports.AIPromptRunSchema = zod_1.z.object({
8688
8688
  * * SQL Data Type: uniqueidentifier
8689
8689
  * * Related Entity/Foreign Key: MJ: AI Prompt Runs (vwAIPromptRuns.ID)
8690
8690
  * * Description: If this run was initiated as a re-run of another prompt run, this field links back to the original run ID`),
8691
+ ModelSelection: zod_1.z.string().nullable().describe(`
8692
+ * * Field Name: ModelSelection
8693
+ * * Display Name: Model Selection
8694
+ * * SQL Data Type: nvarchar(MAX)
8695
+ * * Description: JSON object containing detailed model selection information including all models considered, their scores, and the selection rationale`),
8696
+ Status: zod_1.z.union([zod_1.z.literal('Pending'), zod_1.z.literal('Running'), zod_1.z.literal('Completed'), zod_1.z.literal('Failed'), zod_1.z.literal('Cancelled')]).describe(`
8697
+ * * Field Name: Status
8698
+ * * Display Name: Status
8699
+ * * SQL Data Type: nvarchar(50)
8700
+ * * Default Value: Pending
8701
+ * * Value List Type: List
8702
+ * * Possible Values
8703
+ * * Pending
8704
+ * * Running
8705
+ * * Completed
8706
+ * * Failed
8707
+ * * Cancelled
8708
+ * * Description: Current execution status of the prompt run. Valid values: Pending, Running, Completed, Failed, Cancelled`),
8709
+ Cancelled: zod_1.z.boolean().describe(`
8710
+ * * Field Name: Cancelled
8711
+ * * Display Name: Cancelled
8712
+ * * SQL Data Type: bit
8713
+ * * Default Value: 0
8714
+ * * Description: Indicates whether this prompt run was cancelled before completion`),
8715
+ CancellationReason: zod_1.z.string().nullable().describe(`
8716
+ * * Field Name: CancellationReason
8717
+ * * Display Name: Cancellation Reason
8718
+ * * SQL Data Type: nvarchar(MAX)
8719
+ * * Description: Detailed reason for cancellation if the prompt run was cancelled. Could be user_requested, timeout, error, or resource_limit`),
8720
+ ModelPowerRank: zod_1.z.number().nullable().describe(`
8721
+ * * Field Name: ModelPowerRank
8722
+ * * Display Name: Model Power Rank
8723
+ * * SQL Data Type: int
8724
+ * * Description: Power rank of the model that was selected for this run. Lower numbers indicate more powerful models`),
8725
+ SelectionStrategy: zod_1.z.union([zod_1.z.literal('Default'), zod_1.z.literal('Specific'), zod_1.z.literal('ByPower')]).nullable().describe(`
8726
+ * * Field Name: SelectionStrategy
8727
+ * * Display Name: Selection Strategy
8728
+ * * SQL Data Type: nvarchar(50)
8729
+ * * Value List Type: List
8730
+ * * Possible Values
8731
+ * * Default
8732
+ * * Specific
8733
+ * * ByPower
8734
+ * * Description: Strategy used for model selection. Valid values: Default (system default), Specific (specific models configured), ByPower (based on power ranking)`),
8735
+ CacheHit: zod_1.z.boolean().describe(`
8736
+ * * Field Name: CacheHit
8737
+ * * Display Name: Cache Hit
8738
+ * * SQL Data Type: bit
8739
+ * * Default Value: 0
8740
+ * * Description: Indicates whether this result was served from cache rather than executing a new model call`),
8741
+ CacheKey: zod_1.z.string().nullable().describe(`
8742
+ * * Field Name: CacheKey
8743
+ * * Display Name: Cache Key
8744
+ * * SQL Data Type: nvarchar(500)
8745
+ * * Description: Unique key used for caching this prompt result, typically a hash of the prompt and parameters`),
8746
+ JudgeID: zod_1.z.string().nullable().describe(`
8747
+ * * Field Name: JudgeID
8748
+ * * Display Name: Judge ID
8749
+ * * SQL Data Type: uniqueidentifier
8750
+ * * Related Entity/Foreign Key: AI Prompts (vwAIPrompts.ID)
8751
+ * * Description: ID of the AIPrompt used as a judge to evaluate and rank multiple parallel execution results`),
8752
+ JudgeScore: zod_1.z.number().nullable().describe(`
8753
+ * * Field Name: JudgeScore
8754
+ * * Display Name: Judge Score
8755
+ * * SQL Data Type: float(53)
8756
+ * * Description: Score assigned by the judge prompt when evaluating multiple results. Higher scores indicate better results`),
8757
+ WasSelectedResult: zod_1.z.boolean().describe(`
8758
+ * * Field Name: WasSelectedResult
8759
+ * * Display Name: Was Selected Result
8760
+ * * SQL Data Type: bit
8761
+ * * Default Value: 0
8762
+ * * Description: Indicates whether this result was selected as the best result when multiple models were run in parallel`),
8763
+ StreamingEnabled: zod_1.z.boolean().describe(`
8764
+ * * Field Name: StreamingEnabled
8765
+ * * Display Name: Streaming Enabled
8766
+ * * SQL Data Type: bit
8767
+ * * Default Value: 0
8768
+ * * Description: Indicates whether streaming was enabled for this prompt execution`),
8769
+ FirstTokenTime: zod_1.z.number().nullable().describe(`
8770
+ * * Field Name: FirstTokenTime
8771
+ * * Display Name: First Token Time
8772
+ * * SQL Data Type: int
8773
+ * * Description: Time in milliseconds from request initiation to receiving the first token from the model`),
8774
+ ErrorDetails: zod_1.z.string().nullable().describe(`
8775
+ * * Field Name: ErrorDetails
8776
+ * * Display Name: Error Details
8777
+ * * SQL Data Type: nvarchar(MAX)
8778
+ * * Description: Detailed error information in JSON format if the prompt execution failed, including stack traces and error codes`),
8691
8779
  Prompt: zod_1.z.string().describe(`
8692
8780
  * * Field Name: Prompt
8693
8781
  * * Display Name: Prompt
@@ -8712,6 +8800,10 @@ exports.AIPromptRunSchema = zod_1.z.object({
8712
8800
  * * Field Name: OriginalModel
8713
8801
  * * Display Name: Original Model
8714
8802
  * * SQL Data Type: nvarchar(50)`),
8803
+ Judge: zod_1.z.string().nullable().describe(`
8804
+ * * Field Name: Judge
8805
+ * * Display Name: Judge
8806
+ * * SQL Data Type: nvarchar(255)`),
8715
8807
  });
8716
8808
  /**
8717
8809
  * zod schema definition for the entity MJ: AI Vendor Type Definitions
@@ -34854,6 +34946,192 @@ let AIPromptRunEntity = class AIPromptRunEntity extends core_1.BaseEntity {
34854
34946
  this.Set('RerunFromPromptRunID', value);
34855
34947
  }
34856
34948
  /**
34949
+ * * Field Name: ModelSelection
34950
+ * * Display Name: Model Selection
34951
+ * * SQL Data Type: nvarchar(MAX)
34952
+ * * Description: JSON object containing detailed model selection information including all models considered, their scores, and the selection rationale
34953
+ */
34954
+ get ModelSelection() {
34955
+ return this.Get('ModelSelection');
34956
+ }
34957
+ set ModelSelection(value) {
34958
+ this.Set('ModelSelection', value);
34959
+ }
34960
+ /**
34961
+ * * Field Name: Status
34962
+ * * Display Name: Status
34963
+ * * SQL Data Type: nvarchar(50)
34964
+ * * Default Value: Pending
34965
+ * * Value List Type: List
34966
+ * * Possible Values
34967
+ * * Pending
34968
+ * * Running
34969
+ * * Completed
34970
+ * * Failed
34971
+ * * Cancelled
34972
+ * * Description: Current execution status of the prompt run. Valid values: Pending, Running, Completed, Failed, Cancelled
34973
+ */
34974
+ get Status() {
34975
+ return this.Get('Status');
34976
+ }
34977
+ set Status(value) {
34978
+ this.Set('Status', value);
34979
+ }
34980
+ /**
34981
+ * * Field Name: Cancelled
34982
+ * * Display Name: Cancelled
34983
+ * * SQL Data Type: bit
34984
+ * * Default Value: 0
34985
+ * * Description: Indicates whether this prompt run was cancelled before completion
34986
+ */
34987
+ get Cancelled() {
34988
+ return this.Get('Cancelled');
34989
+ }
34990
+ set Cancelled(value) {
34991
+ this.Set('Cancelled', value);
34992
+ }
34993
+ /**
34994
+ * * Field Name: CancellationReason
34995
+ * * Display Name: Cancellation Reason
34996
+ * * SQL Data Type: nvarchar(MAX)
34997
+ * * Description: Detailed reason for cancellation if the prompt run was cancelled. Could be user_requested, timeout, error, or resource_limit
34998
+ */
34999
+ get CancellationReason() {
35000
+ return this.Get('CancellationReason');
35001
+ }
35002
+ set CancellationReason(value) {
35003
+ this.Set('CancellationReason', value);
35004
+ }
35005
+ /**
35006
+ * * Field Name: ModelPowerRank
35007
+ * * Display Name: Model Power Rank
35008
+ * * SQL Data Type: int
35009
+ * * Description: Power rank of the model that was selected for this run. Lower numbers indicate more powerful models
35010
+ */
35011
+ get ModelPowerRank() {
35012
+ return this.Get('ModelPowerRank');
35013
+ }
35014
+ set ModelPowerRank(value) {
35015
+ this.Set('ModelPowerRank', value);
35016
+ }
35017
+ /**
35018
+ * * Field Name: SelectionStrategy
35019
+ * * Display Name: Selection Strategy
35020
+ * * SQL Data Type: nvarchar(50)
35021
+ * * Value List Type: List
35022
+ * * Possible Values
35023
+ * * Default
35024
+ * * Specific
35025
+ * * ByPower
35026
+ * * Description: Strategy used for model selection. Valid values: Default (system default), Specific (specific models configured), ByPower (based on power ranking)
35027
+ */
35028
+ get SelectionStrategy() {
35029
+ return this.Get('SelectionStrategy');
35030
+ }
35031
+ set SelectionStrategy(value) {
35032
+ this.Set('SelectionStrategy', value);
35033
+ }
35034
+ /**
35035
+ * * Field Name: CacheHit
35036
+ * * Display Name: Cache Hit
35037
+ * * SQL Data Type: bit
35038
+ * * Default Value: 0
35039
+ * * Description: Indicates whether this result was served from cache rather than executing a new model call
35040
+ */
35041
+ get CacheHit() {
35042
+ return this.Get('CacheHit');
35043
+ }
35044
+ set CacheHit(value) {
35045
+ this.Set('CacheHit', value);
35046
+ }
35047
+ /**
35048
+ * * Field Name: CacheKey
35049
+ * * Display Name: Cache Key
35050
+ * * SQL Data Type: nvarchar(500)
35051
+ * * Description: Unique key used for caching this prompt result, typically a hash of the prompt and parameters
35052
+ */
35053
+ get CacheKey() {
35054
+ return this.Get('CacheKey');
35055
+ }
35056
+ set CacheKey(value) {
35057
+ this.Set('CacheKey', value);
35058
+ }
35059
+ /**
35060
+ * * Field Name: JudgeID
35061
+ * * Display Name: Judge ID
35062
+ * * SQL Data Type: uniqueidentifier
35063
+ * * Related Entity/Foreign Key: AI Prompts (vwAIPrompts.ID)
35064
+ * * Description: ID of the AIPrompt used as a judge to evaluate and rank multiple parallel execution results
35065
+ */
35066
+ get JudgeID() {
35067
+ return this.Get('JudgeID');
35068
+ }
35069
+ set JudgeID(value) {
35070
+ this.Set('JudgeID', value);
35071
+ }
35072
+ /**
35073
+ * * Field Name: JudgeScore
35074
+ * * Display Name: Judge Score
35075
+ * * SQL Data Type: float(53)
35076
+ * * Description: Score assigned by the judge prompt when evaluating multiple results. Higher scores indicate better results
35077
+ */
35078
+ get JudgeScore() {
35079
+ return this.Get('JudgeScore');
35080
+ }
35081
+ set JudgeScore(value) {
35082
+ this.Set('JudgeScore', value);
35083
+ }
35084
+ /**
35085
+ * * Field Name: WasSelectedResult
35086
+ * * Display Name: Was Selected Result
35087
+ * * SQL Data Type: bit
35088
+ * * Default Value: 0
35089
+ * * Description: Indicates whether this result was selected as the best result when multiple models were run in parallel
35090
+ */
35091
+ get WasSelectedResult() {
35092
+ return this.Get('WasSelectedResult');
35093
+ }
35094
+ set WasSelectedResult(value) {
35095
+ this.Set('WasSelectedResult', value);
35096
+ }
35097
+ /**
35098
+ * * Field Name: StreamingEnabled
35099
+ * * Display Name: Streaming Enabled
35100
+ * * SQL Data Type: bit
35101
+ * * Default Value: 0
35102
+ * * Description: Indicates whether streaming was enabled for this prompt execution
35103
+ */
35104
+ get StreamingEnabled() {
35105
+ return this.Get('StreamingEnabled');
35106
+ }
35107
+ set StreamingEnabled(value) {
35108
+ this.Set('StreamingEnabled', value);
35109
+ }
35110
+ /**
35111
+ * * Field Name: FirstTokenTime
35112
+ * * Display Name: First Token Time
35113
+ * * SQL Data Type: int
35114
+ * * Description: Time in milliseconds from request initiation to receiving the first token from the model
35115
+ */
35116
+ get FirstTokenTime() {
35117
+ return this.Get('FirstTokenTime');
35118
+ }
35119
+ set FirstTokenTime(value) {
35120
+ this.Set('FirstTokenTime', value);
35121
+ }
35122
+ /**
35123
+ * * Field Name: ErrorDetails
35124
+ * * Display Name: Error Details
35125
+ * * SQL Data Type: nvarchar(MAX)
35126
+ * * Description: Detailed error information in JSON format if the prompt execution failed, including stack traces and error codes
35127
+ */
35128
+ get ErrorDetails() {
35129
+ return this.Get('ErrorDetails');
35130
+ }
35131
+ set ErrorDetails(value) {
35132
+ this.Set('ErrorDetails', value);
35133
+ }
35134
+ /**
34857
35135
  * * Field Name: Prompt
34858
35136
  * * Display Name: Prompt
34859
35137
  * * SQL Data Type: nvarchar(255)
@@ -34901,6 +35179,14 @@ let AIPromptRunEntity = class AIPromptRunEntity extends core_1.BaseEntity {
34901
35179
  get OriginalModel() {
34902
35180
  return this.Get('OriginalModel');
34903
35181
  }
35182
+ /**
35183
+ * * Field Name: Judge
35184
+ * * Display Name: Judge
35185
+ * * SQL Data Type: nvarchar(255)
35186
+ */
35187
+ get Judge() {
35188
+ return this.Get('Judge');
35189
+ }
34904
35190
  };
34905
35191
  exports.AIPromptRunEntity = AIPromptRunEntity;
34906
35192
  exports.AIPromptRunEntity = AIPromptRunEntity = __decorate([
@@ -36927,6 +37213,41 @@ let QueryEntity = class QueryEntity extends core_1.BaseEntity {
36927
37213
  return await super.InnerLoad(compositeKey, EntityRelationshipsToLoad);
36928
37214
  }
36929
37215
  /**
37216
+ * Queries - Delete method override to wrap in transaction since CascadeDeletes is true.
37217
+ * Wrapping in a transaction ensures that all cascade delete operations are handled atomically.
37218
+ * @public
37219
+ * @method
37220
+ * @override
37221
+ * @memberof QueryEntity
37222
+ * @returns {Promise<boolean>} - true if successful, false otherwise
37223
+ */
37224
+ async Delete(options) {
37225
+ if (core_1.Metadata.Provider.ProviderType === core_1.ProviderType.Database) {
37226
+ // For database providers, use the transaction methods directly
37227
+ const provider = core_1.Metadata.Provider;
37228
+ try {
37229
+ await provider.BeginTransaction();
37230
+ const result = await super.Delete(options);
37231
+ if (result) {
37232
+ await provider.CommitTransaction();
37233
+ return true;
37234
+ }
37235
+ else {
37236
+ await provider.RollbackTransaction();
37237
+ return false;
37238
+ }
37239
+ }
37240
+ catch (error) {
37241
+ await provider.RollbackTransaction();
37242
+ throw error;
37243
+ }
37244
+ }
37245
+ else {
37246
+ // For network providers, cascading deletes are handled server-side
37247
+ return super.Delete(options);
37248
+ }
37249
+ }
37250
+ /**
36930
37251
  * * Field Name: ID
36931
37252
  * * Display Name: ID
36932
37253
  * * SQL Data Type: uniqueidentifier