Skip to content

Commit

Permalink
fix: tslinting content
Browse files Browse the repository at this point in the history
  • Loading branch information
fbatiga committed May 9, 2023
1 parent fa6b698 commit 0d4a8bd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,20 @@ npm run chat
yarn chat
```

you can also choose your model

```
npm run chat <model name>
```

Eg

```
npm run chat gpt4
# or
npm run chat <mycustom trained model>
```

You will be prompted to enter your message or question. Type your input and press Enter to receive a response from the AI-powered language model.

You can also fine tune
Expand Down
3 changes: 2 additions & 1 deletion src/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { chatWithGPT } from './services/openai.ts';
import getDb from './services/db.ts';
import { getUserInput } from './services/utils.ts';

let model = process.argv[2] || 'gpt-3.5-turbo';
prompt.start();

const chat = async () => {
Expand Down Expand Up @@ -33,7 +34,7 @@ const chat = async () => {
// Call your chat function here, for example:
spinner.start();
// eslint-disable-next-line no-await-in-loop
const response = await chatWithGPT(userInput as string, context);
const response = await chatWithGPT(userInput as string, context, model);
spinner.stop();
context.push({
role: 'user', content: userInput
Expand Down
3 changes: 2 additions & 1 deletion src/services/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const openai = new OpenAIApi(configuration);
export async function chatWithGPT(
message: string,
context = [],
model?:string = 'gpt-3.5-turbo',
): Promise<string> {
try {
console.log('Sending message to GPT:', [
Expand All @@ -29,7 +30,7 @@ export async function chatWithGPT(
},
]);
const response = await openai.createChatCompletion({
model: 'gpt-3.5-turbo',
model,
messages: [...context, {
role: 'user', content: message
}],
Expand Down

0 comments on commit 0d4a8bd

Please sign in to comment.