syn54x / whisper

Whisper 🤫 sweet nothin's to your favorite LLM.
https://syn54x.github.io/whisper/
Apache License 2.0
5 stars 0 forks source link

str has no snippet #3

Closed david-der closed 3 weeks ago

david-der commented 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'
IVIyg0t commented 3 weeks ago

Ah, I think I know what the issue is here. Need to add a null check for result.snippet