[go: nahoru, domu]

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

vertexai: Fix GenerativeModel struct for vertex model garden #9630

Open
ryan-swit opened this issue Mar 22, 2024 · 4 comments
Open

vertexai: Fix GenerativeModel struct for vertex model garden #9630

ryan-swit opened this issue Mar 22, 2024 · 4 comments
Assignees
Labels
api: vertex-ai Issues related to the Vertex AI API.

Comments

@ryan-swit
Copy link

Is your feature request related to a problem? Please describe.

Cannot use anthropic publisher and others (except google)

// GenerativeModel creates a new instance of the named model.
func (c *Client) GenerativeModel(name string) *GenerativeModel {
	return &GenerativeModel{
		c:        c,
		name:     name,
		fullName: fmt.Sprintf("projects/%s/locations/%s/publishers/google/models/%s", c.projectID, c.location, name),
	}
}

Describe the solution you'd like

  1. Add Option struct Provider field
type options struct {
	cloudProject          string
	cloudLocation         string
        publisher                   string
	defaultModel          string
	defaultEmbeddingModel string
	defaultCandidateCount int
	defaultMaxTokens      int
	defaultTemperature    float64
	defaultTopK           int
	defaultTopP           float64
}
  1. Add WithPublisher Function
func WithPublisher(p string) Option {
	return func(opts *options) {
		opts.publisher = p
	}
}
  1. Edit NewClient func signature & Modify Client, GenerativeModel
func NewClient(ctx context.Context, projectID, location, publisher string, opts ...option.ClientOption) (*Client, error)
// A Client is a Google Vertex AI client.
type Client struct {
	c         *aiplatform.PredictionClient
	projectID string
	location  string
       publisher string
}
// GenerativeModel creates a new instance of the named model.
func (c *Client) GenerativeModel(name string) *GenerativeModel {
	return &GenerativeModel{
		c:        c,
		name:     name,
		fullName: fmt.Sprintf("projects/%s/locations/%s/publishers/%s/models/%s", c.projectID, c.location, c.publisher, name),
	}
}

Additional context
vertexai library version : 0.7.1

@ryan-swit ryan-swit added the triage me I really want to be triaged. label Mar 22, 2024
@codyoss codyoss added api: vertex-ai Issues related to the Vertex AI API. and removed triage me I really want to be triaged. labels Mar 22, 2024
@minikomi
Copy link
minikomi commented Mar 26, 2024

To me it makes more sense to make this make this part of the model configuration, not the client.

eg.

func (c *Client) GenerativeModel(publisher, name string) *GenerativeModel {
	return &GenerativeModel{
		c:        c,
		name:     name,
		fullName: fmt.Sprintf("projects/%s/locations/%s/publishers/%s/models/%s", c.projectID, c.location, publisher, name),
	}
}

@minikomi
Copy link

Any progress/plans to share?

@eliben
Copy link
Contributor
eliben commented May 16, 2024

We're looking at options to support this, and tuned models. Stay tuned

@eliben
Copy link
Contributor
eliben commented May 16, 2024

@minikomi @ryan-swit would the change in #10197 work for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vertex-ai Issues related to the Vertex AI API.
Projects
None yet
Development

No branches or pull requests

5 participants