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

chore(model): update chat_history schema to align with OpenAI message field #481

Merged
merged 13 commits into from
Jan 8, 2024

Conversation

tonywang10101
Copy link
Contributor

Because ...

  • This update is necessitated by the need to align our current text-generation-task schema more closely with OpenAI's task structure.

This commit ...

  1. Enhancement of TASK_TEXT_GENERATION: Following our discussion in INS-2982, we have introduced three new fields to the TASK_TEXT_GENERATION protocol buffer:

    • An optional system_message string.
    • An optional chat_history field, now mirroring the type used in conversation.
    • An optional image_url string, which is a base64 encoded string including batch dimension.
  2. Improved extra_param Support: To offer enhanced functionality for the extra_param, we have implemented the suggestions in INS-2954.

  3. This PR is based on the basis PR-243 and made some modifications to the chat_history field to align with the OpenAI message field

Based on information provided by Xiaofei, following are patterns of OpenAI message field:

[
    {
        "role": "...", // user, system, assistant
        "content": [...]
    }
]

And inside content:
If it is a text

  {
     "type": "text",
     "text": "What's in this image?"
  },

if it is an image

{
    "type": "image_url",
    "image_url": {
       "url": "< url or base64 >"
    }
}

reference to this slack thread to get more informations

tonywang10101 and others added 9 commits December 21, 2023 08:47
…Standards (#479)

Because ... 

- This update is necessitated by the need to align our current
text-generation-task schema more closely with OpenAI's task structure.

This commit .. 

1. **Enhancement of TASK_TEXT_GENERATION**: Following our discussion in
[INS-2982](https://linear.app/instill-ai/issue/INS-2982/harmonizing-the-text-generation-tasks-protocol-buffer-with-the-openai),
we have introduced three new fields to the `TASK_TEXT_GENERATION`
protocol buffer:
   - An optional `system_message` string.
- An optional `chat_history` field, now mirroring the type used in
`conversation`.
- An optional `image_url` string, which is a base64 encoded string
including batch dimension.

2. **Improved `extra_param` Support**: To offer enhanced functionality
for the `extra_param`, we have implemented the suggestions in
[INS-2954](https://linear.app/instill-ai/issue/INS-2954/improve-param-value-filed-type).

3. **Protobuf Structure Update**: In line with the recent
[commit](instill-ai/protobufs@61c3ca8)
to our protobuf repository, we have migrated the `model owner` and `org`
fields to a new unified `owner` field, ensuring consistency across our
models.


Related changes

- [protobuf PR](instill-ai/protobufs#243). After
this PR merged, we needs to update go mod here
- SDK (WIP)
Because

- We need to standardize the naming convention of customized headers

This commit

- replace `Jwt-Sub` with `Instill-User-Uid`
Copy link

codecov bot commented Dec 29, 2023

Codecov Report

Attention: 234 lines in your changes are missing coverage. Please review.

Comparison is base (78b1aa3) 0.91% compared to head (7b0c057) 0.89%.

Files Patch % Lines
pkg/handler/payload.go 0.00% 234 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #481      +/-   ##
========================================
- Coverage   0.91%   0.89%   -0.03%     
========================================
  Files         10      10              
  Lines       6215    6385     +170     
========================================
  Hits          57      57              
- Misses      6150    6320     +170     
  Partials       8       8              
Flag Coverage Δ
unittests 0.89% <0.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tonywang10101 tonywang10101 changed the title feat(model): update chat_history schema to align with OpenAI message field chore(model): update chat_history schema to align with OpenAI message field Dec 29, 2023
Copy link
Member

@heiruwu heiruwu left a comment

Choose a reason for hiding this comment

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

LGTM

@heiruwu heiruwu merged commit 8ba6d89 into main Jan 8, 2024
11 checks passed
@heiruwu heiruwu deleted the INS-2982 branch January 8, 2024 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants