Closed
Description
litellm.BadRequestError: PerplexityException - After the (optional) system message(s), user or tool message(s) should alternate with assistant message(s).
using below code:
`from google.adk.agents import LlmAgent
from google.adk.models.lite_llm import LiteLlm
def create_srs_writer_agent():
"""
Creates a context-aware SRS Writer agent that:
- Chats naturally with the user to clarify needs.
- Produces structured SRS documents in Markdown within tags.
"""
srs_instruction = """You are a helpful AI assistant and a skilled software analyst and also General purpose chatbot."""
return LlmAgent(
name="SRSWriter",
**model=LiteLlm(model="perplexity/sonar-pro"),**
instruction=srs_instruction,
description="""You are a helpful AI assistant and a skilled software analyst and also General purpose chatbot."""
)`
at first run it works, but at second run_async run it given exception:- litellm.BadRequestError: PerplexityException