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

Remove tools API and probably don't store them in the database at all. Rely on app #376

Open
rusenask opened this issue Aug 9, 2024 · 0 comments

Comments

@rusenask
Copy link
Contributor

rusenask commented Aug 9, 2024

The app creation now also creates tools in the database but they aren't really used in the normal path. Let's have tools defined only in the app, this simplifies our operations.

Currently blocking API call for tools: https://github.com/helixml/helix/blob/main/api/pkg/controller/inference.go#L32-L35

Streaming API tools: https://github.com/helixml/helix/blob/main/api/pkg/controller/inference.go#L68-L71

We run them directly based on the app, example:

func (c *Controller) evaluateToolUsageStream(ctx context.Context, user *types.User, req openai.ChatCompletionRequest, opts *ChatCompletionOptions) (*openai.ChatCompletionStream, bool, error) {
	_, sessionID, interactionID := oai.GetContextValues(ctx)

	selectedTool, isActionable, ok, err := c.selectAndConfigureTool(ctx, user, req, opts)
	if err != nil {
		return nil, false, fmt.Errorf("failed to select and configure tool: %w", err)
	}

	if !ok {
		return nil, false, nil
	}

	lastMessage := getLastMessage(req)
	history := types.HistoryFromChatCompletionRequest(req)

	stream, err := c.ToolsPlanner.RunActionStream(ctx, sessionID, interactionID, selectedTool, history, lastMessage, isActionable.Api)
	if err != nil {
		return nil, false, fmt.Errorf("failed to perform action: %w", err)
	}

	return stream, true, nil
}
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

No branches or pull requests

1 participant