diff --git a/examples/mixture-of-agents/index.html b/examples/mixture-of-agents/index.html index a35d275..e971b73 100644 --- a/examples/mixture-of-agents/index.html +++ b/examples/mixture-of-agents/index.html @@ -165,7 +165,7 @@ "GPT-4o Mini", "Llama 3.1 8B", "Mixtral 8x7B", - ] + ]; const individualResults = "{{ individual }}"; const aggResults = "{{ summaries }}"; @@ -190,7 +190,7 @@ contentArea.textContent = individualResults[currentLayer][currentIndex].trim(); - cardTitle.textContent = `${modelNames[currentIndex]} - Layer ${ currentLayer + 1 }`; + cardTitle.textContent = `${modelNames[currentIndex]} - Layer ${currentLayer + 1}`; } else { contentArea.textContent = aggResults[currentLayer].trim(); cardTitle.textContent = `MoA Layer ${currentLayer + 1}`; diff --git a/src/Substrate.ts b/src/Substrate.ts index e123c9f..4ecb6cc 100644 --- a/src/Substrate.ts +++ b/src/Substrate.ts @@ -27,12 +27,22 @@ type Configuration = { */ timeout?: number; + /** + * Secrets for third party services. + */ + secrets?: Secrets; + /** * Add additional headers to each request. These may override headers set by the Substrate client. */ additionalHeaders?: Record; }; +export type Secrets = { + openai?: string; + anthropic?: string; +}; + /** * [docs/introduction](https://docs.substrate.run) */ @@ -51,6 +61,7 @@ export class Substrate { baseUrl, apiVersion, timeout, + secrets, additionalHeaders, }: Configuration) { if (!apiKey) { @@ -63,6 +74,15 @@ export class Substrate { this.apiVersion = apiVersion ?? OpenAPIjson["info"]["version"]; this.timeout = timeout ?? 300_000; this.additionalHeaders = additionalHeaders ?? {}; + if (secrets) { + if (secrets.openai) { + this.additionalHeaders["x-substrate-openai-api-key"] = secrets.openai; + } + if (secrets.anthropic) { + this.additionalHeaders["x-substrate-anthropic-api-key"] = + secrets.anthropic; + } + } } /**