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

feat: add ai.anthropic_list_models #386

Merged
merged 2 commits into from
Jan 23, 2025

Conversation

MasterOdin
Copy link
Contributor

PR implements the ai.anthropic_list_models function, which currently returns columns (id, name, created) which gives:

test=# SELECT ai.anthropic_list_models();
                              anthropic_list_models
---------------------------------------------------------------------------------
 (claude-3-5-sonnet-20241022,"Claude 3.5 Sonnet (New)","2024-10-22 00:00:00+00")
 (claude-3-5-haiku-20241022,"Claude 3.5 Haiku","2024-10-22 00:00:00+00")
 (claude-3-5-sonnet-20240620,"Claude 3.5 Sonnet (Old)","2024-06-20 00:00:00+00")
 (claude-3-haiku-20240307,"Claude 3 Haiku","2024-03-07 00:00:00+00")
 (claude-3-opus-20240229,"Claude 3 Opus","2024-02-29 00:00:00+00")
 (claude-3-sonnet-20240229,"Claude 3 Sonnet","2024-02-29 00:00:00+00")
 (claude-2.1,"Claude 2.1","2023-11-21 00:00:00+00")
 (claude-2.0,"Claude 2.0","2023-07-11 00:00:00+00")
(8 rows)

@MasterOdin MasterOdin requested a review from a team as a code owner January 23, 2025 00:05
@@ -16,3 +17,13 @@ def make_client(
if max_retries is not None:
args["max_retries"] = max_retries
return Anthropic(api_key=api_key, base_url=base_url, **args)


def list_models(
Copy link
Contributor Author

@MasterOdin MasterOdin Jan 23, 2025

Choose a reason for hiding this comment

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

Wasn't sure if it'd be better to have this python function that gets called (similar to openai) or have it be inline in the sql file (similar to ollama). 🤷

I think the nice thing is maybe that python tooling is a bit more universal for python files vs embedded python in SQL files.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the nice thing is maybe that python tooling is a bit more universal for python files vs embedded python in SQL files.

Yeah, I think so too. This is fine IMO.

@MasterOdin MasterOdin force-pushed the mpeveler/feat-anthropic-list-models branch 2 times, most recently from 221aa69 to 088ba55 Compare January 23, 2025 00:37
Signed-off-by: Matthew Peveler <[email protected]>
@MasterOdin MasterOdin force-pushed the mpeveler/feat-anthropic-list-models branch from 088ba55 to 1938e5a Compare January 23, 2025 00:46
Copy link
Collaborator

@jgpruitt jgpruitt left a comment

Choose a reason for hiding this comment

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

One tiny typing thing otherwise lgtm!

projects/extension/ai/anthropic.py Outdated Show resolved Hide resolved
@MasterOdin MasterOdin force-pushed the mpeveler/feat-anthropic-list-models branch from a5efff0 to 84d0b42 Compare January 23, 2025 03:37
Co-authored-by: John Pruitt <[email protected]>
Signed-off-by: Matthew Peveler <[email protected]>
@MasterOdin MasterOdin force-pushed the mpeveler/feat-anthropic-list-models branch from 84d0b42 to aa43c92 Compare January 23, 2025 03:38
@MasterOdin MasterOdin requested a review from jgpruitt January 23, 2025 03:44
@jgpruitt jgpruitt merged commit 6707542 into main Jan 23, 2025
5 checks passed
@jgpruitt jgpruitt deleted the mpeveler/feat-anthropic-list-models branch January 23, 2025 13:57
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