improved 20c-persistent-context-anthropic.py

This commit is contained in:
Kwindla Hultman Kramer
2024-11-08 16:42:30 -08:00
parent a54ca08405
commit 33fc5bf990

View File

@@ -98,12 +98,13 @@ async def load_conversation(function_name, tool_call_id, args, llm, context, res
messages = [ messages = [
{ {
"role": "system", "role": "system",
"content": "You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be converted to audio so don't include special characters in your answers. Respond to what the user said in a creative and helpful way.", "content": "You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way. Your output will be converted to audio so don't include special characters in your answers. Respond to what the user said in a succinct, creative and helpful way. Prefer responses that are one sentence long unless you are asked for a longer or more detailed response.",
}, },
{"role": "user", "content": ""}, {"role": "user", "content": "Start the call by saying the word 'hello'. Say only that word."},
{"role": "assistant", "content": []}, # {"role": "user", "content": ""},
{"role": "user", "content": "Tell me"}, # {"role": "assistant", "content": []},
{"role": "user", "content": "a joke"}, # {"role": "user", "content": "Tell me"},
# {"role": "user", "content": "a joke"},
] ]
tools = [ tools = [
{ {
@@ -183,7 +184,7 @@ async def main():
) )
llm = AnthropicLLMService( llm = AnthropicLLMService(
api_key=os.getenv("ANTHROPIC_API_KEY"), model="claude-3-5-sonnet-20240620" api_key=os.getenv("ANTHROPIC_API_KEY"), model="claude-3-5-sonnet-latest"
) )
# you can either register a single function for all function calls, or specific functions # you can either register a single function for all function calls, or specific functions