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

Add support for perplexity/sonar-reasoning #633

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

Szpadel
Copy link

@Szpadel Szpadel commented Jan 29, 2025

Adds support for perplexity/sonar-reasoning model from openrouter, It's based on deepseek-r1 so it is threaded in the same way. I noticed that some providers allow setting top_p, I set it to value used in deepseek benchmarks.

Description

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Checklist:

  • My code follows the patterns of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

Additional context

Related Issues

Reviewers


Important

Add support for perplexity/sonar-reasoning model in OpenRouterHandler with specific parameters.

  • Behavior:
    • Adds support for perplexity/sonar-reasoning model in OpenRouterHandler.
    • Sets temperature to 0.6 and top_p to 0.95 for perplexity/sonar-reasoning and deepseek-r1 models.
    • Converts messages to R1 format for these models.
  • Misc:
    • Minor formatting changes in openrouter.ts.

This description was created by Ellipsis for 1534a9c. It will automatically update as commits are pushed.

Copy link

changeset-bot bot commented Jan 29, 2025

⚠️ No Changeset found

Latest commit: 1534a9c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -127,6 +137,7 @@ export class OpenRouterHandler implements ApiHandler, SingleCompletionHandler {
model: this.getModel().id,
max_tokens: maxTokens,
temperature: temperature,
top_p: topP,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there any chance of this breaking API calls to providers who don't support top_p? If so we might consider doing what we do with the transforms field below.

Copy link
Author

Choose a reason for hiding this comment

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

This is the same as with include_reasoning: it's passed to every model, not only for deepseek.

From oupenrouter docs:

Non-standard parameters: If the chosen model doesn't support a request parameter (such as logit_bias in non-OpenAI models, or top_k for OpenAI), then the parameter is ignored. The rest are forwarded to the underlying model API.

@mrubens mrubens merged commit 5c17f79 into RooVetGit:main Jan 29, 2025
6 checks passed
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.

2 participants