File tree 2 files changed +25
-5
lines changed
2 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -146,11 +146,22 @@ export async function generateText({
146
146
147
147
elizaLogger . info ( "Selected model:" , model ) ;
148
148
149
- const temperature = models [ provider ] . settings . temperature ;
150
- const frequency_penalty = models [ provider ] . settings . frequency_penalty ;
151
- const presence_penalty = models [ provider ] . settings . presence_penalty ;
152
- const max_context_length = models [ provider ] . settings . maxInputTokens ;
153
- const max_response_length = models [ provider ] . settings . maxOutputTokens ;
149
+ const modelConfiguration = runtime . character ?. settings ?. modelConfig ;
150
+ const temperature =
151
+ modelConfiguration ?. temperature ||
152
+ models [ provider ] . settings . temperature ;
153
+ const frequency_penalty =
154
+ modelConfiguration ?. frequency_penalty ||
155
+ models [ provider ] . settings . frequency_penalty ;
156
+ const presence_penalty =
157
+ modelConfiguration ?. presence_penalty ||
158
+ models [ provider ] . settings . presence_penalty ;
159
+ const max_context_length =
160
+ modelConfiguration ?. maxInputTokens ||
161
+ models [ provider ] . settings . maxInputTokens ;
162
+ const max_response_length =
163
+ modelConfiguration . max_response_length ||
164
+ models [ provider ] . settings . maxOutputTokens ;
154
165
155
166
const apiKey = runtime . token ;
156
167
Original file line number Diff line number Diff line change @@ -626,6 +626,14 @@ export interface IAgentConfig {
626
626
[ key : string ] : string ;
627
627
}
628
628
629
+ export interface ModelConfiguration {
630
+ temperature ?: number ;
631
+ max_response_length ?: number ;
632
+ frequency_penalty ?: number ;
633
+ presence_penalty ?: number ;
634
+ maxInputTokens ?: number ;
635
+ }
636
+
629
637
/**
630
638
* Configuration for an agent character
631
639
*/
@@ -738,6 +746,7 @@ export type Character = {
738
746
} ;
739
747
} ;
740
748
model ?: string ;
749
+ modelConfig ?: ModelConfiguration ;
741
750
embeddingModel ?: string ;
742
751
chains ?: {
743
752
evm ?: any [ ] ;
You can’t perform that action at this time.
0 commit comments