Skip to content

Commit

Permalink
feat: core changes of chat vs chatCompletion methods, chatCompletion …
Browse files Browse the repository at this point in the history
…now serve as Socratic Tutors and can be sent set of messages, added new models, updated model-map, updated Readme.md file
  • Loading branch information
SchnapsterDog committed Jan 18, 2024
1 parent b91b3b1 commit d3c6784
Show file tree
Hide file tree
Showing 9 changed files with 8,891 additions and 15,756 deletions.
117 changes: 88 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,27 @@ To access the `chat`, and `chatCompletion` methods in the nuxt-chatgpt module, y

| Name | Type | Default | Description |
|--|--|--|--|
|**message**|`String`||A string representing the text message that you want to send to the GPT model for processing.
|**message**|`String`|available only for `chat()`|A string representing the text message that you want to send to the GPT model for processing.
|**messages**|`Array`|available only for `chatCompletion()`|An array of objects that contains `role` and `content`
|**model**|`String`|`text-davinci-003` for `chat()` and `gpt-3.5-turbo` for `chatCompletion()`|Represent certain model for different types of natural language processing tasks.
|**options**|`Object`|`{ temperature: 0.5, max_tokens: 2048, top_p: 1 frequency_penalty: 0, presence_penalty: 0 }`|An optional object that specifies any additional options you want to pass to the API request, such as the number of responses to generate, and the maximum length of each response.

Available models for `chat`
Available models:

- text-davinci-003
- text-davinci-002

Available models for `chatCompletion`

- text-davinci-003
- gpt-3.5-turbo
- gpt-3.5-turbo-0301

You need to join waitlist to use gpt-4 models within `chatCompletion` method

- gpt-3.5-turbo-1106
- gpt-4
- gpt-4-1106-preview
- gpt-4-0314
- gpt-4-0613
- gpt-4-32k
- gpt-4-32k-0314
- gpt-4-32k-0613

You need to join waitlist to use gpt-4 models within `chatCompletion` method

### Simple `chat` usage
In the following example, the model is unspecified, and the text-davinci-003 model will be used by default.
Expand All @@ -88,19 +89,23 @@ In the following example, the model is unspecified, and the text-davinci-003 mod
const { chat } = useChatgpt()

const data = ref('')
const message = ref('')
const inputData = ref('')

async function sendMessage() {
const response = await chat(message.value)
data.value = response
try {
const response = await chat(inputData.value)
data.value = response
} catch(error) {
alert(`Join the waiting list if you want to use GPT-4 models: ${error}`)
}
}

```

```html
<template>
<div>
<input v-model="message">
<input v-model="inputData">
<button
@click="sendMessage"
v-text="'Send'"
Expand All @@ -116,19 +121,23 @@ async function sendMessage() {
const { chat } = useChatgpt()

const data = ref('')
const message = ref('')
const inputData = ref('')

async function sendMessage() {
const response = await chat(message.value, 'text-davinci-002')
data.value = response
try {
const response = await chat(inputData.value, 'gpt-3.5-turbo')
data.value = response
} catch(error) {
alert(`Join the waiting list if you want to use GPT-4 models: ${error}`)
}
}

```

```html
<template>
<div>
<input v-model="message">
<input v-model="inputData">
<button
@click="sendMessage"
v-text="'Send'"
Expand All @@ -144,25 +153,50 @@ In the following example, the model is unspecified, and the gpt-3.5-turbo model
```js
const { chatCompletion } = useChatgpt()

const data = ref('')
const message = ref('')
const chatTree = ref([])
const inputData = ref('')

async function sendMessage() {
const response = await chatCompletion(message.value)
data.value = response
try {
const message = {
role: 'user',
content: `${inputData.value}`,
}

chatTree.value.push(message)

const response = await chatCompletion(chatTree.value)

const responseMessage = {
role: response[0].message.role,
content: response[0].message.content
}

chatTree.value.push(responseMessage)
} catch(error) {
alert(`Join the waiting list if you want to use GPT-4 models: ${error}`)
}
}

```

```html
<template>
<div>
<input v-model="message">
<input v-model="inputData">
<button
@click="sendMessage"
v-text="'Send'"
/>
<div>{{ data }}</div>
<div>
<div
v-for="chat in chatTree"
:key="chat"
>
<strong>{{ chat.role }} :</strong>
<div>{{ chat.content }} </div>
</div>
</div>
</div>
</template>
```
Expand All @@ -172,25 +206,50 @@ async function sendMessage() {
```js
const { chatCompletion } = useChatgpt()

const data = ref('')
const message = ref('')
const chatTree = ref([])
const inputData = ref('')

async function sendMessage() {
const response = await chatCompletion(message.value, 'gpt-3.5-turbo-0301')
data.value = response
try {
const message = {
role: 'user',
content: `${inputData.value}`,
}

chatTree.value.push(message)

const response = await chatCompletion(chatTree.value, 'gpt-3.5-turbo-0301')

const responseMessage = {
role: response[0].message.role,
content: response[0].message.content
}

chatTree.value.push(responseMessage)
} catch(error) {
alert(`Join the waiting list if you want to use GPT-4 models: ${error}`)
}
}

```

```html
<template>
<div>
<input v-model="message">
<input v-model="inputData">
<button
@click="sendMessage"
v-text="'Send'"
/>
<div>{{ data }}</div>
<div>
<div
v-for="chat in chatTree"
:key="chat"
>
<strong>{{ chat.role }} :</strong>
<div>{{ chat.content }} </div>
</div>
</div>
</div>
</template>
```
Expand Down

0 comments on commit d3c6784

Please sign in to comment.