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

fix: initialize auto suggestions providers (closes #571) #576

Merged
merged 1 commit into from
Sep 15, 2024

Conversation

holaguz
Copy link
Contributor

@holaguz holaguz commented Sep 13, 2024

Fixes #571

@LessComplexity
Copy link
Contributor

Did the fix locally and it worked :)
Waiting for an official update ;)
thanks

Copy link
Collaborator

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

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

I was thinking to refactor it to make Provider as two separate instance, instead of having a singleton like this.

This actually only works for copilot, since if both auto_suggestions_provider and provider is set (let say openai and claude respectively), then generations won't work at all.

@holaguz
Copy link
Contributor Author

holaguz commented Sep 14, 2024

It seems to be working. 🤔

Autocompletion with OpenAI provider (also, the settings I'm currently using):

image

{
  body = {
    max_tokens = 4096,
    model = "gpt-4o-mini",
    stream = true,
    temperature = 0
  },
  url = "https://api.openai.com/v1/chat/completions"
}

Also a chat with Claude:

image

{
  body = {
    max_tokens = 4096,
    model = "claude-3-haiku-20240307",
    stream = true,
    system = { {
        cache_control = {
          type = "ephemeral"
        },
        text = "You are an excellent programming expert.\n",
        type = "text"
      } },
    temperature = 0
  },
  url = "https://api.anthropic.com/v1/messages"
}

@aarnphm aarnphm changed the title fix: initialize auto_suggestions_provider fix: initialize auto suggestions providers (closes #571) Sep 15, 2024
@aarnphm aarnphm merged commit bcec0fa into yetone:main Sep 15, 2024
E.setup({ provider = provider })

if auto_suggestions_provider and auto_suggestions_provider ~= provider then
E.setup({ provider = auto_suggestions_provider })
Copy link
Owner

Choose a reason for hiding this comment

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

The design patterns related to the provider are a bit too complex. Why is E.setup called twice here? @aarnphm

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ye I'm intending to clean this up a bit. It has to do with we are lazily loading the env for each providers.

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.

bug: Using Copilot for Auto Suggestions
4 participants