Skip to content

feat: add support for 'presence_penalty' param to Responses API#4830

Open
nathan-weinberg wants to merge 2 commits intollamastack:mainfrom
nathan-weinberg:pres_pen
Open

feat: add support for 'presence_penalty' param to Responses API#4830
nathan-weinberg wants to merge 2 commits intollamastack:mainfrom
nathan-weinberg:pres_pen

Conversation

@nathan-weinberg
Copy link
Contributor

What does this PR do?

Closes #4704

Test Plan

4 unit tests have been added for testing this. Happy to provide additional tests/scripts if desired.

Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

✱ Stainless preview builds

This PR will update the llama-stack-client SDKs with the following commit message.

feat: add support for 'presence_penalty' param to Responses API

Edit this comment to update it. It will appear in the SDK's changelogs.

llama-stack-client-kotlin studio · code · diff

generate ⚠️lint ✅test ⏳

llama-stack-client-openapi studio · code · diff

Your SDK built successfully.
generate ⚠️

llama-stack-client-node studio · code · diff

Your SDK built successfully.
generate ⚠️build ✅lint ✅test ❗

npm install https://pkg.stainless.com/s/llama-stack-client-node/764423d59afe0910b9fbe8dcce0bf7ddaecb058c/dist.tar.gz
llama-stack-client-python studio · conflict
llama-stack-client-go studio · conflict

⏳ These are partial results; builds are still running.


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
Last updated: 2026-02-04 16:27:51 UTC

max_output_tokens=max_output_tokens,
metadata=metadata,
include=include,
presence_penalty=presence_penalty,
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems also need to be propagated to chat completion api.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 4, 2026
Copy link
Contributor

@skamenan7 skamenan7 left a comment

Choose a reason for hiding this comment

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

Thanks Nathan. Looks good.

request.max_output_tokens,
request.reasoning,
request.metadata,
request.presence_penalty,
Copy link
Contributor

Choose a reason for hiding this comment

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

This call is using a long positional-arg list. With the recent addition of presence_penalty, it looks like reasoning and max_output_tokens are now swapped due to parameter order. Can we switch this call to keyword arguments (at least for the tail params)

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI: I was trying to fix the order issue at #4825 (review)

@@ -171,6 +172,7 @@ def __init__(
self.store = store
self.include = include
self.store = bool(store) if store is not None else True
Copy link
Contributor

Choose a reason for hiding this comment

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

Tiny nit: self.store gets assigned twice in __init__ (first self.store = store, then immediately overwritten by the bool(store) normalization).

Not blocking, but worth cleaning up while we’re in here.

@mergify
Copy link

mergify bot commented Feb 6, 2026

This pull request has merge conflicts that must be resolved before it can be merged. @nathan-weinberg please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs-rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Responses API: Add presence_penalty parameter support

3 participants