File tree 2 files changed +22
-2
lines changed
examples/mixture-of-agents
2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 165
165
"GPT-4o Mini" ,
166
166
"Llama 3.1 8B" ,
167
167
"Mixtral 8x7B" ,
168
- ]
168
+ ] ;
169
169
const individualResults = "{{ individual }}" ;
170
170
const aggResults = "{{ summaries }}" ;
171
171
190
190
contentArea . textContent =
191
191
individualResults [ currentLayer ] [ currentIndex ] . trim ( ) ;
192
192
193
- cardTitle . textContent = `${ modelNames [ currentIndex ] } - Layer ${ currentLayer + 1 } ` ;
193
+ cardTitle . textContent = `${ modelNames [ currentIndex ] } - Layer ${ currentLayer + 1 } ` ;
194
194
} else {
195
195
contentArea . textContent = aggResults [ currentLayer ] . trim ( ) ;
196
196
cardTitle . textContent = `MoA Layer ${ currentLayer + 1 } ` ;
Original file line number Diff line number Diff line change @@ -27,12 +27,22 @@ type Configuration = {
27
27
*/
28
28
timeout ?: number ;
29
29
30
+ /**
31
+ * Secrets for third party services.
32
+ */
33
+ secrets ?: Secrets ;
34
+
30
35
/**
31
36
* Add additional headers to each request. These may override headers set by the Substrate client.
32
37
*/
33
38
additionalHeaders ?: Record < string , string > ;
34
39
} ;
35
40
41
+ export type Secrets = {
42
+ openai ?: string ;
43
+ anthropic ?: string ;
44
+ } ;
45
+
36
46
/**
37
47
* [docs/introduction](https://docs.substrate.run)
38
48
*/
@@ -51,6 +61,7 @@ export class Substrate {
51
61
baseUrl,
52
62
apiVersion,
53
63
timeout,
64
+ secrets,
54
65
additionalHeaders,
55
66
} : Configuration ) {
56
67
if ( ! apiKey ) {
@@ -63,6 +74,15 @@ export class Substrate {
63
74
this . apiVersion = apiVersion ?? OpenAPIjson [ "info" ] [ "version" ] ;
64
75
this . timeout = timeout ?? 300_000 ;
65
76
this . additionalHeaders = additionalHeaders ?? { } ;
77
+ if ( secrets ) {
78
+ if ( secrets . openai ) {
79
+ this . additionalHeaders [ "x-substrate-openai-api-key" ] = secrets . openai ;
80
+ }
81
+ if ( secrets . anthropic ) {
82
+ this . additionalHeaders [ "x-substrate-anthropic-api-key" ] =
83
+ secrets . anthropic ;
84
+ }
85
+ }
66
86
}
67
87
68
88
/**
You can’t perform that action at this time.
0 commit comments