Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple messages (context window) to be passed #1146

Merged
merged 10 commits into from
Nov 30, 2023

Conversation

CodingDive
Copy link
Contributor

Context window will be built by the frontend for now. Eventually, we'll be able to migrate to the assistance API https://platform.openai.com/docs/assistants/how-it-works/creating-assistants

packages/server/src/model/ai.ts Outdated Show resolved Hide resolved
@@ -40,28 +44,23 @@ export async function executePrompt(args: {

const response = await openai.chat.completions.create({
model: 'gpt-4-1106-preview',
messages: [
{
role: 'user',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the name for the session?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which one?
The model is gpt-4-turbo. The session and context window will get built by the client so the session name is implict

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another question: What is the purpose of role in the API?

Copy link
Contributor Author

@CodingDive CodingDive Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To define system prompts vs. user prompts.

packages/server/src/schema/ai/resolvers.ts Outdated Show resolved Hide resolved
packages/server/src/schema/ai/resolvers.ts Outdated Show resolved Hide resolved
packages/server/src/schema/ai/resolvers.ts Outdated Show resolved Hide resolved
CodingDive and others added 4 commits November 30, 2023 07:57
Co-authored-by: Stephan Kulla <git.mail@kulla.me>
Co-authored-by: Stephan Kulla <git.mail@kulla.me>
Co-authored-by: Stephan Kulla <git.mail@kulla.me>

const record = await dataSources.model.serlo.executePrompt({
...payload,
messages: messages as OpenAIMessages,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a nicer way @kulla?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, quite simple see 41d958c

* Check for any empty message
* KISS
@CodingDive CodingDive requested a review from kulla November 30, 2023 14:36
@kulla kulla enabled auto-merge November 30, 2023 15:14
@kulla kulla added this pull request to the merge queue Nov 30, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 30, 2023
@CodingDive CodingDive enabled auto-merge November 30, 2023 15:24
@CodingDive CodingDive added this pull request to the merge queue Nov 30, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 30, 2023
@kulla kulla added this pull request to the merge queue Nov 30, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 30, 2023
@kulla kulla added this pull request to the merge queue Nov 30, 2023
Merged via the queue into main with commit c5a96b9 Nov 30, 2023
9 checks passed
@kulla kulla deleted the refactor/allow-context-window-for-ai-feature branch November 30, 2023 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants