# Python SDK

A Konduit Serving instance can be created by:&#x20;

1. creating a Python object of the `Server` class using&#x20;
   1. the `Server()` function; or&#x20;
   2. the `server_from_file()` function from the `konduit.load` module; and&#x20;
2. starting the server using the `.start()` method of the `Server` object created in step 1.&#x20;

We will use the `server_from_file()` function to configure Konduit Serving in this example.

In Python, specify the path to your configuration in `konduit_yaml_path`:&#x20;

```python
konduit_yaml_path = "hello-world.yaml"
```

Initialize a Konduit Serving instance with the following code:&#x20;

```python
from konduit.load import server_from_file 
server = server_from_file(konduit_yaml_path)
server.start()
```

Note that the file also contains Client configuration. To create a `Client` object, use the `client_from_file()` function from the `konduit.load` module:

```python
from konduit.load import client_from_file 
client = client_from_file(konduit_yaml_path)
```

The `Client` class provides a `.predict()` method that sends data to the Serving instance. First, create some sample data as a NumPy array:

```python
import numpy as np 
data_input = np.ones(5)
```

Assuming your data is declared in the `data_input` object, data can be passed to `client` for prediction using:

```python
client.predict(data_input)
```

The `.predict()` method takes a single argument `data_input` which is typically a dictionary. A NumPy array can be directly passed to the `.predict()` method if the input name is `default`.

## Next steps&#x20;

To build configurations using the YAML format, check out the YAML configurations page:&#x20;

{% content-ref url="/pages/-Lv4m-FMeX0mEGNtY8JE" %}
[YAML configurations](/0.1.0-snapshot/yaml-configurations.md)
{% endcontent-ref %}

YAML configurations are sufficient for most use cases. In particular, if your use case:&#x20;

* does not involve DataVec transformations,&#x20;
* for Python steps: has one transformation script at each pipeline step,

then you should use a YAML configuration.&#x20;

For more complex configurations, you should use the Python SDK. To build configurations with Python steps, start with the Python pipeline steps page:

{% content-ref url="/pages/-LtNeobIL9\_JE8lXIz6S" %}
[Python pipeline steps](/0.1.0-snapshot/steps/python.md)
{% endcontent-ref %}

To build configurations in Python with TensorFlow, DL4J and Keras models using DL4J and JavaCPP Presets, refer to the example for the respective framework:

{% content-ref url="/pages/-Lupw-aLrZSPXWeB9hMA" %}
[TensorFlow (1.x)](/0.1.0-snapshot/examples/python/tensorflow-model-serving.md)
{% endcontent-ref %}

{% content-ref url="/pages/-LuptbQpkK76qsdqbAd6" %}
[Broken mention](broken://pages/-LuptbQpkK76qsdqbAd6)
{% endcontent-ref %}

{% content-ref url="/pages/-Lv4jqWJf9I0LtMWQkJ3" %}
[Keras (TensorFlow 2.0)](/0.1.0-snapshot/examples/python/keras.md)
{% endcontent-ref %}

To build ETL processes into your serving pipeline, refer to the DataVec example:&#x20;

{% content-ref url="/pages/-LuptvmFAcwPZJOvHxpT" %}
[DataVec](/0.1.0-snapshot/examples/python/datavec.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://serving.konduit.ai/0.1.0-snapshot/quickstart/quickstart-python.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
