Highcharts Core for Python API Reference


API Design Patterns

Code Style: Python vs JavaScript Naming Conventions

There are only two hard things in Computer Science: cache invalidation and naming things. – Phil Karlton

Highcharts Core is a JavaScript library, and as such it adheres to the code conventions that are popular (practically standard) when working in JavaScript. Chief among these conventions is that variables and object properties (keys) are typically written in camelCase.

A lot of (digital) ink has been spilled writing about the pros and cons of camelCase vs snake_case. While I have a scientific evidence-based opinion on the matter, in practice it is simply a convention that developers adopt in a particular programming language. The issue, however, is that while JavaScript has adopted the camelCase convention, Python generally skews towards the snake_case convention.

For most Python developers, using snake_case is the “default” mindset. Most of your Python code will use snake_case. So having to switch into camelcase to interact with Highcharts Core forces us to context switch, increases cognitive load, and is an easy place for us to overlook things and make a mistake that can be quite annoying to track down and fix later.

Therefore, when designing the Highcharts for Python Toolkit, we made several carefully considered design choices when it comes to naming conventions:

  1. All Highcharts for Python classes follow the Pythonic PascalCase class-naming convention.

  2. All Highcharts for Python properties and methods follow the Pythonic snake_case property/method/variable/function-naming convention.

  3. All inputs to properties and methods support both snake_case and camelCase (aka mixedCase) convention by default.

    This means that you can take something directly from Highcharts JavaScript code and supply it to the Highcharts for Python Toolkit without having to convert case or conventions. But if you are constructing and configuring something directly in Python using explicit deserialization methods, you can use snake_case if you prefer (and most Python developers will prefer).

    For example, if you supply a JSON file to a from_json() method, that file can leverage Highcharts (JS) natural camelCase convention OR Highcharts for Python’s snake_case convention.

    Warning

    Note that this dual-convention support only applies to deserialization methods and does not apply to the Highcharts for Python __init__() class constructors. All __init__() methods expect snake_case properties to be supplied as keywords.

  4. All outputs from serialization methods (e.g. to_dict() or to_js_literal()) will produce outputs that are Highcharts (JS)-compatible, meaning that they apply the camelCase convention.

Tip

Best Practice

If you are using external files to provide templates or themes for your Highcharts data visualizations, produce those external files using Highcharts JS’ natural camelCase convention. That will make it easier to re-use them elsewhere within a JavaScript context if you need to in the future.

Standard Methods

Every single object supported by the Highcharts Core JavaScript API corresponds to a Python class in Highcharts Core for Python. These classes generally inherit from the HighchartsMeta metaclass, which provides each class with a number of standard methods.

These methods are the “workhorses” of the Highcharts for Python Toolkit and you will be relying heavily on them when using the library. Thankfully, their signatures and behavior is generally consistent - even if what happens “under the hood” is class-specific at times.

Deserialization Methods

classmethod from_js_literal(cls, as_string_or_file, allow_snake_case=True)

Convert a JavaScript object defined using JavaScript object literal notation into a Highcharts for Python Python object, typically descended from HighchartsMeta.

Parameters:
  • cls (type) – The class object itself.

  • as_string_or_file (str) – The JavaScript object you wish to convert. Expects either a str containing the JavaScript object, or a path to a file which consists of the object.

  • allow_snake_case (bool) – If True, allows keys in as_string_or_file to apply the snake_case convention. If False, will ignore keys that apply the snake_case convention and only process keys that use the camelCase convention. Defaults to True.

Returns:

A Highcharts for Python object corresponding to the JavaScript object supplied in as_string_or_file.

Return type:

Descendent of HighchartsMeta

classmethod from_json(cls, as_json_or_file, allow_snake_case=True)

Convert a Highcharts JS object represented as JSON (in either str or bytes form, or as a file name) into a Highcharts for Python object, typically descended from HighchartsMeta.

Parameters:
  • cls (type) – The class object itself.

  • as_json_or_file (str or bytes) – The JSON object you wish to convert, or a filename that contains the JSON object that you wish to convert.

  • allow_snake_case (bool) – If True, allows keys in as_json to apply the snake_case convention. If False, will ignore keys that apply the snake_case convention and only process keys that use the camelCase convention. Defaults to True.

Returns:

A Highcharts for Python Python object corresponding to the JSON object supplied in as_json.

