Skip to content

Commit 7a512bc

Browse files
committed
fix build
1 parent 5200770 commit 7a512bc

File tree

17 files changed

+86
-20
lines changed

17 files changed

+86
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "fluent-ai",
33
"description": "A lightweight AI toolkit for multiple platforms",
4-
"version": "0.4.0-beta.1",
4+
"version": "0.3.0",
55
"type": "module",
66
"main": "./dist/index.cjs",
77
"module": "./dist/index.js",

src/jobs/builder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export abstract class JobBuilder<Job extends BaseJob> {
2323

2424
abstract makeRequest(): Request;
2525
abstract handleResponse(
26-
response: Response,
26+
response: Response
2727
): Promise<Job["output"] | AsyncGenerator<Job["output"]>>;
2828

2929
async run(): Promise<Job["output"] | AsyncGenerator<Job["output"]>> {
@@ -38,7 +38,7 @@ export abstract class JobBuilder<Job extends BaseJob> {
3838
throw new HTTPError(
3939
`Fetch error: ${response.statusText}`,
4040
response.status,
41-
json,
41+
json
4242
);
4343
}
4444
return await this.handleResponse!(response);

src/jobs/chat/builder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type {
99
import type { ChatTool } from "./tool";
1010

1111
export abstract class ChatJobBuilder<
12-
Job extends ChatJob,
12+
Job extends ChatJob
1313
> extends JobBuilder<Job> {
1414
input: Job["input"];
1515

src/jobs/chat/schema.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const MessageContentSchema = z.union([
77
z.object({
88
type: z.literal("text"),
99
text: z.string(),
10-
}),
10+
})
1111
),
1212
z.array(
1313
z.object({
@@ -25,7 +25,7 @@ export const MessageContentSchema = z.union([
2525
]),
2626
})
2727
.optional(),
28-
}),
28+
})
2929
),
3030
]);
3131

@@ -118,14 +118,13 @@ export const ChatOutputSchema = z.object({
118118
message: AIMessageSchema.optional(),
119119
raw: z.any().optional(),
120120
});
121+
121122
export const ChatJobSchema = BaseJobSchema.extend({
122123
type: z.literal("chat"),
123124
input: ChatInputSchema,
124125
output: ChatOutputSchema.optional(),
125126
});
126127

127128
export type ChatJob = z.infer<typeof ChatJobSchema>;
128-
129129
export type ChatInput = z.infer<typeof ChatInputSchema>;
130-
131130
export type ChatOutput = z.infer<typeof ChatOutputSchema>;

src/jobs/schema.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ export const JobCostSchema = z.object({
3333

3434
export const JobPerformance = z.object({});
3535

36-
export type JobCost = z.infer<typeof JobCostSchema>;
37-
38-
export type JobPerformance = z.infer<typeof JobPerformance>;
39-
4036
export const BaseJobSchema = z.object({
4137
version: z.string().optional(),
4238
provider: JobProviderSchema,
@@ -48,6 +44,9 @@ export const BaseJobSchema = z.object({
4844
performance: JobPerformance.optional(),
4945
});
5046

47+
export type JobCost = z.infer<typeof JobCostSchema>;
48+
export type JobPerformance = z.infer<typeof JobPerformance>;
49+
export type BaseJob = z.infer<typeof BaseJobSchema>;
5150
export type JobProvider = z.infer<typeof JobProviderSchema>;
5251
export type JobType = z.infer<typeof JobTypeSchema>;
5352
export type JobOptions = z.infer<typeof JobOptionsSchema>;

src/jobs/speech/builder.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { JobBuilder } from "~/jobs/builder";
2-
import type { SpeechInput, SpeechOutput } from "./schema";
2+
import type { SpeechJob } from "./schema";
33

4-
export class SpeechJobBuilder extends JobBuilder<SpeechInput, SpeechOutput> {
5-
input: SpeechInput;
4+
export abstract class SpeechJobBuilder<
5+
Job extends SpeechJob
6+
> extends JobBuilder<Job> {
7+
input: Job["input"];
68

79
constructor(model: string) {
810
super();

src/jobs/speech/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ export const SpeechJobSchema = BaseJobSchema.extend({
1313
output: SpeechOutputSchema.optional(),
1414
});
1515

16+
export type SpeechJob = z.infer<typeof SpeechJobSchema>;
1617
export type SpeechInput = z.infer<typeof SpeechInputSchema>;
1718
export type SpeechOutput = z.infer<typeof SpeechOutputSchema>;

src/providers/anthropic/schema.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ export const AnthropicJobSchema = z.discriminatedUnion("type", [
1818
AnthropicChatJobSchema,
1919
AnthropicModelsJobSchema,
2020
]);
21+
22+
export type AnthropicJob = z.infer<typeof AnthropicJobSchema>;
23+
export type AnthropicChatJob = z.infer<typeof AnthropicChatJobSchema>;
24+
export type AnthropicModelsJob = z.infer<typeof AnthropicModelsJobSchema>;

src/providers/elevenlabs/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,21 @@ export function elevenlabs(options?: JobOptions) {
1313
};
1414
}
1515

16-
class ElevenlabsSpeechJobBuilder extends SpeechJobBuilder {
16+
class ElevenlabsSpeechJobBuilder extends SpeechJobBuilder<ElevenlabsSpeechJob> {
1717
constructor(options: JobOptions, model: string) {
1818
super(model);
1919
this.provider = "elevenlabs";
2020
this.options = options;
2121
}
22+
23+
makeRequest() {
24+
return new Request("https://api.elevenlabs.io/v1/text-to-speech", {});
25+
}
26+
27+
async handleResponse(response: Response) {
28+
const raw = await response.json();
29+
return { raw };
30+
}
2231
}
2332

2433
export const ElevenlabsBaseJobSchema = z.object({
@@ -32,3 +41,6 @@ export const ElevenlabsSpeechJobSchema = SpeechJobSchema.extend(
3241
export const ElevenlabsJobSchema = z.discriminatedUnion("type", [
3342
ElevenlabsSpeechJobSchema,
3443
]);
44+
45+
export type ElevenlabsJob = z.infer<typeof ElevenlabsJobSchema>;
46+
export type ElevenlabsSpeechJob = z.infer<typeof ElevenlabsSpeechJobSchema>;

src/providers/fal/schema.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ export const FalBaseJobSchema = z.object({
88
export const FalImageJobSchema = ImageJobSchema.extend(FalBaseJobSchema);
99

1010
export const FalJobSchema = z.discriminatedUnion("type", [FalImageJobSchema]);
11+
12+
export type FalJob = z.infer<typeof FalJobSchema>;
13+
export type FalImageJob = z.infer<typeof FalImageJobSchema>;

0 commit comments

Comments
 (0)