@@ -556,6 +556,9 @@ paths:
556556
557557 /prompts/{promptId}/render:
558558 post:
559+ servers:
560+ - url: https://api.portkey.ai/v1
561+ - url: SELF_HOSTED_GATEWAY_URL/v1
559562 operationId: createPromptRender
560563 tags:
561564 - Prompts
@@ -603,6 +606,7 @@ paths:
603606
604607 x-code-samples:
605608 - lang: "cURL"
609+ label: Default
606610 source: |
607611 curl -X POST "https://api.portkey.ai/v1/prompts/YOUR_PROMPT_ID/render" \
608612 -H "Content-Type: application/json" \
@@ -615,6 +619,7 @@ paths:
615619 "presence_penalty": 0.2
616620 }'
617621 - lang: Python
622+ label: Default
618623 source: |
619624 from portkey_ai import Portkey
620625
@@ -634,6 +639,7 @@ paths:
634639 print(completion)
635640
636641 - lang: "JavaScript"
642+ label: Default
637643 source: |
638644 import Portkey from 'portkey-ai';
639645
@@ -651,6 +657,63 @@ paths:
651657 });
652658
653659 console.log(completion);
660+ - lang: "cURL"
661+ label: Self-Hosted
662+ source: |
663+ curl -X POST "SELF_HOSTED_GATEWAY_URL/v1/prompts/YOUR_PROMPT_ID/render" \
664+ -H "Content-Type: application/json" \
665+ -H "x-portkey-api-key: $PORTKEY_API_KEY" \
666+ -d '{
667+ "variables": {
668+ "user_input": "Hello world"
669+ },
670+ "max_tokens": 250,
671+ "presence_penalty": 0.2
672+ }'
673+ - lang: Python
674+ label: Self-Hosted
675+ source: |
676+ from portkey_ai import Portkey
677+
678+ client = Portkey(
679+ api_key="PORTKEY_API_KEY",
680+ base_url="SELF_HOSTED_GATEWAY_URL"
681+ )
682+
683+ completion = client.prompts.render(
684+ prompt_id="YOUR_PROMPT_ID",
685+ variables={
686+ "user_input": "Hello world"
687+ },
688+ max_tokens=250,
689+ presence_penalty=0.2
690+ )
691+
692+ print(completion)
693+
694+ - lang: "JavaScript"
695+ label: Self-Hosted
696+ source: |
697+ import Portkey from 'portkey-ai';
698+
699+ const portkey = new Portkey({
700+ apiKey: 'PORTKEY_API_KEY',
701+ baseUrl: 'SELF_HOSTED_GATEWAY_URL'
702+ });
703+
704+ const completion = await portkey.prompts.render({
705+ promptId: "YOUR_PROMPT_ID",
706+ variables: {
707+ user_input: "Hello world"
708+ },
709+ max_tokens: 250,
710+ presence_penalty: 0.2
711+ });
712+
713+ console.log(completion);
714+
715+
716+
654717
655718 /images/generations:
656719 post:
0 commit comments