Return type:

Descendent of HighchartsMeta

classmethod from_dict(cls, as_dict, allow_snake_case=True)

Convert a dict representation of a Highcharts JS object into a Python object representation, typically descended from HighchartsMeta.

Parameters:
  • cls (type) – The class object itself.

  • as_dict (dict) – The dict representation of the object.

  • allow_snake_case (bool) – If True, allows keys in as_dict to apply the snake_case convention. If False, will ignore keys that apply the snake_case convention and only process keys that use the camelCase convention. Defaults to True.

Serialization Methods

to_js_literal(self, filename=None, encoding='utf-8')

Convert the Highcharts for Python instance to Highcharts JS-compatible JavaScript code using JavaScript object literal notation.

Parameters:
  • filename (Path-like or None) – If supplied, persists the JavaScript code to the file indicated. Defaults to None.

  • encoding (str) – Indicates the character encoding to use when producing the JavaScript literal string. Defaults to 'utf-8'.

Returns:

Highcharts JS-compatible JavaScript code using JavaScript object literal notation.

Return type:

str

to_json(self, filename=None, encoding='utf-8')

Convert the Highcharts for Python instance to Highcharts JS-compatible JSON.

Warning

While similar, JSON is inherently different from JavaScript object literal notation. In particular, it cannot include JavaScript functions. This means if you try to convert a Highcharts for Python object to JSON, any properties that are CallbackFunction instances will not be included. If you want to convert those functions, please use .to_js_literal() instead.

Parameters:
  • filename (Path-like or None) – If supplied, persists the JSON is persisted to the file indicated. Defaults to None.

  • encoding (str) – Indicates the character encoding to use when producing the JSON. Defaults to 'utf-8'.

Returns:

Highcharts JS-compatible JSON representation of the object.

Return type:

str or bytes

Note

Highcharts for Python works with different JSON encoders. If your environment has orjson, for example, the result will be returned as a bytes instance. Otherwise, the library will fallback to various other JSON encoders until finally falling back to the Python standard library’s JSON encoder/decoder.

to_dict(self)

Convert the Highcharts for Python object into a Highcharts JS-compatible dict object.

Returns:

Highcharts JS-compatible dict object

Return type:

dict

Other Convenience Methods

copy(self, other, overwrite=True, **kwargs)

Copy the properties from self to other.

Parameters:
  • other (HighchartsMeta) – The target instance to which the properties of this instance should be copied.

  • overwrite (bool) – if True, properties in other that are already set will be overwritten by their counterparts in self. Defaults to True.

  • kwargs – Additional keyword arguments. Some special descendents of HighchartsMeta may have special implementations of this method which rely on additional keyword arguments.

Returns:

A mutated version of other with new property values

Raises:

HighchartsValueError – if other is not the same class as (or subclass of) self

Handling Default Values

Explicit is better than implicit. – The Zen of Python

Highcharts has a lot of default values. These default values are generally applied if a JavaScript property is undefined (missing or otherwise not specified), which is different from the JavaScript value of null.

While our Pythonic instinct is to:

  • indicate those default values explicitly in the Highcharts for Python code as keyword argument defaults, and

  • return those default values in the serialized form of any Highcharts for Python objects

doing so would introduce a massive problem: It would bloat data transferred on the wire unnecessarily.

The way that Highcharts (JS) handles defaults is an elegant compromise between explicitness and the practical reality of making your code readable. Why make a property explicit in a configuration string if you don’t care about it? Purity is only valuable to a point. And with thousands of properties across the Highcharts (JS) suite, nobody wants to transmit or maintain thousands of property configurations if it can be avoided.

For that reason, the Highcharts for Python Toolkit explicitly breaks Pythonic convention: when an object’s property returns None, that has the equivalent meaning of “Highcharts (JS) will apply the Highcharts default for this property”. These properties will not be serialized, either to a JS literal, nor to a dict, nor to JSON. This has the advantage of maintaining consistent behavior with the Highcharts (JS) suite while still providing an internally consistent logic to follow.

Note

