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

Use underlying SDKs to automatically fill in model options when creating drivers #1441

Open
1 task done
shhlife opened this issue Dec 13, 2024 · 1 comment
Open
1 task done
Labels
type:enhancement Improvements to existing features
Milestone

Comments

@shhlife
Copy link

shhlife commented Dec 13, 2024

Is your feature request related to a problem? Please describe.
Customers can have a difficult time knowing what models to choose when creating drivers if they don't already know what models exist. For things like gpt-4o it's pretty easy to type.. but for options like sonnet unless you know the exact ids, it's a challenge.

It would be wonderful to be able to use the underlying model SDKs to grab the list of models available and dynamically fill them.

Describe the solution you'd like
Here's a loom demonstrating a modification I did with Anthropic to pull from their list:
https://www.loom.com/share/d7299383d6894101bc14db3fe8c05e43?sid=d4fedfee-ec64-45fa-9477-9a0a12dac9db

And to do the same with OpenAiChatPromptDriver I modified openai_chat_prompt_driver.py:

in the if TYPE_CHECKING: section:

if TYPE_CHECKING:
    from collections.abc import Iterator

    from openai.types.chat.chat_completion_chunk import ChoiceDelta
    from openai.types.chat.chat_completion_message import ChatCompletionMessage
    from openai.types.chat_model import ChatModel # Pull from OpenAi's types
    from griptape.tools import BaseTool

and then I switched the model param:

    # model: str = field(kw_only=True, metadata={"serializable": True})
    model: ChatModel = field(kw_only=True, metadata={"serializable": True}) # Use OpenAi's ChatModel

Describe alternatives you've considered
We could manually create the list, but this seems way more efficient and will adjust automatically as the libraries change.

@shhlife
Copy link
Author

shhlife commented Dec 20, 2024

I've been slowly implementing this in the Griptape ComfyUI nodes.. if it's helpful, here are the types for OpenAi:

from openai.types import AudioModel, ChatModel, EmbeddingModel, ImageModel
from openai.types.audio.speech_model import SpeechModel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement Improvements to existing features
Projects
None yet
Development

No branches or pull requests

2 participants