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:
@@ -5,20 +5,17 @@ import { LLMResponse } from "./base";
|
||||
export class TogetherLLM extends OpenAILLM {
|
||||
constructor(config: LLMConfig) {
|
||||
const apiKey = config.apiKey || process.env.TOGETHER_API_KEY;
|
||||
|
||||
if (!apiKey) {
|
||||
throw new Error("Together API key is required");
|
||||
}
|
||||
|
||||
super({
|
||||
...config,
|
||||
apiKey,
|
||||
baseURL:
|
||||
config.baseURL ||
|
||||
process.env.TOGETHER_API_BASE ||
|
||||
"https://api.together.xyz/v1",
|
||||
model:
|
||||
config.model ||
|
||||
"mistralai/Mixtral-8x7B-Instruct-v0.1",
|
||||
model: config.model || "mistralai/Mixtral-8x7B-Instruct-v0.1",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,37 +25,19 @@ export class TogetherLLM extends OpenAILLM {
|
||||
tools?: any[],
|
||||
): Promise<string | LLMResponse> {
|
||||
try {
|
||||
return await super.generateResponse(
|
||||
messages,
|
||||
responseFormat,
|
||||
tools,
|
||||
);
|
||||
return await super.generateResponse(messages, responseFormat, tools);
|
||||
} catch (err) {
|
||||
const message =
|
||||
err instanceof Error
|
||||
? err.message
|
||||
: String(err);
|
||||
|
||||
throw new Error(
|
||||
`Together LLM failed: ${message}`,
|
||||
);
|
||||
const message = err instanceof Error ? err.message : String(err);
|
||||
throw new Error(`Together LLM failed: ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
async generateChat(
|
||||
messages: Message[],
|
||||
): Promise<LLMResponse> {
|
||||
async generateChat(messages: Message[]): Promise<LLMResponse> {
|
||||
try {
|
||||
return await super.generateChat(messages);
|
||||
} catch (err) {
|
||||
const message =
|
||||
err instanceof Error
|
||||
? err.message
|
||||
: String(err);
|
||||
|
||||
throw new Error(
|
||||
`Together LLM failed: ${message}`,
|
||||
);
|
||||
const message = err instanceof Error ? err.message : String(err);
|
||||
throw new Error(`Together LLM failed: ${message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import { OpenAIEmbedder } from "../embeddings/openai";
|
||||
import { OllamaEmbedder } from "../embeddings/ollama";
|
||||
import { LMStudioEmbedder } from "../embeddings/lmstudio";
|
||||
|
||||
Reference in New Issue
Block a user