mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
[FEAT] Added snowflake completion provider
This commit is contained in:
parent
842d8dec09
commit
fd090c8043
8 changed files with 288 additions and 0 deletions
40
litellm/llms/snowflake/common_utils.py
Normal file
40
litellm/llms/snowflake/common_utils.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
import httpx
|
||||
from typing import List, Optional
|
||||
|
||||
|
||||
|
||||
class SnowflakeBase:
|
||||
def validate_environment(
|
||||
self,
|
||||
headers: dict,
|
||||
JWT: Optional[str] = None,
|
||||
) -> dict:
|
||||
"""
|
||||
Return headers to use for Snowflake completion request
|
||||
|
||||
Snowflake REST API Ref: https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-llm-rest-api#api-reference
|
||||
Expected headers:
|
||||
{
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json",
|
||||
"Authorization": "Bearer " + <JWT>,
|
||||
"X-Snowflake-Authorization-Token-Type": "KEYPAIR_JWT"
|
||||
}
|
||||
"""
|
||||
|
||||
if JWT is None:
|
||||
raise ValueError(
|
||||
"Missing Snowflake JWT key"
|
||||
)
|
||||
|
||||
headers.update(
|
||||
{
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json",
|
||||
"Authorization": "Bearer " + JWT,
|
||||
"X-Snowflake-Authorization-Token-Type": "KEYPAIR_JWT"
|
||||
}
|
||||
)
|
||||
return headers
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue