-
Notifications
You must be signed in to change notification settings - Fork 0
feat: v1 api format #1
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
Conversation
Summary of ChangesHello @abhishekg999, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request marks a significant architectural shift by introducing a new Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a new v1 API format for the Judgeval Go SDK, deprecating the previous structure. The changes are extensive, touching upon API models, client generation, tracer implementation, and examples. The new v1 API is well-structured, using idiomatic Go patterns like functional options and factories. The client generation from an OpenAPI spec is a solid approach.
I've found one critical issue in the example code related to resource management (defer in a loop) and one medium-severity issue in the new tracer implementation regarding incomplete attribute handling. My feedback includes suggestions to fix these issues. Overall, this is a great step forward for the SDK's architecture.
justinsheu
left a comment
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.
- is the plan to eventually add llm client wrapping? or is it different since it seems like openai calls are made directly to the http endpoint instead of some go library
- also i'm assuming this is because of the limitations of go, but i noticed in the example that instrumentation is a lot more manual than python, such as having to manually indicate the beginning and end of a span and having to manually set input/output
| return &Client{ | ||
| apiClient: apiClient, | ||
| Tracer: &TracerFactory{client: apiClient}, | ||
| Scorers: newScorersFactory(apiClient), |
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.
change to same pattern as tracer and evaluation factories
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.
Actually I think this is correct since scorerFactory creates a further interface.
| Initialize *bool | ||
| } | ||
|
|
||
| func (f *TracerFactory) Create(ctx context.Context, params TracerCreateParams) (*Tracer, error) { |
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.
would it make sense to use options here?
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 think there definately is an argument both ways, I think with tracer tho it might be good for more explicit specification?
Also following stainless / openai sdk pattenrs, only the top level client uses options so I think this is fair
| return scorer, nil | ||
| } | ||
|
|
||
| func (f *PromptScorerFactory) Create(params PromptScorerCreateParams) (*PromptScorer, error) { |
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.
similar to tracer, is there a reason this uses params struct instead of options?
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.
yes trying to follow same kinda design pattern as: https://github.com/openai/openai-go
| client *api.Client | ||
| } | ||
|
|
||
| func (f *EvaluationFactory) Create(params EvaluationCreateParams) *Evaluation { |
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.
is this wip?
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.
would be where run evaluation goes, but yes nothing for now, same spec as rest of clients
Regarding llm clients, we definately can.
This is correct: Regarding manual spans this the recommended way, we maybe can handle callable utils but there is no concept of decorators of go So the api will always be more manual for arbitrary things (similar to java). For lower level languages I want to prevent the amount of "magic" that we do. |
justinsheu
left a comment
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.
just minor questions:
- for scorers, i noticed that only promptscorer and tracepromptscorer return a tuple with error, while others like built in and custom just return the return value. should this be standardized?
v1/tracer.go
Outdated
| ProjectName: b.projectName, | ||
| EvalName: runID, | ||
| Model: modelName, | ||
| Id: uuid.New().String(), |
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.
does this remove the ability to specify evaluation model on sdk? if so does this mean the backend will always use the default model now?
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.
the Model lives on the Scorer object and can be configured there and moving stuff out of async evaluate
justinsheu
left a comment
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.
lgtm
actually good point, for now custom scorer doesnt actually make a api call, but ill make it match teh same behavior , tho it never actually fails since it just returns a struct with the provided vals |
No description provided.