-
Notifications
You must be signed in to change notification settings - Fork 452
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
provider: SambaNova FastAPI implementation. #548
Conversation
I think this is okay for now. |
Hey! Thanks for the PR. We recently released a openai base provider which can be used for all openai compatible providers. It would be great if you can use it for this provider as well because its OpenAI compliant. You can check the |
@VisargD I'm curious that this Also, i doubt at
[1]: Edit; seems groq got reverted, nevermind. |
}; | ||
index: number; | ||
finish_reason: string | null; | ||
logprobs: object | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just do Record
instead of object
here?
'tools', | ||
'tool_choice', | ||
'response_format', | ||
'logprobs', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're expecting the response to send logprobs
but we're excluding it here, is there any issue here?
Sorry, I'm missing the documentation with me, so had to confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, i will review these as soon as possible.
if it meant that there are no logprob params, at this moment, there is no mention of these params. i want to believe the docs that i have dont have complete references.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that the request would have that logprobs arg, but it wasn't documented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, for now we can remove the logprobs
i.e don't expect it to be available in the response and don't accept it in the request body as well. Once they are with good documentation/ available for everyone we can make the change again.
cc: @VisargD
@ilsubyeega I have tried running the code locally but keep on getting Following is the curl I have tried. curl --request POST \
--url http://localhost:8787/v1/chat/completions \
--header 'authorization: key' \
--header 'content-type: application/json' \
--header 'x-portkey-provider: sambanova' \
--data '{
"messages": [
{
"role": "user",
"content": "Hello, world"
}
]
}' |
@b4s36t4 Here you go. Screencast.from.2024-09-06.20-54-31.webm |
@ilsubyeega Sorry for the delay. But I just have got merged the typing issue for the defaluValues for the base provider. If possible please update the PR to use |
Here are some concerns: Default parameter does not affect isStreamingMode, which requires gateway/src/handlers/handlerUtils.ts Lines 459 to 491 in 7eaf932
transformToProviderRequest parses with default provider config, if it done correctly, but it does not affect isStreamingMode, make it fails.
Since stream is not required param, so it does not append gateway/src/services/transformToProviderRequest.ts Lines 116 to 128 in 7eaf932
Here is possible workarounds:
stream: {
param: 'stream',
...(defaultValues?.stream && { default: defaultValues.stream, required: true }), // <--
}, else if (
paramConfig &&
// paramConfig.required && <--- remove this
paramConfig.default !== undefined
) { it seems default option is useless when required=false, so the last option looks ideal for me. Since the provider only supports streaming-mode at this moment, which is unusual, so this issue being kinda tricky. |
@ilsubyeega Sorry, I didn't understand what you're trying to say. If possible can we take this over discord chat. |
Also sambanova does support non-stream request as well. {
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "It seems like you've mentioned a name, \"Mahesh\". Would you like to know more about someone with this name, or perhaps discuss something related to it?"
}
}
],
"created": 1725703777,
"id": "08f08fe8-889a-4cdb-b406-e4f8077b2537",
"model": "Meta-Llama-3.1-8B-Instruct",
"object": "chat.completion",
"system_fingerprint": "fastcoe",
"usage": {
"completion_tokens": 33,
"completion_tokens_after_first_per_sec": 483.3644057419852,
"completion_tokens_after_first_per_sec_first_ten": 889.0098453777595,
"completion_tokens_per_sec": 355.31535860884566,
"end_time": 1725703777.6294942,
"is_last_response": true,
"prompt_tokens": 11,
"start_time": 1725703777.536619,
"time_to_first_token": 0.0266726016998291,
"total_latency": 0.09287524223327637,
"total_tokens": 44,
"total_tokens_per_sec": 473.7538114784609
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @ilsubyeega. Sorry to drag this longer, but while testing I have observed an issue where the provider is sending more than one chunk in the response for stream which is throwing error and not working as expected.
To resolve this you need update the function getStreamModeSplitPattern
to support the sambanova. Currently we have different split patterns for different providers, for sambanova we should be adding \n
as the separator. Please let me know if there's anything we can discuss over discord.
Hey @ilsubyeega - can you please share the email/name of person from Sambanova you were in touch with? We can reach out to to inform about this integration and discuss what more can be done. |
I am just a private beta test api user and have no connection with sambanova. I received the mail through salesforce. |
This PR implements SambaNova FastAPI implementation. Which is currently private-beta, but the request codes are in sambanova/ai-starter-kit repository. Whole codebases are copied from
/src/provider/groq
directory.Related #407. But this does not implement any other apis that are mentioned.
It's working when quick and simple test, but I must verify that it works properly, so I've submitted this as Draft.