8000 Better server params and fields by Stonelinks · Pull Request #130 · abetlen/llama-cpp-python · GitHub
[go: up one dir, main page]

Skip to content

Better server params and fields #130

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

Merged
merged 11 commits into from
May 7, 2023

Conversation

Stonelinks
Copy link
Contributor
@Stonelinks Stonelinks commented Apr 30, 2023

This is a lot, but the net is that:

  • Unsupported fields were removed
  • Supported (but missing) fields were added
  • A ton of information in parameters were added (via Field annotations)

Reasoning should be in commit messages for individual decisions, with some more details here: Stonelinks#3

The result of all this should be better documentation from the swagger / openapi docs available from the server, as well as improved clients generated from openapi.json (up next)

image

@Stonelinks Stonelinks force-pushed the better-server-params-and-fields branch from 8b81fc8 to 114c9f3 Compare May 1, 2023 18:09
@gjmulder
Copy link
Contributor
gjmulder commented May 1, 2023

Upvote. Muchas gracias! 👍

@Stonelinks Stonelinks force-pushed the better-server-params-and-fields branch from 5204a6a to 1c7cc8c Compare May 1, 2023 19:07
Stonelinks added 8 commits May 1, 2023 15:38
`model` is ignored, but currently marked "optional"... on the one hand could mark "required" to make it explicit in case the server supports multiple llama's at the same time, but also could delete it since its ignored. decision: mark it required for the sake of openai api compatibility.

I think out of all parameters, `model` is probably the most important one for people to keep using even if its ignored for now.
`n`, `presence_penalty`, `frequency_penalty`, `best_of`, `logit_bias`, `user`: not supported, excluded from the calls into llama. decision: delete it
I think this is actually supported (its in the arguments of `LLama.__call__`, which is how the completion is invoked). decision: mark as supported
`llama.create_chat_completion` definitely has a `top_k` argument, but its missing from `CreateChatCompletionRequest`. decision: add it
Slight refactor for common fields shared between completion and chat completion
When I generate a client, it breaks because it fails to process the schema of ChatCompletionRequestMessage

These fix that:
- I think `Union[Literal["user"], Literal["channel"], ...]` is the same as Literal["user", "channel", ...]
- Turns out default value `Literal["user"]` isn't JSON serializable, so replace with "user"
@Stonelinks Stonelinks force-pushed the better-server-params-and-fields branch from 1c7cc8c to dbbfc4b Compare May 1, 2023 22:38
abetlen and others added 2 commits May 1, 2023 22:45
Not sure why this union type was here but taking a look at llama.py, prompt is only ever processed as a string for completion

This was breaking types when generating an openapi client
@Stonelinks Stonelinks force-pushed the better-server-params-and-fields branch from 6396f7e to b9098b0 Compare May 2, 2023 21:47
@abetlen
Copy link
Owner
abetlen commented May 5, 2023

@Stonelinks great work!

I want to merge this in but I'd like to keep the unsupported fields in the API as they were before. Otherwise I'm very happy with the addition of the Fields object because it works really well with how I've implemented CLI options for the server.

@abetlen abetlen merged commit d8fddcc into abetlen:main May 7, 2023
xaptronic pushed a commit to xaptronic/llama-cpp-python that referenced this pull request Jun 13, 2023
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
0