Closed david-der closed 3 weeks ago
│ 54 │ syntax = Syntax( │ │ ❱ 55 │ │ result.snippet, lexer=result.language, line_numbers=True, padding=1, theme=theme │ │ 56 │ ) │ │ 57 │ description_text = Text( │ │ 58 │ │ result.description, │ │ │ │ ╭──────────────────────────────────────────────────────────── locals ────────────────────────────────────────────────────────────╮ │ │ │ chain = RunnableSequence( │ │ │ │ │ first=ChatPromptTemplate( │ │ │ │ │ │ input_variables=['context'], │ │ │ │ │ │ input_types={}, │ │ │ │ │ │ partial_variables={}, │ │ │ │ │ │ messages=[ │ │ │ │ │ │ │ HumanMessagePromptTemplate( │ │ │ │ │ │ │ │ prompt=PromptTemplate( │ │ │ │ │ │ │ │ │ input_variables=['context'], │ │ │ │ │ │ │ │ │ input_types={}, │ │ │ │ │ │ │ │ │ partial_variables={}, │ │ │ │ │ │ │ │ │ template='\nYou are an AI assistant that can answer questions and help with tasks.\n\n{contex'+3 │ │ │ │ │ │ │ │ ), │ │ │ │ │ │ │ │ additional_kwargs={} │ │ │ │ │ │ │ ) │ │ │ │ │ │ ] │ │ │ │ │ ), │ │ │ │ │ middle=[ │ │ │ │ │ │ ChatAnthropic( │ │ │ │ │ │ │ model='claude-3-5-sonnet-20240620', │ │ │ │ │ │ │ temperature=0.0, │ │ │ │ │ │ │ anthropic_api_url='https://api.anthropic.com', │ │ │ │ │ │ │ anthropic_api_key=SecretStr('**********'), │ │ │ │ │ │ │ model_kwargs={} │ │ │ │ │ │ ) │ │ │ │ │ ], │ │ │ │ │ last=StrOutputParser() │ │ │ │ ) │ │ │ │ console = <console width=196 ColorSystem.EIGHT_BIT> │ │ │ │ key = None │ │ │ │ model = None │ │ │ │ prompt = 'Tell me a funny joke about AI?' │ │ │ │ result = "Here's a lighthearted AI joke for you:\n\nWhy don't AI assistants ever get tired?\n"+258 │ │ │ │ theme = 'solarized-dark' │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ AttributeError: 'str' object has no attribute 'snippet'
Ah, I think I know what the issue is here. Need to add a null check for result.snippet
result.snippet