MCPcopy
hub / github.com/lm-sys/FastChat / chat_completion_palm

Function chat_completion_palm

fastchat/llm_judge/common.py:496–519  ·  view source on GitHub ↗
(chat_state, model, conv, temperature, max_tokens)

Source from the content-addressed store, hash-verified

494
495
496def chat_completion_palm(chat_state, model, conv, temperature, max_tokens):
497 from fastchat.serve.api_provider import init_palm_chat
498
499 assert model == "palm-2-chat-bison-001"
500
501 if chat_state is None:
502 chat_state = init_palm_chat("chat-bison@001")
503
504 parameters = {
505 "temperature": temperature,
506 "top_p": 0.8,
507 "top_k": 40,
508 "max_output_tokens": max_tokens,
509 }
510 output = API_ERROR_OUTPUT
511 for _ in range(API_MAX_RETRY):
512 try:
513 response = chat_state.send_message(conv.messages[-2][1], **parameters)
514 output = response.text
515 break
516 except Exception as e:
517 print(type(e), e)
518 time.sleep(API_RETRY_SLEEP)
519 return chat_state, output
520
521
522def normalize_game_key_single(gamekey, result):

Callers 1

get_answerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…