There’s an item on the Highcharts for Python roadmap (#12) to optionally surface defaults when explicitly requested. Not sure when it will be implemented, but we’ll get there at some point.

Module Structure

The structure of the Highcharts Core for Python library closely matches the structure of the Highcharts Core options object (see the relevant reference documentation).

At the root of the library - importable from highcharts_core you will find the highcharts_core.highcharts module. This module is a catch-all importable module, which allows you to easily access the most-commonly-used Highcharts for Python classes and modules.

Note

Whlie you can access all of the Highcharts Core for Python classes from highcharts_core.highcharts, if you want to more precisely navigate to specific class definitions you can do fairly easily using the folder organization and naming conventions used in the library.

This is the recommended best practice to maximize performance.

In the root of the highcharts_core library you can find universally-shared class definitions, like .metaclasses which contains the HighchartsMeta definition and the JavaScriptDict definition or .decorators which define method/property decorators that are used throughout the library.

The .utility_classes folder contains class definitions for classes that are referenced or used throughout the other class definitions.

And you can find the Highcharts Core options object and all of its properties defined in the .options module, with specific (complicated or extensive) sub-folders providing property-specific classes (e.g. the .options.plot_options module defines all of the different configuration options for different series types, while the .options.series module defines all of the classes that represent series of data in a given chart).

Class Structures and Inheritance

Highcharts for Python objects re-use many of the same properties. This is one of the strengths of the Highcharts API, in that it is internally consistent and that behavior configured on one object should be readily transferrable to a second object provided it shares the same properties. However, Highcharts has a lot of properties. We estimate that the options.plotOptions objects and their sub-properties have close to 3,000 properties. But because they are heavily repeated, those 3,000 or so properties can be reduced to only 421 unique property names. That’s almost an 85% reduction.

DRY is an important principle in software development. Can you imagine propagating changes in seven places (on average) in your code? That would be a maintenance nightmare! And it is exactly the kind of maintenance nightmare that class inheritance was designed to fix.

For that reason, the Highcharts for Python Toolkit classes have a deeply nested inheritance structure. This is important to understand both for evaluating isinstance() checks in your code, or for understanding how to further subclass Highcharts for Python components.

See also

For more details, please review the API documentation, in particular the class inheritance diagrams included for each documented class.

Warning

Certain sections of the Highcharts for Python Toolkit - in particular the options.series classes - rely heavily on multiple inheritance. This is a known anti-pattern in Python development as it runs the risk of encountering the diamond of death inheritance problem. This complicates the process of inheriting methods or properties from parent classes when properties or methods share names across multiple parents.

We know this the diamond of death is an anti-pattern, but it was a necessary one to minimize code duplication and maximize consistency. For that reason, we implemented it properly despite the anti-pattern, using some advanced Python concepts to navigate the Python MRO (Method Resolution Order) system cleanly. However, an awareness of the pattern used may prove helpful if your code inherits from the Highcharts for Python classes.

See also

For a more in-depth discussion of how the anti-pattern was implemented safely and reliably, please review the Contributor Guidelines.


Core Components

Module

Classes / Functions

.chart

Chart

.global_options

.global_options.language

Language

.global_options.language.accessibility

AccessibilityLanguageOptions

.global_options.language.accessibility.announce_new_data

AnnounceNewDataLanguageOptions

.global_options.language.accessibility.axis

AxisLanguageOptions

.global_options.language.accessibility.chart_types

ChartTypesLanguageOptions

.global_options.language.accessibility.exporting

ExportingLanguageOptions

.global_options.language.accessibility.legend

LegendLanguageOptions

global_options.language.accessibility.navigator

NavigatorLanguageOptions

.global_options.language.accessibility.range_selector

RangeSelectorLanguageOptions

.global_options.language.accessibility.screen_reader_section

ScreenReaderSectionLanguageOptions ScreenReaderSectionAnnotationLanguage

.global_options.language.accessibility.series

SeriesLanguageOptions SeriesSummaryLanguageOptions SeriesTypeDescriptions

.global_options.language.accessibility.sonification

SonificationLanguageOptions

.global_options.language.accessibility.table

TableLanguageOptions

.global_options.language.accessibility.zoom

ZoomLanguageOptions

.global_options.language.export_data

ExportDataLanguageOptions

.global_options.language.navigation

NavigationLanguageOptions PopupLanguageOptions

.global_options.shared_options

SharedOptions

.headless_export

ExportServer

.highcharts

(most classes from across the rest of the API)

.options

HighchartsOptions Options

.options.accessibility

Accessibility CustomAccessibilityComponents

.options.accessibility.announce_new_data

AnnounceNewData

.options.accessibility.keyboard_navigation

KeyboardNavigation

.options.accessibility.keyboard_navigation.focus_border

FocusBorder FocusBorderStyle

.options.accessibility.keyboard_navigation.series_navigation

SeriesNavigation

options.accessibility.point

AccessibilityPoint

options.accessibility.screen_reader_section

ScreenReaderSection

options.accessibility.series

SeriesAccessibility

.options.annotations

Annotation

.options.annotations.animation

AnnotationAnimation

.options.annotations.control_point_options

AnnotationControlPointOption

.options.annotations.events

AnnotationEvent

.options.annotations.label_options

AnnotationLabel AnnotationLabelOptionAccessibility LabelOptions

.options.annotations.options.annotations.points

AnnotationPoint

.options.annotations.shape_options

AnnotationShape ShapeOptions

.options.axes

.options.axes.accessibility

AxisAccessibility

.options.axes.breaks

AxisBreak

.options.axes.color_axis

ColorAxis

.options.axes.crosshair

CrosshairOptions

.options.axes.data_classes

DataClass

.options.axes.generic

GenericAxis

.options.axes.labels

AxisLabelOptions PlotBandLabel PlotLineLabel

.options.axes.markers

AxisMarker

.options.axes.numeric

NumericAxis

.options.axes.parallel_axes

ParallelAxesOptions

.options.axes.plot_bands

PlotBand PlotLine

.options.axes.title

AxisTitle

.options.axes.x_axis

XAxis

.options.axes.y_axis

YAxis StackShadow

.options.axes.z_axis

ZAxis

.options.boost

Boost BoostDebug

.options.caption

Caption

.options.chart

ChartOptions PanningOptions

.options.chart.options_3d

Options3D Frame PanelOptions

.options.chart.reset_zoom_button

ResetZoomButtonOptions

.options.chart.scrollable_plot_area

ScrollablePlotArea

.options.chart.zooming

ZoomingOptions MouseWheelOptions

.options.credits

Credits CreditStyleOptions

.options.data

Data

.options.defs

MarkerDefinition MarkerASTNode MarkerAttributeObject

.options.drilldown

Drilldown

.options.exporting

Exporting ExportingAccessibilityOptions

.options.exporting.csv

ExportingCSV CSVAnnotationOptions

.options.exporting.exporting.pdf_font

PDFFontOptions

.options.legend

Legend

.options.legend.accessibility

LegendAccessibilityOptions LegendKeyboardNavigation

.options.legend.bubble_legend

BubbleLegend BubbleLegendRange BubbleLegendLabelOptions

.options.legend.navigation

LegendNavigation

.options.legend.title

LegendTitle

.options.loading

Loading

.options.navigation

Navigation

.options.navigation.bindings

Bindings RectangleAnnotationBinding LabelAnnotationBinding EllipseAnnotationBinding CircleAnnotationBinding Binding

.options.no_data

NoData

.options.pane

Pane PaneBackground

.options.plot_options

PlotOptions

.options.plot_options.accessibility

TypeOptionsAccessibility SeriesKeyboardNavigation

.options.plot_options.arcdiagram

ArcDiagramOptions

.options.plot_options.area

AreaOptions AreaRangeOptions AreaSplineOptions AreaSplineRangeOptions LineOptions StreamGraphOptions

.options.plot_options.bar

BarOptions ColumnOptions ColumnPyramidOptions ColumnRangeOptions CylinderOptions VariwideOptions WaterfallOptions WindBarbOptions XRangeOptions BaseBarOptions

.options.plot_options.bellcurve

BellCurveOptions

.options.plot_options.boxplot

BoxPlotOptions ErrorBarOptions

.options.plot_options.bubble

BubbleOptions

.options.plot_options.bullet

BulletOptions TargetOptions

.options.plot_options.data_sorting

DataSorting

.options.plot_options.dependencywheel

DependencyWheelOptions

.options.plot_options.drag_drop

DragDropOptions HighLowDragDropOptions BoxPlotDragDropOptions BulletDragDropOptions GuideBox GuideBoxOptions DragHandle

.options.plot_options.dumbbell

DumbbellOptions LollipopOptions

.options.plot_options.funnel

FunnelOptions Funnel3DOptions

.options.plot_options.gauge

GaugeOptions SolidGaugeOptions

.options.plot_options.generic

GenericTypeOptions

.options.plot_options.heatmap

HeatmapOptions TilemapOptions

.options.plot_options.histogram

HistogramOptions

.options.plot_options.item

ItemOptions

.options.plot_options.levels

LevelOptions SunburstLevelOptions TreemapLevelOptions LevelSize ColorVariation BaseLevelOptions

.options.plot_options.link

LinkOptions

.options.plot_options.networkgraph

NetworkGraphOptions LayoutAlgorithm

.options.plot_options.organization

OrganizationOptions

.options.plot_options.packedbubble

PackedBubbleOptions ParentNodeOptions

.options.plot_options.pareto

ParetoOptions

.options.plot_options.pictorial

PictorialOptions

.options.plot_options.pie

PieOptions VariablePieOptions

.options.plot_options.points

Point OnPointOptions ConnectorOptions

.options.plot_options.polygon

PolygonOptions

.options.plot_options.pyramid

PyramidOptions Pyramid3DOptions

.options.plot_options.sankey

SankeyOptions

.options.plot_options.scatter

ScatterOptions Scatter3DOptions

.options.plot_options.series

SeriesOptions

.options.plot_options.sonification

SeriesSonification

.options.plot_options.spline

SplineOptions

.options.plot_options.sunburst

SunburstOptions

.options.plot_options.timeline

TimelineOptions

.options.plot_options.treegraph

TreegraphOptions TreegraphEvents

.options.plot_options.treemap

TreemapOptions

.options.plot_options.vector

VectorOptions

.options.plot_options.venn

VennOptions

.options.plot_options.wordcloud

WordcloudOptions RotationOptions

.options.responsive

Responsive ResponsiveRules Condition

.options.series

.options.series.arcdiagram

ArcDiagramSeries

.options.series.area

AreaSeries AreaRangeSeries AreaSplineSeries AreaSplineRangeSeries LineSeries StreamGraphSeries

.options.series.bar

BarSeries ColumnSeries ColumnPyramidSeries ColumnRangeSeries CylinderSeries VariwideSeries WaterfallSeries WindBarbSeries XRangeSeries BaseBarSeries

.options.series.base

SeriesBase

.options.series.bellcurve

BellCurveSeries

.options.series.boxplot

BoxPlotSeries ErrorBarSeries

.options.series.bubble

BubbleSeries

.options.series.bullet

BulletSeries

.options.series.data

.options.series.data.accessibility

DataPointAccessibility

.options.series.data.arcdiagram

ArcDiagramData ArcDiagramDataCollection

.options.series.data.bar

BarData BarDataCollection WaterfallData WaterfallDataCollection WindBarbData WindBarbDataCollection XRangeData XRangeDataCollection

.options.series.data.base

DataBase

.options.series.data.boxplot

BoxPlotData BoxPlotDataCollection

.options.series.data.bullet

BulletData BulletDataCollection

.options.series.data.cartesian

CartesianData CartesianDataCollection Cartesian3DData Cartesian3DDataCollection CartesianValueData CartesianValueDataCollection

.options.series.data.collections

DataPointCollection

.options.series.data.connections

ConnectionData ConnectionDataCollection WeightedConnectionData WeightedConnectionDataCollection OutgoingWeightedConnectionData OutgoingWeightedConnectionDataCollection ConnectionBase

.options.series.data.pie

PieData PieDataCollection VariablePieData VariablePieDataCollection

.options.series.data.range

RangeData RangeDataCollection ConnectedRangeData ConnectedRangeDataCollection

.options.series.data.single_point

SinglePointData SinglePointDataCollection SingleValueData SingleValueDataCollection SingleXData SingleXDataCollection LabeledSingleXData LabeledSingleXDataCollection ConnectedSingleXData ConnectedSingleXDataCollection SinglePointBase

.options.series.data.sunburst

SunburstData SunburstDataCollection

.options.series.data.treegraph

TreegraphData TreegraphDataCollection

.options.series.data.treemap

TreemapData TreemapDataCollection

.options.series.data.vector

VectorData VectorDataCollection

.options.series.data.venn

VennData VennDataCollection

.options.series.data.wordcloud

WordcloudData WordcloudDataCollection

.options.series.dependencywheel

DependencyWheelSeries

.options.series.dumbbell

DumbbellSeries LollipopSeries

.options.series.funnel

FunnelSeries Funnel3DSeries

.options.series.gauge

GaugeSeries SolidGaugeSeries

.options.series.heatmap

HeatmapSeries TilemapSeries

.options.series.histogram

HistogramSeries

.options.series.item

ItemSeries

.options.series.labels

SeriesLabel Box

.options.series.networkgraph

NetworkGraphSeries

.options.series.organization

OrganizationSeries

.options.series.packedbubble

PackedBubbleSeries

.options.series.pareto

ParetoSeries

.options.series.pictorial

PictorialSeries PictorialPaths

.options.series.pie

PieSeries VariablePieSeries

.options.series.polygon

PolygonSeries

.options.series.pyramid

PyramidSeries Pyramid3DSeries

.options.series.sankey

SankeySeries

.options.series.scatter

ScatterSeries Scatter3DSeries

.options.series.series_generator

create_series_obj()

.options.series.spline

SplineSeries

.options.series.sunburst

SunburstSeries

.options.series.timeline

TimelineSeries

.options.series.treegraph

TreegraphSeries

.options.series.treemap

TreemapSeries

.options.series.vector

VectorSeries

.options.series.venn

VennSeries

.options.series.wordcloud

WordcloudSeries

.options.sonification

SonificationOptions

.options.sonification.grouping

PointGrouping

.options.sonification.mapping

SonificationMapping AudioParameter AudioFilter PitchParameter TremoloEffect

.options.sonification.track_configurations

InstrumentTrackConfiguration SpeechTrackConfiguration ContextTrackConfiguration TrackConfigurationBase ActiveWhen

.options.subtitle

Subtitle

.options.time

Time

.options.title

Title

.options.tooltips

Tooltip

.utility_classes

.utility_classes.animation

AnimationOptions

.utility_classes.ast

ASTMap ASTNode TextPath AttributeObject

.utility_classes.border_radius

BorderRadius

.utility_classes.breadcrumbs

BreadcrumbOptions Separator

.utility_classes.buttons

ExportingButtons CollapseButtonConfiguration ContextButtonConfiguration ButtonConfiguration ButtonTheme

.utility_classes.clusters

ClusterOptions VectorLayoutAlgorithm

.utility_classes.data_grouping

DataGroupingOptions

.utility_classes.data_labels

DataLabel PieDataLabel SunburstDataLabel OrganizationDataLabel NodeDataLabel Filter

.utility_classes.date_time_label_formats

DateTimeLabelFormats

.utility_classes.events

ChartEvents BreadcrumbEvents NavigationEvents PointEvents SeriesEvents SimulationEvents ClusterEvents AxisEvents MouseEvents

.utility_classes.gradients

Gradient LinearGradient RadialGradient

.utility_classes.javascript_functions

CallbackFunction JavaScriptClass VariableName

.utility_classes.jitter

Jitter

.utility_classes.markers

Marker

.utility_classes.menus

MenuObject MenuItem

.utility_classes.nodes

NodeOptions DependencyWheelNodeOptions OrganizationNodeOptions

.utility_classes.partial_fill

PartialFillOptions

.utility_classes.patterns

Pattern PatternOptions

.utility_classes.position

Position

.utility_classes.shadows

ShadowOptions

.utility_classes.states

States HoverState InactiveState NormalState SelectState

.utility_classes.zones

Zone ClusterZone

Library Internals

While most users will be interacting with the Core Components of Highcharts for Python, you may need (or choose to) work with various internals of the library. If you’re Contributing to Highcharts for Python to the library, then you will definitely need to familiarize yourself with these internals.

Module

Classes / Functions

.metaclasses

HighchartsMeta JavaScriptDict

.decorators

@class_sensitive() validate_types()

.js_literal_functions

serialize_to_js_literal() attempt_variable_declaration() is_js_function_or_class() get_js_literal() assemble_js_literal() convert_js_literal_to_python() convert_js_property_to_python() convert_js_to_python() get_key_value_pairs()

.utility_functions

mro_to_dict() get_remaining_mro() mro__to_untrimmed_dict() validate_color() to_camelCase() to_snake_case() parse_csv()

.ai

convert_to_js() openai_moderate() openai_conversion() anthropic_conversion() get_source()