fix(ts-sdk): format Together LLM provider to pass CI
Reformats the Together provider added in #5798 to match the DeepSeek reference and satisfy the `prettier --check .` CI gate: - Collapse manual line-wrapping in together.ts to Prettier style - Add TOGETHER_API_BASE env override + trailing newline (parity with deepseek.ts) - Remove stray leading blank line in factory.ts Closes #5759 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
ab4c76f197
commit
b1418ce93f
@@ -5,20 +5,17 @@ import { LLMResponse } from "./base";
|
|||||||
export class TogetherLLM extends OpenAILLM {
|
export class TogetherLLM extends OpenAILLM {
|
||||||
constructor(config: LLMConfig) {
|
constructor(config: LLMConfig) {
|
||||||
const apiKey = config.apiKey || process.env.TOGETHER_API_KEY;
|
const apiKey = config.apiKey || process.env.TOGETHER_API_KEY;
|
||||||
|
|
||||||
if (!apiKey) {
|
if (!apiKey) {
|
||||||
throw new Error("Together API key is required");
|
throw new Error("Together API key is required");
|
||||||
}
|
}
|
||||||
|
|
||||||
super({
|
super({
|
||||||
...config,
|
...config,
|
||||||
apiKey,
|
apiKey,
|
||||||
baseURL:
|
baseURL:
|
||||||
config.baseURL ||
|
config.baseURL ||
|
||||||
|
process.env.TOGETHER_API_BASE ||
|
||||||
"https://api.together.xyz/v1",
|
"https://api.together.xyz/v1",
|
||||||
model:
|
model: config.model || "mistralai/Mixtral-8x7B-Instruct-v0.1",
|
||||||
config.model ||
|
|
||||||
"mistralai/Mixtral-8x7B-Instruct-v0.1",
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,37 +25,19 @@ export class TogetherLLM extends OpenAILLM {
|
|||||||
tools?: any[],
|
tools?: any[],
|
||||||
): Promise<string | LLMResponse> {
|
): Promise<string | LLMResponse> {
|
||||||
try {
|
try {
|
||||||
return await super.generateResponse(
|
return await super.generateResponse(messages, responseFormat, tools);
|
||||||
messages,
|
|
||||||
responseFormat,
|
|
||||||
tools,
|
|
||||||
);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const message =
|
const message = err instanceof Error ? err.message : String(err);
|
||||||
err instanceof Error
|
throw new Error(`Together LLM failed: ${message}`);
|
||||||
? err.message
|
|
||||||
: String(err);
|
|
||||||
|
|
||||||
throw new Error(
|
|
||||||
`Together LLM failed: ${message}`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async generateChat(
|
async generateChat(messages: Message[]): Promise<LLMResponse> {
|
||||||
messages: Message[],
|
|
||||||
): Promise<LLMResponse> {
|
|
||||||
try {
|
try {
|
||||||
return await super.generateChat(messages);
|
return await super.generateChat(messages);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const message =
|
const message = err instanceof Error ? err.message : String(err);
|
||||||
err instanceof Error
|
throw new Error(`Together LLM failed: ${message}`);
|
||||||
? err.message
|
|
||||||
: String(err);
|
|
||||||
|
|
||||||
throw new Error(
|
|
||||||
`Together LLM failed: ${message}`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import { OpenAIEmbedder } from "../embeddings/openai";
|
import { OpenAIEmbedder } from "../embeddings/openai";
|
||||||
import { OllamaEmbedder } from "../embeddings/ollama";
|
import { OllamaEmbedder } from "../embeddings/ollama";
|
||||||
import { LMStudioEmbedder } from "../embeddings/lmstudio";
|
import { LMStudioEmbedder } from "../embeddings/lmstudio";
|
||||||
|
|||||||
Reference in New Issue
Block a user