Skip to content

Commit

Permalink
Fix references.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgrammel committed Dec 28, 2023
1 parent 1a4cfd7 commit b159809
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 33 deletions.
10 changes: 4 additions & 6 deletions examples/basic/src/util/cost/embed-cost-calculation-example.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import dotenv from "dotenv";
import { DefaultRun, embed, embedMany, openai } from "modelfusion";
import {
DefaultRun,
OpenAICostCalculator,
calculateCost,
embed,
embedMany,
openai,
} from "modelfusion";
extractSuccessfulModelCalls,
} from "modelfusion-experimental";

dotenv.config();

Expand All @@ -29,7 +27,7 @@ async function main() {
);

const cost = await calculateCost({
calls: run.successfulModelCalls,
calls: extractSuccessfulModelCalls(run.events),
costCalculators: [new OpenAICostCalculator()],
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import dotenv from "dotenv";
import { DefaultRun, generateImage, openai } from "modelfusion";
import {
DefaultRun,
OpenAICostCalculator,
calculateCost,
generateImage,
openai,
} from "modelfusion";
extractSuccessfulModelCalls,
} from "modelfusion-experimental";

dotenv.config();

Expand All @@ -23,7 +22,7 @@ async function main() {
);

const cost = await calculateCost({
calls: run.successfulModelCalls,
calls: extractSuccessfulModelCalls(run.events),
costCalculators: [new OpenAICostCalculator()],
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import dotenv from "dotenv";
import { DefaultRun, generateSpeech, openai } from "modelfusion";
import {
DefaultRun,
OpenAICostCalculator,
calculateCost,
generateSpeech,
openai,
} from "modelfusion";
extractSuccessfulModelCalls,
} from "modelfusion-experimental";

dotenv.config();

Expand All @@ -25,7 +24,7 @@ async function main() {
);

const cost = await calculateCost({
calls: run.successfulModelCalls,
calls: extractSuccessfulModelCalls(run.events),
costCalculators: [new OpenAICostCalculator()],
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import dotenv from "dotenv";
import { DefaultRun, generateText, openai } from "modelfusion";
import {
DefaultRun,
OpenAICostCalculator,
calculateCost,
generateText,
openai,
} from "modelfusion";
extractSuccessfulModelCalls,
} from "modelfusion-experimental";

dotenv.config();

Expand All @@ -25,7 +24,7 @@ async function main() {
console.log(text);

const cost = await calculateCost({
calls: run.successfulModelCalls,
calls: extractSuccessfulModelCalls(run.events),
costCalculators: [new OpenAICostCalculator()],
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import dotenv from "dotenv";
import { DefaultRun, generateTranscription, openai } from "modelfusion";
import {
DefaultRun,
OpenAICostCalculator,
calculateCost,
generateTranscription,
openai,
} from "modelfusion";
extractSuccessfulModelCalls,
} from "modelfusion-experimental";
import fs from "node:fs";

dotenv.config();
Expand All @@ -24,7 +23,7 @@ async function main() {
console.log(transcription);

const cost = await calculateCost({
calls: run.successfulModelCalls,
calls: extractSuccessfulModelCalls(run.events),
costCalculators: [new OpenAICostCalculator()],
});

Expand Down
1 change: 1 addition & 0 deletions examples/chatbot-next-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@mui/icons-material": "5.11.16",
"@mui/material": "5.12.2",
"modelfusion": "0.105.0",
"modelfusion-experimental": "0.1.0",
"next": "13.5.1",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/chatbot-next-js/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ChatInputArea } from "@/component/ChatInputArea";
import { ChatMessageView } from "@/component/ChatMessageView";
import { ChatMessageInput } from "@/component/ChatMessageInput";
import { ChatMessageView } from "@/component/ChatMessageView";
import { Box, Button } from "@mui/material";
import { zodSchema } from "modelfusion";
import { readEventSourceStream } from "modelfusion/browser";
import { readEventSourceStream } from "modelfusion-experimental/browser";
import Head from "next/head";
import { useEffect, useRef, useState } from "react";
import { z } from "zod";
Expand Down
8 changes: 4 additions & 4 deletions examples/pdf-to-tweet/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Command } from "commander";
import dotenv from "dotenv";
import { DefaultRun, withRun } from "modelfusion";
import {
DefaultRun,
OpenAICostCalculator,
calculateCost,
withRun,
} from "modelfusion";
extractSuccessfulModelCalls,
} from "modelfusion-experimental";
import { createTweetFromPdf } from "./createTweetFromPdf";

dotenv.config();
Expand Down Expand Up @@ -56,7 +56,7 @@ withRun(run, async () => {
})
.then(async (result) => {
const cost = await calculateCost({
calls: run.successfulModelCalls,
calls: extractSuccessfulModelCalls(run.events),
costCalculators: [new OpenAICostCalculator()],
});

Expand Down
12 changes: 12 additions & 0 deletions packages/modelfusion-experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changelog

## v0.2.0 - 2023-12-28

Initial release. Moved from ModelFusion:

- browser helpers
- composed functions (summarize)
- cost calculation
- guard function
- flow concept
- Fastify server helpers
9 changes: 9 additions & 0 deletions packages/modelfusion-experimental/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ModelFusion Experimental

Experimental [ModelFusion](https://modelfusion.dev) features.

## Installation

```sh
npm i modelfusion-experimental
```
4 changes: 3 additions & 1 deletion packages/modelfusion-experimental/src/cost/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export * from "./Cost.js";
export * from "./calculateCost.js";
export * from "./CostCalculator.js";
export * from "./SuccessfulModelCall.js";
export * from "./calculateCost.js";
export * from "./openai/OpenAICostCalculator.js";
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b159809

Please sign in to comment.