You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The library also supports debug mode. This is useful if you want to see the prompt that was used or if you want to see the response that was returned.
131
+
132
+
```python
133
+
import asyncio
134
+
from smartfunc import async_backend
135
+
from pydantic import BaseModel
136
+
from dotenv import load_dotenv
137
+
138
+
load_dotenv(".env")
139
+
140
+
141
+
classSummary(BaseModel):
142
+
summary: str
143
+
pros: list[str]
144
+
cons: list[str]
145
+
146
+
147
+
@async_backend("gpt-4o-mini", debug=True)
148
+
asyncdefgenerate_poke_desc(text: str) -> Summary:
149
+
"""Describe the following pokemon: {{ text }}"""
150
+
pass
151
+
152
+
resp = asyncio.run(generate_poke_desc("pikachu"))
153
+
print(resp)
154
+
```
155
+
156
+
This will return a dictionary with the debug information.
157
+
158
+
```python
159
+
{
160
+
'summary': 'Pikachu is a small, yellow, rodent-like Pokémon known for its electric powers and iconic status as the franchise mascot. It has long ears with black tips, red cheeks that store electricity, and a lightning bolt-shaped tail. Pikachu evolves from Pichu when leveled up with high friendship and can further evolve into Raichu when exposed to a Thunder Stone. Pikachu is often depicted as cheerful, playfully energetic, and is renowned for its ability to generate electricity, which it can unleash in powerful attacks such as Thunderbolt and Volt Tackle.',
161
+
'pros': [
162
+
'Iconic mascot of the Pokémon franchise', 'Popular among fans of all ages', 'Strong electric-type moves', 'Cute and friendly appearance'
163
+
],
164
+
'cons': [
165
+
'Limited range of evolution (only evolves into Raichu)', 'Commonly found, which may reduce uniqueness', 'Vulnerable to ground-type moves', 'Requires high friendship for evolution to Pichu, which can be a long process'
166
+
],
167
+
'_debug': {
168
+
'template': 'Describe the following pokemon: {{ text }}',
169
+
'func_name': 'generate_poke_desc',
170
+
'prompt': 'Describe the following pokemon: pikachu',
0 commit comments