-
Notifications
You must be signed in to change notification settings - Fork 322
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
Default assistants from file + models from file #560
Default assistants from file + models from file #560
Conversation
@drnic I merged in your other PR and it created some merge conflicts. I took a quick look but I'm not 100% sure on the right way to resolve so I don't want to break it. |
3359e59
to
f16de77
Compare
Ok, rebuilt the PR off Question: in |
Also, perhaps |
And, are we using |
f16de77
to
db2049c
Compare
@drnic Ah, currently our Assistants class is a local-only model. But you know how I mentioned that OpenAI has this new API where they persist Assistants: at one point in time I was preparing to implement that API so I added the missing fields. Those fields are to match this schema: https://platform.openai.com/docs/api-reference/assistants/createAssistant It's probably worth dropping those columns since they're not actually implemented. I don't like keeping around half-implemented code and we can always add them back if ever deciding to implement the Assistant API. |
It looks like this branch is behind main. I'll wait to review until you flag it for me. |
The branch was rebased/rebuilt against
|
db2049c
to
662998b
Compare
Ok ci green |
Ohhh, sorry when I went to diff I saw I just did a pass through the diff and it looks good. Are there any other changes you had planned for it or is it ready to be merged in, from your view? |
I think it's good as it is. There's always other ideas. But this is handy and it's now obvious where assistants + their associated LLM models come from. |
I'd do a PR for dropping the unused fields later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one comment inline
662998b
to
2924648
Compare
b5621a2
to
c8d417a
Compare
The failing system spec is same as on |
Please double check the ideas in new migration -- is this a useful help to existing users' to generate slugs that match to the assistants.yml; or is it better to match based on the name only -- if a previous user didn't change the name, then they get the matching slug. |
Currently the migration leaves Assistants that I created to P.S. This might be a wierd case. The Language Model for my Assistant is based on an API Service that I had added, so that may be a case you need to handle. |
In the PR it will add the new slug column and then generate a slug for every assistant based on its name. Except first it tries to find the original Assistants and give them the same slugs that are now in the assistants.yml file. |
This might be a wierd case. The Language Model for my Assistant is based on an API Service that I had added, so that may be a case you need to handle. Let me know if you need more info. |
The question I’m trying to solve in the migration — since we don’t already have the slug — what to do with existing Assistants vs the incoming assistants.yml. some/all users will find new Assistants added from the assistants.yml file (eg gpt-4o mini). But can we minimise this? Or is it fine to create a few extra assistants? |
Some people might have a simple 1:1 between an assistant and a language model api_name. Others might have 10 assistants for gpt-4o, each with different system prompts, ready to behave differently from each other; but using the same language model. |
So what the migration is doing is finding the oldest assistant for each of the primary language models (gpt-4o, Claude, llama-3.1-70b) and assign them their assistants.yml slug. The rest get a generated slug from their name. However, the “original” assistants will have their name overridden by assistants.yml. And that might not be what we want. |
Maybe assistants.yml should only update the language model/api name for the assistants; but not change the assistant name. |
Cool. I was just saying currently in this PR the slug for my assistant gets nil, but when your done with this PR it should get one based on the Name. Right? I'm a little unclear about your issue regarding names, but hopefully people won't mind too much if a name gets changed (as long as you don't keep changing them back to a default when they want a different name). |
Ah, that’s a bug. The migration should run save! on every assistant which will generate the slug. I’ll try to reproduce.
Yeah that’s the issue - the PR currently will keep renaming the assistants each time you db:prepare; so that’s annoying. I’ll update that. |
@mattlindsey what's the name of your assistant which got a nil slug? |
# Test can flap on CI if we don't clear the queue | ||
clear_enqueued_jobs | ||
|
||
# set the user agent in the request headers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!! I saw this flappy test a couple times in dev but wasn't able to figure it out yet
I just checked again and the slug is not nil. Sorry about that.
|
|
@krschacht Damn it. It is there fine. Sorry for the wild goose chase! |
@@ -73,7 +73,7 @@ def set_conversation | |||
end | |||
|
|||
def set_assistant | |||
@assistant = Current.user.assistants_including_deleted.find_by(id: params[:assistant_id]) | |||
@assistant = Current.user.assistants_including_deleted.find_by(slug: params[:assistant_id]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was a bit surprised that this worked because I did not see you change a corresponding link_to in order to generate a url that contains this slug. Is that some default rails helper? I tried asking gpt4 but it claimed not so I don't get how the URLs are now using slug rather than id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See Assistant#to_param
which is magically used by rails routes helpers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, clever! But now I can't figure out why a newly added assistant is not working? Based on that implementation I would expect it to recognize any slug. Let's move over to this thread: #525 (comment)
@mattlindsey no problem at all, it's great that you were previewing the PR and trying it out. @drnic I just finished reviewing and testing locally and I think it's good to go! I'm going to merge in now. sorry about this flappy system test. I think Justin might take a look at it this week when he wraps up his PR. |
This PR includes #536
Instead of new Assistants being defined in code, they are defined in
assistants.yml
.The PR defines the same Assistants as before, plus a new "GPT-4o Mini" assistant.
Assistants have a unique (per user) slug which is used in urls
/assistants/claude-sonnet/messages/new
and used to match updates fromassistants.yml
to existing Assistant.