Skip to content

Commit

Permalink
Make some structural changes to how information is delivered. It has …
Browse files Browse the repository at this point in the history
…a consistent pattern now and logically separates schema from signatures and examples, but still indicates which are for class descriptions and which are for instance descriptions
  • Loading branch information
Unobtainiumrock committed Feb 11, 2025
1 parent e947efe commit c411ba0
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions adalflow/adalflow/core/base_data_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,24 @@ class DataClass:
Describing:
We defined :class:`DataClassFormatType<core.types.DataClassFormatType>` to categorize DataClass description formats
as inputs or outputs in an LLM prompt.
We defined :class:`DataClassFormatType<core.types.DataClassFormatType>` to categorize DataClass formats
as LLM inputs or outputs. This can be broken down into:
(1) schema (class description)
(2) signatures (class description)
(3) examples (instance description)
(1) `DataClassFormatType.SCHEMA`
- Standard JSON-based desription, via: :meth:`to_schema` as string and :meth:`to_schema` as dict.
(1) For describing the class (data structure):
(2) `DataClassFormatType.SIGNATURE_JSON` / `DataClassFormatType.SIGNATURE_YAML`
- More token-efficient than SCHEMA. Since SCHEMA is always represented as a JSON string, describing the data structure in JSON may be misleading when you want LLMS to output YAML.
`Signature` is more token-effcient than schema. Since schema is always represented as a JSON string, describing the data structure in JSON may be misleading when you want LLMS to output YAML.
- DataClassFormatType.SCHEMA: a more standard way to describe the data structure in Json string, :meth:`to_schema` as string and :meth:`to_schema` as dict.
- DataClassFormatType.SIGNATURE_JSON: imitating a json object with field name as key and description as value, :meth:`to_json_signature` as string.
- DataClassFormatType.SIGNATURE_YAML: imitating a yaml object with field name as key and description as value, :meth:`to_yaml_signature` as string.
(2) For describing the class instance: this is helpful to do few-shot examples in LLM prompts.
(3) `DataClassFormatType.EXAMPLE_JSON` / `DataClassFormatType.EXAMPLE_YAML`
- Helpful to do few-shot examples in LLM prompts.
- DataClassFormatType.EXAMPLE_JSON: the json representation of the instance, :meth:`to_json` as string.
- DataClassFormatType.EXAMPLE_YAML: the yaml representation of the instance, :meth:`to_yaml` as string.
Expand Down

0 comments on commit c411ba0

Please sign in to comment.