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
See an example from ElevenLabs using this process in their [Python SDK](https://github.com/elevenlabs/elevenlabs-python/blob/main/src/elevenlabs/client.py).
@@ -64,9 +52,9 @@ To get started adding custom code:
64
52
<Steps>
65
53
### Update `generators.yml` configuration
66
54
67
-
To add a custom method to the Python SDK, you will need to configure the
68
-
generator to output the client in a file called `base_client.py`. Then, you can
69
-
extend the base client and add whatever methods you want.
55
+
Name your Fern-generated client something like `BaseClient`to reflect
56
+
that this client will be extended. Configure the generator to output the
57
+
client in a file called `base_client.py`.
70
58
71
59
```yaml {4-8} title="generators.yml"
72
60
- name: fernapi/fern-python-sdk
@@ -90,17 +78,15 @@ To get started adding custom code:
90
78
91
79
First, import the Fern generated base clients from `.base_client.py` and extend them to create your custom clients. Then, add whatever methods you want.
92
80
93
-
```python title="src/<package>/client.py"
94
-
from .base_client import \
95
-
BaseClient
96
-
97
-
class YourClient(BaseClient):
98
-
99
-
def my_helper(self) -> None
100
-
print("Hello World")
101
-
102
-
```
103
-
81
+
```python title="src/<package>/client.py"
82
+
from .base_client import BaseClient // import generated client
83
+
84
+
class YourClient(BaseClient): // extend generated client
85
+
def my_helper(self) -> None:
86
+
print("Hello World!")
87
+
def my_helper(self) -> None:
88
+
print("Hello World")
89
+
```
104
90
<Note>
105
91
See an example [client.py](https://github.com/elevenlabs/elevenlabs-python/blob/main/src/elevenlabs/client.py) from ElevenLabs.
106
92
</Note>
@@ -121,7 +107,7 @@ To get started adding custom code:
121
107
122
108
### Consume the method
123
109
124
-
Now your users can consume the helper function by importing it from the SDK:
0 commit comments