forked from phoenix/litellm-mirror
cleanup
This commit is contained in:
parent
6e05fca714
commit
a4ca26a189
2 changed files with 9 additions and 23 deletions
|
@ -672,29 +672,22 @@ def completion(
|
|||
litellm.openai_key or
|
||||
get_secret("DEEPINFRA_API_KEY")
|
||||
)
|
||||
openai.api_base = "https://api.deepinfra.com/v1/openai"
|
||||
## LOGGING
|
||||
logging.pre_call(
|
||||
input=messages,
|
||||
api_key=api_key,
|
||||
)
|
||||
## COMPLETION CALL
|
||||
openai.api_key = "1LntUh4fmg5z6iEW7UPPRhGdBDNuJx5y"
|
||||
openai.api_base = "https://api.deepinfra.com/v1/openai"
|
||||
openai.api_key = api_key # set key for deep infra
|
||||
try:
|
||||
chat_completion = openai.ChatCompletion.create(
|
||||
model="meta-llama/Llama-2-70b-chat-hf",
|
||||
messages=[{"role": "user", "content": "Hello world"}]
|
||||
response = openai.ChatCompletion.create(
|
||||
model=model,
|
||||
messages=messages,
|
||||
api_base="https://api.deepinfra.com/v1/openai", # use the deepinfra api base
|
||||
api_type="openai",
|
||||
api_version=api_version, # default None
|
||||
**optional_params,
|
||||
)
|
||||
print(f"chat_completion: {chat_completion}")
|
||||
# response = openai.ChatCompletion.create(
|
||||
# model=model,
|
||||
# messages=messages,
|
||||
# api_base="https://api.deepinfra.com/v1/openai", # use the deepinfra api base
|
||||
# api_type="openai",
|
||||
# api_version=api_version, # default None
|
||||
# **optional_params,
|
||||
# )
|
||||
except Exception as e:
|
||||
## LOGGING - log the original exception returned
|
||||
logging.post_call(
|
||||
|
|
|
@ -53,10 +53,3 @@ def test_completion_with_no_provider():
|
|||
# print(f"error occurred: {traceback.format_exc()}")
|
||||
# pass
|
||||
# os.environ["OPENAI_API_KEY"] = str(temp_key) # this passes linting#5
|
||||
|
||||
def logger_fn(model_details):
|
||||
print(model_details)
|
||||
os.environ['OPENAI_API_KEY'] = "1LntUh4fmg5z6iEW7UPPRhGdBDNuJx5y"
|
||||
messages = [{"role":"user","content":"Request boss to grant me 1 day leave"}]
|
||||
litellm.api_base = "https://api.deepinfra.com/v1/"
|
||||
response = litellm.completion(model="meta-llama/Llama-2-70b-chat-hf", messages=messages, custom_llm_provider="openai", logger_fn=logger_fn)
|
Loading…
Add table
Add a link
Reference in a new issue