MCPcopy
hub / github.com/stanfordnlp/dspy / items

Method items

dspy/primitives/example.py:192–204  ·  view source on GitHub ↗

Return `(field_name, value)` pairs, like `dict.items()`. Args: include_dspy: If `True`, include internal fields prefixed with `dspy_`. Examples: >>> import dspy >>> dspy.Example(question="Why?", answer="Because.").items()

(self, include_dspy=False)

Source from the content-addressed store, hash-verified

190 return [v for k, v in self._store.items() if not k.startswith("dspy_") or include_dspy]
191
192 def items(self, include_dspy=False):
193 """Return `(field_name, value)` pairs, like `dict.items()`.
194
195 Args:
196 include_dspy: If `True`, include internal fields prefixed
197 with `dspy_`.
198
199 Examples:
200 >>> import dspy
201 >>> dspy.Example(question="Why?", answer="Because.").items()
202 [('question', 'Why?'), ('answer', 'Because.')]
203 """
204 return [(k, v) for k, v in self._store.items() if not k.startswith("dspy_") or include_dspy]
205
206 def get(self, key, default=None):
207 """Return the value for `key`, or `default` if the field doesn't exist.

Callers 15

__new__Method · 0.45
_validate_fieldsMethod · 0.45
_get_fields_with_typeMethod · 0.45
__repr__Method · 0.45
insertMethod · 0.45
make_signatureFunction · 0.45
move_kwargsFunction · 0.45
convert_langchain_toolFunction · 0.45
_flatten_usage_entryMethod · 0.45

Calls

no outgoing calls

Tested by 15

check_patternFunction · 0.36
check_patternFunction · 0.36
check_patternFunction · 0.36
__call__Method · 0.36