ScottLogic / prompt-injection

Application which investigates defensive measures against prompt injection attacks on an LLM, with a focus on the exposure of external tools.
MIT License
16 stars 10 forks source link

Update GPT models available #912

Closed chriswilty closed 3 months ago

chriswilty commented 3 months ago

Feature Request

Description

We have hard-coded the chat models available, here: https://github.com/ScottLogic/prompt-injection/blob/dev/backend/src/models/chat.ts#L10

This will need updating whenever OpenAI release a new model, which feels a touch unnecessary. On the other hand, new model GPT-4o does not conform to previous naming strategies, so some intervention could be needed in future anyway.

For now, I suggest a pattern match:

Screenshots

Image

Acceptance criteria

GIVEN I am logged in and in Sandbox level WHEN I open the Model Configuration section in the sidebar AND open the Select Model dropdown THEN I see all major GPT models available to me (at time of writing: GPT-3.5-turbo, GPT-4, GPT-4-turbo, GPT-4o)

chriswilty commented 3 months ago

Note this issue will also fix #588

chriswilty commented 3 months ago

Well this really sucks.... OpenAI are still not providing context window size in their API models endpoint, despite several requests from the community. The (very weak) argument is that these do not change after release of a model, but that still means we all need manual intervention in our codebases whenever they release a new model.

So unfortunately, these context windows still need to be hard-coded, which means we need to hard-code the model names as well.

Note that we could clean up the types while we're at it, so the model names are extracted from the context window mapping (chatModelMaxTokens in backend/src/utils/token.ts) instead of being declared separately. We should probably move that mapping into backend/src/models/chat.ts while we're at it. In the frontend code, we can remove the CHAT_MODEL_ID type entirely and just use string as type, seeing as the values are always retrieved from the server so we can trust them. Having them hard-coded in two different places is a recipe for disaster, noting that the two have already diverged! 😱