Skip to content

Commit

Permalink
remove AISdkClient logger
Browse files Browse the repository at this point in the history
  • Loading branch information
sameelarif committed Jan 7, 2025
1 parent c42275b commit bbcb83e
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions examples/external_clients/aisdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,24 @@ import {
TextPart,
} from "ai";
import { ChatCompletion } from "openai/resources/chat/completions";
import { ChatCompletionOptions, LLMClient } from "../../lib/llm/LLMClient";
import type { LogLine } from "../../types/log";
import {
CreateChatCompletionOptions,
LLMClient,
} from "../../lib/llm/LLMClient";
import { AvailableModel } from "../../types/model";

export class AISdkClient extends LLMClient {
public type = "aisdk" as const;
public logger: (message: LogLine) => void;
private model: LanguageModel;

constructor({
logger,
model,
}: {
logger?: (message: LogLine) => void;
model: LanguageModel;
}) {
constructor({ model }: { model: LanguageModel }) {
super(model.modelId as AvailableModel);
this.logger = logger;
this.model = model;
}

async createChatCompletion<T = ChatCompletion>(
options: ChatCompletionOptions,
): Promise<T> {
async createChatCompletion<T = ChatCompletion>({
options,
}: CreateChatCompletionOptions): Promise<T> {
const formattedMessages: CoreMessage[] = options.messages.map((message) => {
if (Array.isArray(message.content)) {
if (message.role === "system") {
Expand Down

0 comments on commit bbcb83e

Please sign in to comment.