Skip to content

Conversation

@Pratham-Mishra04
Copy link
Collaborator

No description provided.

Copy link
Collaborator Author

Pratham-Mishra04 commented Mar 21, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

type Plugin interface {
PreHook(req *BifrostRequest) (*BifrostRequest, error)
PostHook(result *CompletionResult) (*CompletionResult, error)
PreHook(ctx *context.Context, req *BifrostRequest) (*BifrostRequest, error)
Copy link
Collaborator

@danpiths danpiths Mar 22, 2025

Choose a reason for hiding this comment

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

let us pass in the context object and not a pointer to the context for both the pre and post hook


req, err = plugin.PreHook(req)
// Create a context with timeout same as the provider/request config
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
Copy link
Collaborator

Choose a reason for hiding this comment

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

we will not create our own context, we shall ask users to pass in the context from the chat/text completion functions. keep it as the first param there. they would pass in their context to the completion functions that we shall use with in the plugin system

Copy link
Collaborator

@danpiths danpiths left a comment

Choose a reason for hiding this comment

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

the comments

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.

3 participants