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

Add input params for OpenAI, Anthropic, Together AI LLMs #484

Merged
merged 5 commits into from
Sep 21, 2024

Conversation

markbackman
Copy link
Contributor

I've opted to keep the inputs to the most common options. With this structure in place, it'll be easy to expand as needed.

Also, I added a Together AI example to make testing with Together AI easier.

@@ -82,12 +87,16 @@ def __init__(
model: str = "claude-3-5-sonnet-20240620",
max_tokens: int = 4096,
enable_prompt_caching_beta: bool = False,
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we should add max_tokens and enable_prompt_caching_beta to InputParams as well. It's a breaking change, but we are breaking a few things in this next release, so it should be fine. In the emotion Cartesia PR we are also breaking it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I held off because this was breaking, but I'll make the change now.


def __init__(
self,
*,
api_key: str,
model: str = "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
max_tokens: int = 4096,
params: InputParams = InputParams(),
Copy link
Contributor

Choose a reason for hiding this comment

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

we should probably add max_tokens inside InputParams here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here.

@aconchillo
Copy link
Contributor

Looks great! Just a couple of comments.

@markbackman markbackman force-pushed the mb/llm-input-params branch 3 times, most recently from fde2bbb to 99eb2cd Compare September 20, 2024 22:21
self._temperature = temperature

async def set_top_k(self, top_k: float):
logger.debug(f"Switching LLM top_p to: [{top_k}]")
Copy link
Contributor

Choose a reason for hiding this comment

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

Switching LLM top_k

*,
model: str = "gpt-4o",
params: BaseOpenAILLMService.InputParams = BaseOpenAILLMService.InputParams(),
**kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

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

indentation

@markbackman markbackman merged commit e8f8a49 into main Sep 21, 2024
3 checks passed
@aconchillo aconchillo deleted the mb/llm-input-params branch October 23, 2024 20:55
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