From c5a39b821328fc99a175615fc265beda84ca9fb1 Mon Sep 17 00:00:00 2001 From: Ajay Raj Date: Tue, 22 Aug 2023 11:47:34 -0700 Subject: [PATCH] merge staging docs (#367) * checkpoint. routes first pass done, schemas not working * progress * restore some changes * change outline * update hosted quickstart * create docs for getting number (#293) * update code snippets for getting-number * finish using-actions * Add configuring numbers page * updates * nit * retrieve call data draft * use new openapi schema * updates * polish * schemas tab * Add vector db docs * vector db updates * update voices and add multilingual docs * context injection docs * remove environment params * adds dashboard link --------- Co-authored-by: Kian Co-authored-by: Hayden Housen Co-authored-by: zaptrem --- docs/agents.mdx | 10 + docs/api-reference/actions/create-action.mdx | 3 + docs/api-reference/actions/get-action.mdx | 3 + docs/api-reference/actions/list-actions.mdx | 3 + docs/api-reference/actions/update-action.mdx | 3 + docs/api-reference/agents/create-agent.mdx | 3 + docs/api-reference/agents/get-agent.mdx | 3 + docs/api-reference/agents/list-agents.mdx | 3 + docs/api-reference/agents/update-agent.mdx | 3 + docs/api-reference/calls/create-call.mdx | 3 + docs/api-reference/calls/end-call.mdx | 3 + docs/api-reference/calls/get-call.mdx | 3 + docs/api-reference/calls/list-calls.mdx | 3 + docs/api-reference/numbers/buy-number.mdx | 3 + docs/api-reference/numbers/cancel-number.mdx | 3 + docs/api-reference/numbers/get-number.mdx | 3 + docs/api-reference/numbers/list-numbers.mdx | 3 + docs/api-reference/numbers/update-number.mdx | 3 + docs/api-reference/schemas/action-config.mdx | 3 + docs/api-reference/schemas/action-type.mdx | 3 + docs/api-reference/usage/get-usage.mdx | 3 + docs/api-reference/voices/create-voice.mdx | 3 + docs/api-reference/voices/get-voice.mdx | 3 + docs/api-reference/voices/list-voices.mdx | 3 + docs/api-reference/voices/update-voice.mdx | 3 + .../api-reference/webhooks/create-webhook.mdx | 3 + docs/api-reference/webhooks/get-webhook.mdx | 3 + docs/api-reference/webhooks/list-webhooks.mdx | 3 + .../api-reference/webhooks/update-webhook.mdx | 3 + docs/call-object.mdx | 4 + docs/configuring-number.mdx | 190 ++ docs/getting-number.mdx | 38 + docs/hosted-quickstart.mdx | 85 + docs/how-to-use-it.mdx | 2 +- docs/inbound-calls.mdx | 8 + docs/injecting-context.mdx | 57 + docs/mint.json | 140 +- docs/multilingual.mdx | 41 + docs/open-source-quickstart.mdx | 39 + docs/{ => open-source}/action-agents.mdx | 0 docs/{ => open-source}/agent-factory.mdx | 0 docs/{ => open-source}/agent-reference.mdx | 0 docs/{ => open-source}/agent.mdx | 0 .../create-your-own-agent.mdx | 0 docs/{ => open-source}/events-manager.mdx | 0 docs/{ => open-source}/langchain-agent.mdx | 0 docs/{ => open-source}/language-support.mdx | 0 docs/{ => open-source}/local-conversation.mdx | 0 docs/{ => open-source}/playground.mdx | 0 docs/{ => open-source}/python-quickstart.mdx | 0 docs/{ => open-source}/react-quickstart.mdx | 0 .../synthesizer-reference.mdx | 0 docs/{ => open-source}/synthesizer.mdx | 0 docs/{ => open-source}/telephony.mdx | 0 docs/{ => open-source}/tracing.mdx | 0 .../transcriber-reference.mdx | 0 docs/{ => open-source}/transcriber.mdx | 0 .../turn-based-conversation.mdx | 0 docs/{ => open-source}/using-synthesizers.mdx | 0 docs/{ => open-source}/using-transcribers.mdx | 0 docs/openapi.json | 1671 +++++++++++++++++ docs/outbound-calls.mdx | 4 + docs/retrieve-call-data.mdx | 109 ++ docs/setting-up-webhook.mdx | 59 + docs/using-actions.mdx | 194 ++ docs/vectordb.mdx | 115 ++ docs/webhooks.mdx | 4 + docs/welcome.mdx | 66 +- 68 files changed, 2853 insertions(+), 67 deletions(-) create mode 100644 docs/agents.mdx create mode 100644 docs/api-reference/actions/create-action.mdx create mode 100644 docs/api-reference/actions/get-action.mdx create mode 100644 docs/api-reference/actions/list-actions.mdx create mode 100644 docs/api-reference/actions/update-action.mdx create mode 100644 docs/api-reference/agents/create-agent.mdx create mode 100644 docs/api-reference/agents/get-agent.mdx create mode 100644 docs/api-reference/agents/list-agents.mdx create mode 100644 docs/api-reference/agents/update-agent.mdx create mode 100644 docs/api-reference/calls/create-call.mdx create mode 100644 docs/api-reference/calls/end-call.mdx create mode 100644 docs/api-reference/calls/get-call.mdx create mode 100644 docs/api-reference/calls/list-calls.mdx create mode 100644 docs/api-reference/numbers/buy-number.mdx create mode 100644 docs/api-reference/numbers/cancel-number.mdx create mode 100644 docs/api-reference/numbers/get-number.mdx create mode 100644 docs/api-reference/numbers/list-numbers.mdx create mode 100644 docs/api-reference/numbers/update-number.mdx create mode 100644 docs/api-reference/schemas/action-config.mdx create mode 100644 docs/api-reference/schemas/action-type.mdx create mode 100644 docs/api-reference/usage/get-usage.mdx create mode 100644 docs/api-reference/voices/create-voice.mdx create mode 100644 docs/api-reference/voices/get-voice.mdx create mode 100644 docs/api-reference/voices/list-voices.mdx create mode 100644 docs/api-reference/voices/update-voice.mdx create mode 100644 docs/api-reference/webhooks/create-webhook.mdx create mode 100644 docs/api-reference/webhooks/get-webhook.mdx create mode 100644 docs/api-reference/webhooks/list-webhooks.mdx create mode 100644 docs/api-reference/webhooks/update-webhook.mdx create mode 100644 docs/call-object.mdx create mode 100644 docs/configuring-number.mdx create mode 100644 docs/getting-number.mdx create mode 100644 docs/hosted-quickstart.mdx create mode 100644 docs/inbound-calls.mdx create mode 100644 docs/injecting-context.mdx create mode 100644 docs/multilingual.mdx create mode 100644 docs/open-source-quickstart.mdx rename docs/{ => open-source}/action-agents.mdx (100%) rename docs/{ => open-source}/agent-factory.mdx (100%) rename docs/{ => open-source}/agent-reference.mdx (100%) rename docs/{ => open-source}/agent.mdx (100%) rename docs/{ => open-source}/create-your-own-agent.mdx (100%) rename docs/{ => open-source}/events-manager.mdx (100%) rename docs/{ => open-source}/langchain-agent.mdx (100%) rename docs/{ => open-source}/language-support.mdx (100%) rename docs/{ => open-source}/local-conversation.mdx (100%) rename docs/{ => open-source}/playground.mdx (100%) rename docs/{ => open-source}/python-quickstart.mdx (100%) rename docs/{ => open-source}/react-quickstart.mdx (100%) rename docs/{ => open-source}/synthesizer-reference.mdx (100%) rename docs/{ => open-source}/synthesizer.mdx (100%) rename docs/{ => open-source}/telephony.mdx (100%) rename docs/{ => open-source}/tracing.mdx (100%) rename docs/{ => open-source}/transcriber-reference.mdx (100%) rename docs/{ => open-source}/transcriber.mdx (100%) rename docs/{ => open-source}/turn-based-conversation.mdx (100%) rename docs/{ => open-source}/using-synthesizers.mdx (100%) rename docs/{ => open-source}/using-transcribers.mdx (100%) create mode 100644 docs/openapi.json create mode 100644 docs/outbound-calls.mdx create mode 100644 docs/retrieve-call-data.mdx create mode 100644 docs/setting-up-webhook.mdx create mode 100644 docs/using-actions.mdx create mode 100644 docs/vectordb.mdx create mode 100644 docs/webhooks.mdx diff --git a/docs/agents.mdx b/docs/agents.mdx new file mode 100644 index 000000000..d2e168e47 --- /dev/null +++ b/docs/agents.mdx @@ -0,0 +1,10 @@ +--- +title: "Agents" +description: "🚧 Under construction" +--- + +# What are agents + +# How to configure an agent + +# API Schema diff --git a/docs/api-reference/actions/create-action.mdx b/docs/api-reference/actions/create-action.mdx new file mode 100644 index 000000000..7004502fb --- /dev/null +++ b/docs/api-reference/actions/create-action.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/actions/create +--- \ No newline at end of file diff --git a/docs/api-reference/actions/get-action.mdx b/docs/api-reference/actions/get-action.mdx new file mode 100644 index 000000000..2d91b642c --- /dev/null +++ b/docs/api-reference/actions/get-action.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/actions/ +--- \ No newline at end of file diff --git a/docs/api-reference/actions/list-actions.mdx b/docs/api-reference/actions/list-actions.mdx new file mode 100644 index 000000000..278776681 --- /dev/null +++ b/docs/api-reference/actions/list-actions.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/actions/list +--- \ No newline at end of file diff --git a/docs/api-reference/actions/update-action.mdx b/docs/api-reference/actions/update-action.mdx new file mode 100644 index 000000000..4f6c69941 --- /dev/null +++ b/docs/api-reference/actions/update-action.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/actions/update +--- \ No newline at end of file diff --git a/docs/api-reference/agents/create-agent.mdx b/docs/api-reference/agents/create-agent.mdx new file mode 100644 index 000000000..ca3436ce0 --- /dev/null +++ b/docs/api-reference/agents/create-agent.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/agents/create +--- \ No newline at end of file diff --git a/docs/api-reference/agents/get-agent.mdx b/docs/api-reference/agents/get-agent.mdx new file mode 100644 index 000000000..1c44beed8 --- /dev/null +++ b/docs/api-reference/agents/get-agent.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/agents/ +--- \ No newline at end of file diff --git a/docs/api-reference/agents/list-agents.mdx b/docs/api-reference/agents/list-agents.mdx new file mode 100644 index 000000000..7dfc2ed37 --- /dev/null +++ b/docs/api-reference/agents/list-agents.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/agents/list +--- \ No newline at end of file diff --git a/docs/api-reference/agents/update-agent.mdx b/docs/api-reference/agents/update-agent.mdx new file mode 100644 index 000000000..7aae67bd3 --- /dev/null +++ b/docs/api-reference/agents/update-agent.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/agents/update +--- \ No newline at end of file diff --git a/docs/api-reference/calls/create-call.mdx b/docs/api-reference/calls/create-call.mdx new file mode 100644 index 000000000..fe6c67a84 --- /dev/null +++ b/docs/api-reference/calls/create-call.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/calls/create +--- \ No newline at end of file diff --git a/docs/api-reference/calls/end-call.mdx b/docs/api-reference/calls/end-call.mdx new file mode 100644 index 000000000..ab86c2949 --- /dev/null +++ b/docs/api-reference/calls/end-call.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/calls/end +--- \ No newline at end of file diff --git a/docs/api-reference/calls/get-call.mdx b/docs/api-reference/calls/get-call.mdx new file mode 100644 index 000000000..fd1771b73 --- /dev/null +++ b/docs/api-reference/calls/get-call.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/calls/ +--- \ No newline at end of file diff --git a/docs/api-reference/calls/list-calls.mdx b/docs/api-reference/calls/list-calls.mdx new file mode 100644 index 000000000..e61154204 --- /dev/null +++ b/docs/api-reference/calls/list-calls.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/calls/list +--- \ No newline at end of file diff --git a/docs/api-reference/numbers/buy-number.mdx b/docs/api-reference/numbers/buy-number.mdx new file mode 100644 index 000000000..3ebd7b4b1 --- /dev/null +++ b/docs/api-reference/numbers/buy-number.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/numbers/buy +--- \ No newline at end of file diff --git a/docs/api-reference/numbers/cancel-number.mdx b/docs/api-reference/numbers/cancel-number.mdx new file mode 100644 index 000000000..01a1ac41d --- /dev/null +++ b/docs/api-reference/numbers/cancel-number.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/numbers/cancel +--- \ No newline at end of file diff --git a/docs/api-reference/numbers/get-number.mdx b/docs/api-reference/numbers/get-number.mdx new file mode 100644 index 000000000..32fa9b91c --- /dev/null +++ b/docs/api-reference/numbers/get-number.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/numbers/ +--- \ No newline at end of file diff --git a/docs/api-reference/numbers/list-numbers.mdx b/docs/api-reference/numbers/list-numbers.mdx new file mode 100644 index 000000000..d34967049 --- /dev/null +++ b/docs/api-reference/numbers/list-numbers.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/numbers/list +--- \ No newline at end of file diff --git a/docs/api-reference/numbers/update-number.mdx b/docs/api-reference/numbers/update-number.mdx new file mode 100644 index 000000000..6b2ff2b46 --- /dev/null +++ b/docs/api-reference/numbers/update-number.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/numbers/update +--- \ No newline at end of file diff --git a/docs/api-reference/schemas/action-config.mdx b/docs/api-reference/schemas/action-config.mdx new file mode 100644 index 000000000..526132b73 --- /dev/null +++ b/docs/api-reference/schemas/action-config.mdx @@ -0,0 +1,3 @@ +--- +openapi-schema: ActionConfig +--- diff --git a/docs/api-reference/schemas/action-type.mdx b/docs/api-reference/schemas/action-type.mdx new file mode 100644 index 000000000..d2394e7c2 --- /dev/null +++ b/docs/api-reference/schemas/action-type.mdx @@ -0,0 +1,3 @@ +--- +openapi-schema: ActionType +--- diff --git a/docs/api-reference/usage/get-usage.mdx b/docs/api-reference/usage/get-usage.mdx new file mode 100644 index 000000000..0cab45612 --- /dev/null +++ b/docs/api-reference/usage/get-usage.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/usage/ +--- \ No newline at end of file diff --git a/docs/api-reference/voices/create-voice.mdx b/docs/api-reference/voices/create-voice.mdx new file mode 100644 index 000000000..366f68ab1 --- /dev/null +++ b/docs/api-reference/voices/create-voice.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/voices/create +--- \ No newline at end of file diff --git a/docs/api-reference/voices/get-voice.mdx b/docs/api-reference/voices/get-voice.mdx new file mode 100644 index 000000000..5ca0e1689 --- /dev/null +++ b/docs/api-reference/voices/get-voice.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/voices/ +--- \ No newline at end of file diff --git a/docs/api-reference/voices/list-voices.mdx b/docs/api-reference/voices/list-voices.mdx new file mode 100644 index 000000000..a34e94606 --- /dev/null +++ b/docs/api-reference/voices/list-voices.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/voices/list +--- \ No newline at end of file diff --git a/docs/api-reference/voices/update-voice.mdx b/docs/api-reference/voices/update-voice.mdx new file mode 100644 index 000000000..2d9c0a2d8 --- /dev/null +++ b/docs/api-reference/voices/update-voice.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/voices/update +--- \ No newline at end of file diff --git a/docs/api-reference/webhooks/create-webhook.mdx b/docs/api-reference/webhooks/create-webhook.mdx new file mode 100644 index 000000000..b3292bef7 --- /dev/null +++ b/docs/api-reference/webhooks/create-webhook.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/webhooks/create +--- \ No newline at end of file diff --git a/docs/api-reference/webhooks/get-webhook.mdx b/docs/api-reference/webhooks/get-webhook.mdx new file mode 100644 index 000000000..64b8b79f4 --- /dev/null +++ b/docs/api-reference/webhooks/get-webhook.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/webhooks/ +--- \ No newline at end of file diff --git a/docs/api-reference/webhooks/list-webhooks.mdx b/docs/api-reference/webhooks/list-webhooks.mdx new file mode 100644 index 000000000..f02210b5a --- /dev/null +++ b/docs/api-reference/webhooks/list-webhooks.mdx @@ -0,0 +1,3 @@ +--- +openapi: get /v1/webhooks/list +--- \ No newline at end of file diff --git a/docs/api-reference/webhooks/update-webhook.mdx b/docs/api-reference/webhooks/update-webhook.mdx new file mode 100644 index 000000000..0481ac2c5 --- /dev/null +++ b/docs/api-reference/webhooks/update-webhook.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /v1/webhooks/update +--- \ No newline at end of file diff --git a/docs/call-object.mdx b/docs/call-object.mdx new file mode 100644 index 000000000..592a0eba7 --- /dev/null +++ b/docs/call-object.mdx @@ -0,0 +1,4 @@ +--- +title: "Call Object" +description: "🚧 Under construction" +--- diff --git a/docs/configuring-number.mdx b/docs/configuring-number.mdx new file mode 100644 index 000000000..61361a9b5 --- /dev/null +++ b/docs/configuring-number.mdx @@ -0,0 +1,190 @@ +--- +title: "Configuring your number" +description: "Learn how to configure your phone number with an agent." +--- + +# Configuring Numbers + +Once you have purchased a number, you can configure it with an inbound agent to set its prompt, voice, and actions. + +## Pick your Number + +First, list your numbers and pick the number you want to configure. + + + +```python Python +numbers = vocode_client.numbers.list_numbers() +``` + +```javascript TypeScript +const numbers = await vocode.numbers.listNumbers(); +``` + + + +## Changing the Prompt + +All phone numbers come with the default agent configuration. Let's change the +prompt so the AI responds like Yoda. + + + +```python Python +from vocode import AgentUpdateParams + +yoda_prompt = "I want you to act as Yoda. Respond as Yoda would." +number = vocode_client.numbers.update_number( + phone_number="YOUR_NUMBER", inbound_agent=AgentUpdateParams(prompt=yoda_prompt) +) +``` + +```javascript TypeScript +const yoda_prompt = "I want you to act as Yoda. Respond as Yoda would."; +const number = await vocode.numbers.updateNumber({ + phoneNumber: "YOUR_NUMBER", + inboundAgent: { prompt: yoda_prompt }, +}); +``` + + + +## Changing the Voice + +Our prompt has been updated. Now let's use a voice provided by other API providers. + +### Rime + + + +```python Python +from vocode import RimeVoiceParams, VoiceType + +rime_voice = RimeVoiceParams( + type=VoiceType.VOICE_RIME, + speaker="RIME_SPEAKER", +) +voice = vocode_client.voices.create_voice(request=rime_voice) +``` + +```javascript TypeScript +import { VoiceType } from "@vocode/vocode-api/api"; + +const rimeVoice = { + type: VoiceType.VoiceRime, + voiceId: "RIME_SPEAKER", +}; +const number = await vocode.voices.createVoice(rimeVoice); +``` + + + +### Play.ht + + + +```python Python +from vocode import PlayHtVoiceParams, VoiceType + +play_ht_voice = PlayHtVoiceParams( + type=VoiceType.VOICE_PLAY_HT, + voice_id="PLAY_HT_VOICE_ID", + api_user_id="PLAY_HT_USER_ID", + api_key="PLAY_HT_API_KEY", +) +voice = vocode_client.voices.create_voice(request=play_ht_voice) +``` + +```javascript TypeScript +import { VoiceType } from "@vocode/vocode-api/api"; + +const playHtVoice = { + type: VoiceType.VoicePlayHt, + voiceId: "PLAY_HT_VOICE_ID", + apiUserId: "PLAY_HT_USER_ID", + apiKey: "PLAY_HT_API_KEY, +}; +const number = await vocode.voices.createVoice(playHtVoice); +``` + + + +### ElevenLabs + +We will use the `rachel` voice from ElevenLabs. Instead of updating our existing agent directly, +we'll create a new voice config and set the agent to use it. + + + +```python Python +from vocode import ElevenLabsVoiceParams, VoiceType + +elevenlabs_voice = ElevenLabsVoiceParams( + type=VoiceType.VOICE_ELEVEN_LABS, + voice_id="ELEVEN_LABS_VOICE_ID", + api_key="ELEVEN_LABS_API_KEY", +) +voice = vocode_client.voices.create_voice(request=elevenlabs_voice) +``` + +```javascript TypeScript +import { VoiceType } from "@vocode/vocode-api/api"; + +const elevenlabsVoice = { + type: VoiceType.VoiceElevenLabs, + voiceId: "ELEVEN_LABS_VOICE_ID", + apiKey: "ELEVEN_LABS_API_KEY", +}; +const number = await vocode.voices.createVoice(elevenlabsVoice); +``` + + + +Now, we have our `voice_id` and can update our agent to use it. + + + +```python Python +from vocode import AgentUpdateParams + +agent = vocode_client.agents.update_agent( + id="AGENT_ID", + request=AgentUpdateParams(voice="VOICE_ID"), +) +``` + +```javascript TypeScript +const agent = await vocode.agents.updateAgent({ + id: "AGENT_ID", + body: { voice: "VOICE_ID" }, +}); +console.log(agent); +``` + + + +## Adding an Initial Message + +The initial message will be spoken as soon as the call starts before the user says anything. Let's make our agent say "Hello, I am Yoda" when the call starts. + + + +```python Python +from vocode import AgentUpdateParams + +number = vocode_client.numbers.update_number( + phone_number="YOUR_NUMBER", inbound_agent=AgentUpdateParams(initial_message="Hello, I am Yoda.") +) + +``` + +```javascript TypeScript +import { VocodeClient } from "@vocode/vocode-api"; + +const number = await vocode.numbers.updateNumber({ + phoneNumber: "YOUR_NUMBER", + inboundAgent: { initialMessage: "Hello, I am Yoda." }, +}); +``` + + diff --git a/docs/getting-number.mdx b/docs/getting-number.mdx new file mode 100644 index 000000000..dce7c09b6 --- /dev/null +++ b/docs/getting-number.mdx @@ -0,0 +1,38 @@ +--- +title: "Getting a number" +--- + +If you're on the Free plan, you'll have to head to the [dashboard](https://app.vocode.dev) to buy numbers. The Developer and +Enterprise plans both come with numbers included in the subscription. For more info, see [Pricing](https://vocode.dev/pricing). + + + +```python Python +phone_number = vocode_client.numbers.buy_number() +``` + +```typescript TypeScript +const phoneNumber = await vocode.numbers.buyNumber(); +``` + +```bash cURL +curl --request POST \ + --url https://api.vocode.dev/v1/numbers/buy \ + --header 'Content-Type: application/json' \ + --header 'Authorization: Bearer ' +``` + + + +You'll get a response that looks like: + +```json +{ + "id": "***", + "user_id": "***", + "number": "11234567890", + "inbound_agent": {...} +} +``` + +Your phone number is now active! Call the phone number and have a conversation with your AI. diff --git a/docs/hosted-quickstart.mdx b/docs/hosted-quickstart.mdx new file mode 100644 index 000000000..016fde2a0 --- /dev/null +++ b/docs/hosted-quickstart.mdx @@ -0,0 +1,85 @@ +--- +title: "Hosted Quickstart" +description: "Deploy AI to phone calls via API" +--- + +# Introduction + +The Vocode hosted service allows you to automate inbound and outbound phone calls +via our API and SDKs. You can configure agents to answer phone calls (inbound) or make +phone calls on your behalf (outbound). + +The hosted API is built to be scalable and production ready. Vocode provides guardrails +to make sure agents perform the intended goals reliably and metrics to analyze performance. + +# Getting started + +To get started with Vocode, you can start by installing either of our Python or Node SDKs, or +hitting the API directly. + +### Python + +Install the `vocode-api` package using a package manager. + + +```bash poetry +poetry add vocode-api +``` + +```bash pip +pip install vocode-api +``` + + + +Initialize the Vocode client like so: + +```python +from vocode.client import Vocode + +vocode_client = Vocode( + token="YOUR_API_KEY" +) + +list_numbers_response = vocode_client.numbers.list_numbers() + +print(list_numbers_response) +``` + +### Node + +Install the `vocode-api` package using a package manager. + + +```bash npm +npm install --save @vocode/vocode-api +``` + +```bash yarn +yarn add @vocode/vocode-api +``` + + + +Initialize the Vocode client like so: + +```typescript +import { VocodeClient } from "@vocode/vocode-api"; + +const vocode = new VocodeClient({ + token: "YOUR_API_KEY", +}); + +vocode.numbers.listNumbers().then((numbers) => { + console.log("My numbers:", numbers); +}); +``` + +### API Reference + +If you'd prefer to hit our API directly, take a look at our [API Reference](/api-reference). + +# Hosted Walkthrough + +Once you have Vocode installed, we suggest going through the [Hosted Walkthrough](/getting-number) which will +show you how to start interacting with the API. diff --git a/docs/how-to-use-it.mdx b/docs/how-to-use-it.mdx index 7eb692829..faf6912c3 100644 --- a/docs/how-to-use-it.mdx +++ b/docs/how-to-use-it.mdx @@ -1,6 +1,6 @@ --- title: "How to use it" -description: "The different ways to use the Vocode." +description: "The different ways to use Vocode." --- ## Understanding our libraries diff --git a/docs/inbound-calls.mdx b/docs/inbound-calls.mdx new file mode 100644 index 000000000..c13b581bf --- /dev/null +++ b/docs/inbound-calls.mdx @@ -0,0 +1,8 @@ +--- +title: "Inbound Calls" +description: "🚧 Under construction" +--- + +# Buying a number + +# Configuring a number diff --git a/docs/injecting-context.mdx b/docs/injecting-context.mdx new file mode 100644 index 000000000..8ae811d8c --- /dev/null +++ b/docs/injecting-context.mdx @@ -0,0 +1,57 @@ +--- +title: "[Beta] Injecting context" +description: "Add context to inbound calls" +--- + +When a call comes in, some applications may want to inject context (eg the caller's first name, if +the number is recognized). In order to support injecting context, the Vocode API allows prompts +to be templated. When an inbound call comes in, the template variables can then be filled in +at runtime. + +# How it works + +At a high level, context injection works like this: + +- set your Vocode prompt to include template values +- include a `context_endpoint` parameter to your bot +- when an inbound call comes in, Vocode will query the context endpoint provided with + the caller phone number +- the queried information from the endpoint is then filled into the prompt template + +# Context injection example + +In order to have your bot use injected variables, the prompt must include template variables. Let's set up +our prompt to accept a user's first name and link it to our context endpoint. + +```python +from vocode import AgentUpdateParams + +name_prompt = "You are talking to ${name}" +number = vocode_client.numbers.update_number( + phone_number="YOUR_NUMBER", + inbound_agent=AgentUpdateParams(prompt=name_prompt), + context_endpoint="YOUR_CONTEXT_URL" +) +``` + +Now, let's set up a simple context endpoint that will return the user's first name: + +```python +from fastapi import FastAPI + +app = FastAPI() + +@app.get("/my-context-endpoint") +def endpoint(request: Request): + if req.body.phone_number == "123": + return {"name": "Kian"} + elif req.body.phone_number == "456": + return {"name": "Ajay"} + else: + return {} +``` + +Now, when either Kian or Ajay call the bot – the prompt will reflect the name of the person +the bot is talking to! + +Note: This feature is experimental... improvements and proper authentication coming. diff --git a/docs/mint.json b/docs/mint.json index 3aa92dcd0..52f85392d 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -20,6 +20,16 @@ "url": "https://github.com/vocodedev/vocode-python" }, "anchors": [ + { + "name": "API Reference", + "icon": "rectangle-terminal", + "url": "api-reference" + }, + { + "name": "Open Source", + "icon": "leaf", + "url": "open-source" + }, { "name": "Community", "icon": "discord", @@ -39,50 +49,124 @@ "navigation": [ { "group": "Getting Started", + "pages": ["welcome", "hosted-quickstart", "open-source-quickstart"] + }, + { + "group": "Vocode 101", + "pages": ["what-is-vocode", "how-it-works", "how-to-use-it"] + }, + { + "group": "Guides", "pages": [ - "welcome" + "open-source/python-quickstart", + "open-source/telephony", + "open-source/create-your-own-agent", + "open-source/langchain-agent", + "open-source/action-agents", + "open-source/local-conversation", + "open-source/events-manager", + "open-source/using-synthesizers", + "open-source/using-transcribers", + "open-source/react-quickstart", + "open-source/playground", + "open-source/turn-based-conversation", + "open-source/language-support", + "open-source/tracing", + "open-source/agent-factory" ] }, { - "group": "Vocode 101", + "group": "Python", "pages": [ - "what-is-vocode", - "how-it-works", - "how-to-use-it" + "open-source/transcriber-reference", + "open-source/agent-reference", + "open-source/synthesizer-reference" ] }, { - "group": "Guides", + "group": "Numbers", "pages": [ - "python-quickstart", - "telephony", - "create-your-own-agent", - "langchain-agent", - "action-agents", - "local-conversation", - "events-manager", - "using-synthesizers", - "using-transcribers", - "react-quickstart", - "playground", - "turn-based-conversation", - "language-support", - "tracing", - "agent-factory" + "api-reference/numbers/list-numbers", + "api-reference/numbers/get-number", + "api-reference/numbers/buy-number", + "api-reference/numbers/update-number", + "api-reference/numbers/cancel-number" ] }, { - "group": "Python", + "group": "Calls", + "pages": [ + "api-reference/calls/list-calls", + "api-reference/calls/get-call", + "api-reference/calls/end-call", + "api-reference/calls/create-call" + ] + }, + { + "group": "Usage", + "pages": ["api-reference/usage/get-usage"] + }, + { + "group": "Actions", "pages": [ - "transcriber-reference", - "agent-reference", - "synthesizer-reference" + "api-reference/actions/get-action", + "api-reference/actions/list-actions", + "api-reference/actions/create-action", + "api-reference/actions/update-action" + ] + }, + { + "group": "Agents", + "pages": [ + "api-reference/agents/get-agent", + "api-reference/agents/list-agents", + "api-reference/agents/create-agent", + "api-reference/agents/update-agent" + ] + }, + { + "group": "Voices", + "pages": [ + "api-reference/voices/get-voice", + "api-reference/voices/list-voices", + "api-reference/voices/create-voice", + "api-reference/voices/update-voice" + ] + }, + { + "group": "Webhooks", + "pages": [ + "api-reference/webhooks/get-webhook", + "api-reference/webhooks/list-webhooks", + "api-reference/webhooks/create-webhook", + "api-reference/webhooks/update-webhook" + ] + }, + { + "group": "Schemas", + "pages": ["api-reference/schemas/action-type"] + }, + { + "group": "Hosted Walkthrough", + "pages": [ + "getting-number", + "configuring-number", + "retrieve-call-data", + "setting-up-webhook", + "using-actions", + "vectordb", + "multilingual", + "injecting-context" ] } ], + "api": { + "playground": { + "mode": "simple" + } + }, "footerSocials": { "twitter": "https://twitter.com/vocodehq", "website": "https://www.vocode.dev/" - }, - "backgroundImage": "images/background-image.png" -} \ No newline at end of file + } +} diff --git a/docs/multilingual.mdx b/docs/multilingual.mdx new file mode 100644 index 000000000..ef1e6fb47 --- /dev/null +++ b/docs/multilingual.mdx @@ -0,0 +1,41 @@ +--- +title: "[Beta] Multilingual bots" +description: "How to make bots speak different languages" +--- + +Vocode bots speak English by default but they can be configured to speak and understand +different languages. This feature is in beta and is currently being worked on. As of right now, +this feature works best with ElevenLabs multilingual voices. + +# Supported Languages + +Right now, our supported languages include: + +- English +- Spanish +- German + +with plans to support more in the future. If you have any particular requests, please email support@vocode.dev. + +# Set agent language + + + +```python Python +from vocode import AgentUpdateParams + +language = "es" # ["en", "es", "de"] +number = vocode_client.numbers.update_number( + phone_number="YOUR_NUMBER", inbound_agent=AgentUpdateParams(language=language) +) +``` + +```javascript TypeScript +const language = "es"; // ["en", "es", "de"] +const number = await vocode.numbers.updateNumber({ + phoneNumber: "YOUR_NUMBER", + inboundAgent: { language: language }, +}); +``` + + diff --git a/docs/open-source-quickstart.mdx b/docs/open-source-quickstart.mdx new file mode 100644 index 000000000..d253cfe53 --- /dev/null +++ b/docs/open-source-quickstart.mdx @@ -0,0 +1,39 @@ +--- +title: "Open Source Quickstart" +description: "How to get Vocode up and running on your own machine" +--- + +## Start Developing + + + + Quickly get up and running with Vocode by following our Python quick start + guide. + + + +### Replit Templates + + + + Spin up a phone number with ChatGPT on the other end. + + + Create a website that you can talk to. + + + Use Vocode as a tool to call someone in the real world. + + diff --git a/docs/action-agents.mdx b/docs/open-source/action-agents.mdx similarity index 100% rename from docs/action-agents.mdx rename to docs/open-source/action-agents.mdx diff --git a/docs/agent-factory.mdx b/docs/open-source/agent-factory.mdx similarity index 100% rename from docs/agent-factory.mdx rename to docs/open-source/agent-factory.mdx diff --git a/docs/agent-reference.mdx b/docs/open-source/agent-reference.mdx similarity index 100% rename from docs/agent-reference.mdx rename to docs/open-source/agent-reference.mdx diff --git a/docs/agent.mdx b/docs/open-source/agent.mdx similarity index 100% rename from docs/agent.mdx rename to docs/open-source/agent.mdx diff --git a/docs/create-your-own-agent.mdx b/docs/open-source/create-your-own-agent.mdx similarity index 100% rename from docs/create-your-own-agent.mdx rename to docs/open-source/create-your-own-agent.mdx diff --git a/docs/events-manager.mdx b/docs/open-source/events-manager.mdx similarity index 100% rename from docs/events-manager.mdx rename to docs/open-source/events-manager.mdx diff --git a/docs/langchain-agent.mdx b/docs/open-source/langchain-agent.mdx similarity index 100% rename from docs/langchain-agent.mdx rename to docs/open-source/langchain-agent.mdx diff --git a/docs/language-support.mdx b/docs/open-source/language-support.mdx similarity index 100% rename from docs/language-support.mdx rename to docs/open-source/language-support.mdx diff --git a/docs/local-conversation.mdx b/docs/open-source/local-conversation.mdx similarity index 100% rename from docs/local-conversation.mdx rename to docs/open-source/local-conversation.mdx diff --git a/docs/playground.mdx b/docs/open-source/playground.mdx similarity index 100% rename from docs/playground.mdx rename to docs/open-source/playground.mdx diff --git a/docs/python-quickstart.mdx b/docs/open-source/python-quickstart.mdx similarity index 100% rename from docs/python-quickstart.mdx rename to docs/open-source/python-quickstart.mdx diff --git a/docs/react-quickstart.mdx b/docs/open-source/react-quickstart.mdx similarity index 100% rename from docs/react-quickstart.mdx rename to docs/open-source/react-quickstart.mdx diff --git a/docs/synthesizer-reference.mdx b/docs/open-source/synthesizer-reference.mdx similarity index 100% rename from docs/synthesizer-reference.mdx rename to docs/open-source/synthesizer-reference.mdx diff --git a/docs/synthesizer.mdx b/docs/open-source/synthesizer.mdx similarity index 100% rename from docs/synthesizer.mdx rename to docs/open-source/synthesizer.mdx diff --git a/docs/telephony.mdx b/docs/open-source/telephony.mdx similarity index 100% rename from docs/telephony.mdx rename to docs/open-source/telephony.mdx diff --git a/docs/tracing.mdx b/docs/open-source/tracing.mdx similarity index 100% rename from docs/tracing.mdx rename to docs/open-source/tracing.mdx diff --git a/docs/transcriber-reference.mdx b/docs/open-source/transcriber-reference.mdx similarity index 100% rename from docs/transcriber-reference.mdx rename to docs/open-source/transcriber-reference.mdx diff --git a/docs/transcriber.mdx b/docs/open-source/transcriber.mdx similarity index 100% rename from docs/transcriber.mdx rename to docs/open-source/transcriber.mdx diff --git a/docs/turn-based-conversation.mdx b/docs/open-source/turn-based-conversation.mdx similarity index 100% rename from docs/turn-based-conversation.mdx rename to docs/open-source/turn-based-conversation.mdx diff --git a/docs/using-synthesizers.mdx b/docs/open-source/using-synthesizers.mdx similarity index 100% rename from docs/using-synthesizers.mdx rename to docs/open-source/using-synthesizers.mdx diff --git a/docs/using-transcribers.mdx b/docs/open-source/using-transcribers.mdx similarity index 100% rename from docs/using-transcribers.mdx rename to docs/open-source/using-transcribers.mdx diff --git a/docs/openapi.json b/docs/openapi.json new file mode 100644 index 000000000..4a2b4e476 --- /dev/null +++ b/docs/openapi.json @@ -0,0 +1,1671 @@ +{ + "openapi": "3.0.2", + "info": { + "title": "Vocode Hosted API", + "description": "\n Vocode's Hosted API helps you automate phone calls in minutes. πŸš€\n\n ## Numbers\n\n You can buy phone lines and place agents on them.\n\n ## Calls\n\n You can start, end, and get information about calls.\n ", + "termsOfService": "http://example.com/terms/", + "contact": { "name": "Support", "email": "support@vocode.dev" }, + "version": "1.0.0" + }, + "servers": [ + { + "url": "https://api.vocode.dev", + "description": "Production environment" + }, + { + "url": "https://staging.vocode.dev", + "description": "Staging environment" + } + ], + "paths": { + "/v1/numbers/list": { + "get": { + "tags": ["numbers"], + "summary": "List Numbers", + "operationId": "list_numbers", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response List Numbers V1 Numbers List Get", + "type": "array", + "items": { + "$ref": "#/components/schemas/NormalizedPhoneNumber" + } + } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/numbers/": { + "get": { + "tags": ["numbers"], + "summary": "Get Number", + "operationId": "get_number", + "parameters": [ + { + "required": true, + "schema": { "title": "Phone Number", "type": "string" }, + "name": "phone_number", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/PhoneNumber" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/numbers/buy": { + "post": { + "tags": ["numbers"], + "summary": "Buy Number", + "operationId": "buy_number", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/PhoneNumber" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/numbers/update": { + "post": { + "tags": ["numbers"], + "summary": "Update Number", + "operationId": "update_number", + "parameters": [ + { + "required": true, + "schema": { "title": "Phone Number", "type": "string" }, + "name": "phone_number", + "in": "query" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/UpdateNumberRequest" } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/PhoneNumber" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/numbers/cancel": { + "post": { + "tags": ["numbers"], + "summary": "Cancel Number", + "operationId": "cancel_number", + "parameters": [ + { + "required": true, + "schema": { "title": "Phone Number", "type": "string" }, + "name": "phone_number", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/PhoneNumber" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/calls/list": { + "get": { + "tags": ["calls"], + "summary": "List Calls", + "operationId": "list_calls", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response List Calls V1 Calls List Get", + "type": "array", + "items": { "$ref": "#/components/schemas/NormalizedCall" } + } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/calls/": { + "get": { + "tags": ["calls"], + "summary": "Get Call", + "operationId": "get_call", + "parameters": [ + { + "required": true, + "schema": { "title": "Id", "type": "string", "format": "uuid" }, + "name": "id", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Call" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/calls/end": { + "post": { + "tags": ["calls"], + "summary": "End Call", + "operationId": "end_call", + "parameters": [ + { + "required": true, + "schema": { "title": "Id", "type": "string", "format": "uuid" }, + "name": "id", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Call" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/calls/create": { + "post": { + "tags": ["calls"], + "summary": "Create Call", + "operationId": "create_call", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/CreateCallRequest" } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Call" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/calls/recording": { + "get": { + "tags": ["calls"], + "summary": "Recording", + "operationId": "recording", + "parameters": [ + { + "required": true, + "schema": { "title": "Id", "type": "string" }, + "name": "id", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { "application/json": { "schema": {} } } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/usage/": { + "get": { + "tags": ["usage"], + "summary": "Get Usage", + "operationId": "get_usage", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Usage" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/actions/": { + "get": { + "tags": ["actions"], + "summary": "Get Action", + "operationId": "get_action", + "parameters": [ + { + "required": true, + "schema": { "title": "Id", "type": "string", "format": "uuid" }, + "name": "id", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response Get Action V1 Actions Get", + "anyOf": [ + { "$ref": "#/components/schemas/TransferCallAction" }, + { "$ref": "#/components/schemas/EndConversationAction" }, + { "$ref": "#/components/schemas/DTMFAction" } + ] + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/actions/list": { + "get": { + "tags": ["actions"], + "summary": "List Actions", + "operationId": "list_actions", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response List Actions V1 Actions List Get", + "type": "array", + "items": { + "anyOf": [ + { "$ref": "#/components/schemas/TransferCallAction" }, + { "$ref": "#/components/schemas/EndConversationAction" }, + { "$ref": "#/components/schemas/DTMFAction" } + ] + } + } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/actions/create": { + "post": { + "tags": ["actions"], + "summary": "Create Action", + "operationId": "create_action", + "requestBody": { + "content": { + "application/json": { + "schema": { + "title": "Params", + "anyOf": [ + { "$ref": "#/components/schemas/TransferCallActionParams" }, + { + "$ref": "#/components/schemas/EndConversationActionParams" + }, + { "$ref": "#/components/schemas/DTMFActionParams" } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response Create Action V1 Actions Create Post", + "anyOf": [ + { "$ref": "#/components/schemas/TransferCallAction" }, + { "$ref": "#/components/schemas/EndConversationAction" }, + { "$ref": "#/components/schemas/DTMFAction" } + ] + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/actions/update": { + "post": { + "tags": ["actions"], + "summary": "Update Action", + "operationId": "update_action", + "parameters": [ + { + "required": true, + "schema": { "title": "Id", "type": "string", "format": "uuid" }, + "name": "id", + "in": "query" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "title": "Update Params", + "anyOf": [ + { + "$ref": "#/components/schemas/TransferCallActionUpdateParams" + }, + { + "$ref": "#/components/schemas/EndConversationActionUpdateParams" + }, + { "$ref": "#/components/schemas/DTMFActionUpdateParams" } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response Update Action V1 Actions Update Post", + "anyOf": [ + { "$ref": "#/components/schemas/TransferCallAction" }, + { "$ref": "#/components/schemas/EndConversationAction" }, + { "$ref": "#/components/schemas/DTMFAction" } + ] + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/agents/": { + "get": { + "tags": ["agents"], + "summary": "Get Agent", + "operationId": "get_agent", + "parameters": [ + { + "required": true, + "schema": { "title": "Id", "type": "string", "format": "uuid" }, + "name": "id", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Agent" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/agents/list": { + "get": { + "tags": ["agents"], + "summary": "List Agents", + "operationId": "list_agents", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response List Agents V1 Agents List Get", + "type": "array", + "items": { "$ref": "#/components/schemas/NormalizedAgent" } + } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/agents/create": { + "post": { + "tags": ["agents"], + "summary": "Create Agent", + "operationId": "create_agent", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/AgentParams" } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Agent" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/agents/update": { + "post": { + "tags": ["agents"], + "summary": "Update Agent", + "operationId": "update_agent", + "parameters": [ + { + "required": true, + "schema": { "title": "Id", "type": "string", "format": "uuid" }, + "name": "id", + "in": "query" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/AgentUpdateParams" } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Agent" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/voices/": { + "get": { + "tags": ["voices"], + "summary": "Get Voice", + "operationId": "get_voice", + "parameters": [ + { + "required": true, + "schema": { "title": "Id", "type": "string", "format": "uuid" }, + "name": "id", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response Get Voice V1 Voices Get", + "anyOf": [ + { "$ref": "#/components/schemas/AzureVoice" }, + { "$ref": "#/components/schemas/RimeVoice" }, + { "$ref": "#/components/schemas/ElevenLabsVoice" } + ] + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/voices/list": { + "get": { + "tags": ["voices"], + "summary": "List Voices", + "operationId": "list_voices", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response List Voices V1 Voices List Get", + "type": "array", + "items": { + "anyOf": [ + { "$ref": "#/components/schemas/AzureVoice" }, + { "$ref": "#/components/schemas/RimeVoice" }, + { "$ref": "#/components/schemas/ElevenLabsVoice" } + ] + } + } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/voices/create": { + "post": { + "tags": ["voices"], + "summary": "Create Voice", + "operationId": "create_voice", + "requestBody": { + "content": { + "application/json": { + "schema": { + "title": "Params", + "anyOf": [ + { "$ref": "#/components/schemas/AzureVoiceParams" }, + { "$ref": "#/components/schemas/RimeVoiceParams" }, + { "$ref": "#/components/schemas/ElevenLabsVoiceParams" } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response Create Voice V1 Voices Create Post", + "anyOf": [ + { "$ref": "#/components/schemas/AzureVoice" }, + { "$ref": "#/components/schemas/RimeVoice" }, + { "$ref": "#/components/schemas/ElevenLabsVoice" } + ] + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/voices/update": { + "post": { + "tags": ["voices"], + "summary": "Update Voice", + "operationId": "update_voice", + "parameters": [ + { + "required": true, + "schema": { "title": "Id", "type": "string", "format": "uuid" }, + "name": "id", + "in": "query" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "title": "Update Params", + "anyOf": [ + { "$ref": "#/components/schemas/AzureVoiceUpdateParams" }, + { "$ref": "#/components/schemas/RimeVoiceUpdateParams" }, + { "$ref": "#/components/schemas/ElevenLabsVoiceUpdateParams" } + ] + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response Update Voice V1 Voices Update Post", + "anyOf": [ + { "$ref": "#/components/schemas/AzureVoice" }, + { "$ref": "#/components/schemas/RimeVoice" }, + { "$ref": "#/components/schemas/ElevenLabsVoice" } + ] + } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/webhooks/": { + "get": { + "tags": ["webhooks"], + "summary": "Get Webhook", + "operationId": "get_webhook", + "parameters": [ + { + "required": true, + "schema": { "title": "Id", "type": "string", "format": "uuid" }, + "name": "id", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Webhook" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/webhooks/list": { + "get": { + "tags": ["webhooks"], + "summary": "List Webhooks", + "operationId": "list_webhooks", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { + "title": "Response List Webhooks V1 Webhooks List Get", + "type": "array", + "items": { "$ref": "#/components/schemas/Webhook" } + } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/webhooks/create": { + "post": { + "tags": ["webhooks"], + "summary": "Create Webhook", + "operationId": "create_webhook", + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/WebhookParams" } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Webhook" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + }, + "/v1/webhooks/update": { + "post": { + "tags": ["webhooks"], + "summary": "Update Webhook", + "operationId": "update_webhook", + "parameters": [ + { + "required": true, + "schema": { "title": "Id", "type": "string", "format": "uuid" }, + "name": "id", + "in": "query" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/WebhookUpdateParams" } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Webhook" } + } + } + }, + "422": { + "description": "Validation Error", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/HTTPValidationError" } + } + } + } + }, + "security": [{ "HTTPBearer": [] }] + } + } + }, + "components": { + "schemas": { + "ActionType": { + "title": "ActionType", + "enum": [ + "action_end_conversation", + "action_dtmf", + "action_transfer_call" + ], + "type": "string", + "description": "An enumeration." + }, + "Agent": { + "title": "Agent", + "required": ["id", "user_id", "prompt", "actions", "voice"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "user_id": { "title": "User Id", "type": "string", "format": "uuid" }, + "prompt": { "title": "Prompt", "type": "string" }, + "actions": { + "title": "Actions", + "type": "array", + "items": { + "anyOf": [ + { "$ref": "#/components/schemas/TransferCallAction" }, + { "$ref": "#/components/schemas/EndConversationAction" }, + { "$ref": "#/components/schemas/DTMFAction" } + ] + } + }, + "voice": { + "title": "Voice", + "anyOf": [ + { "$ref": "#/components/schemas/AzureVoice" }, + { "$ref": "#/components/schemas/RimeVoice" }, + { "$ref": "#/components/schemas/ElevenLabsVoice" } + ] + }, + "initial_message": { "title": "Initial Message", "type": "string" }, + "webhook": { "$ref": "#/components/schemas/Webhook" } + } + }, + "AgentParams": { + "title": "AgentParams", + "required": ["prompt", "voice"], + "type": "object", + "properties": { + "prompt": { "title": "Prompt", "type": "string" }, + "actions": { + "title": "Actions", + "type": "array", + "items": { + "anyOf": [ + { "type": "string", "format": "uuid" }, + { "$ref": "#/components/schemas/TransferCallActionParams" }, + { "$ref": "#/components/schemas/EndConversationActionParams" }, + { "$ref": "#/components/schemas/DTMFActionParams" } + ] + }, + "default": [] + }, + "voice": { + "title": "Voice", + "anyOf": [ + { "type": "string", "format": "uuid" }, + { "$ref": "#/components/schemas/AzureVoiceParams" }, + { "$ref": "#/components/schemas/RimeVoiceParams" }, + { "$ref": "#/components/schemas/ElevenLabsVoiceParams" } + ] + }, + "initial_message": { "title": "Initial Message", "type": "string" }, + "webhook": { + "title": "Webhook", + "anyOf": [ + { "type": "string", "format": "uuid" }, + { "$ref": "#/components/schemas/WebhookParams" } + ] + } + } + }, + "AgentUpdateParams": { + "title": "AgentUpdateParams", + "type": "object", + "properties": { + "prompt": { + "title": "Prompt", + "anyOf": [ + { "type": "string" }, + { "$ref": "#/components/schemas/Undefined" } + ] + }, + "actions": { + "title": "Actions", + "anyOf": [ + { + "type": "array", + "items": { + "anyOf": [ + { "type": "string", "format": "uuid" }, + { + "$ref": "#/components/schemas/TransferCallActionUpdateParams" + }, + { + "$ref": "#/components/schemas/EndConversationActionUpdateParams" + }, + { "$ref": "#/components/schemas/DTMFActionUpdateParams" } + ] + } + }, + { "$ref": "#/components/schemas/Undefined" } + ] + }, + "voice": { + "title": "Voice", + "anyOf": [ + { "type": "string", "format": "uuid" }, + { "$ref": "#/components/schemas/AzureVoiceUpdateParams" }, + { "$ref": "#/components/schemas/RimeVoiceUpdateParams" }, + { "$ref": "#/components/schemas/ElevenLabsVoiceUpdateParams" }, + { "$ref": "#/components/schemas/Undefined" } + ] + }, + "initial_message": { + "title": "Initial Message", + "anyOf": [ + { "type": "string" }, + { "$ref": "#/components/schemas/Undefined" } + ] + }, + "webhook": { + "title": "Webhook", + "anyOf": [ + { "type": "string", "format": "uuid" }, + { "$ref": "#/components/schemas/WebhookUpdateParams" }, + { "$ref": "#/components/schemas/Undefined" } + ] + } + } + }, + "AzureVoice": { + "title": "AzureVoice", + "required": ["id", "user_id", "voice_name"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "user_id": { "title": "User Id", "type": "string", "format": "uuid" }, + "type": { + "allOf": [{ "$ref": "#/components/schemas/VoiceType" }], + "default": "voice_azure" + }, + "voice_name": { "title": "Voice Name", "type": "string" }, + "pitch": { "title": "Pitch", "type": "integer", "default": 0 }, + "rate": { "title": "Rate", "type": "integer", "default": 15 } + } + }, + "AzureVoiceParams": { + "title": "AzureVoiceParams", + "required": ["type", "voice_name"], + "type": "object", + "properties": { + "type": { "$ref": "#/components/schemas/VoiceType" }, + "voice_name": { "title": "Voice Name", "type": "string" }, + "pitch": { "title": "Pitch", "type": "integer", "default": 0 }, + "rate": { "title": "Rate", "type": "integer", "default": 15 } + } + }, + "AzureVoiceUpdateParams": { + "title": "AzureVoiceUpdateParams", + "required": ["type"], + "type": "object", + "properties": { + "type": { "$ref": "#/components/schemas/VoiceType" }, + "voice_name": { + "title": "Voice Name", + "anyOf": [ + { "type": "string" }, + { "$ref": "#/components/schemas/Undefined" } + ] + }, + "pitch": { + "title": "Pitch", + "anyOf": [ + { "type": "integer" }, + { "$ref": "#/components/schemas/Undefined" } + ] + }, + "rate": { + "title": "Rate", + "anyOf": [ + { "type": "integer" }, + { "$ref": "#/components/schemas/Undefined" } + ] + } + } + }, + "Call": { + "title": "Call", + "required": ["id", "user_id", "to_number", "from_number", "agent"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "user_id": { "title": "User Id", "type": "string", "format": "uuid" }, + "status": { + "allOf": [{ "$ref": "#/components/schemas/CallStatus" }], + "default": "not_started" + }, + "error_message": { "title": "Error Message", "type": "string" }, + "recording_available": { + "title": "Recording Available", + "type": "boolean", + "default": false + }, + "transcript": { "title": "Transcript", "type": "string" }, + "to_number": { "title": "To Number", "type": "string" }, + "from_number": { "title": "From Number", "type": "string" }, + "agent": { "$ref": "#/components/schemas/Agent" } + } + }, + "CallStatus": { + "title": "CallStatus", + "enum": ["not_started", "in_progress", "error", "ended"], + "type": "string", + "description": "An enumeration." + }, + "CreateCallRequest": { + "title": "CreateCallRequest", + "required": ["from_number", "to_number", "agent"], + "type": "object", + "properties": { + "from_number": { "title": "From Number", "type": "string" }, + "to_number": { "title": "To Number", "type": "string" }, + "agent": { + "title": "Agent", + "anyOf": [ + { "type": "string", "format": "uuid" }, + { "$ref": "#/components/schemas/AgentParams" } + ] + } + } + }, + "DTMFAction": { + "title": "DTMFAction", + "required": ["id", "user_id"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "user_id": { "title": "User Id", "type": "string", "format": "uuid" }, + "type": { + "allOf": [{ "$ref": "#/components/schemas/ActionType" }], + "default": "action_dtmf" + }, + "config": { "$ref": "#/components/schemas/EmptyActionConfig" } + } + }, + "DTMFActionParams": { + "title": "DTMFActionParams", + "required": ["type"], + "type": "object", + "properties": { + "type": { "$ref": "#/components/schemas/ActionType" }, + "config": { "$ref": "#/components/schemas/EmptyActionConfig" } + } + }, + "DTMFActionUpdateParams": { + "title": "DTMFActionUpdateParams", + "required": ["type"], + "type": "object", + "properties": { + "type": { "$ref": "#/components/schemas/ActionType" }, + "config": { + "title": "Config", + "anyOf": [ + { "$ref": "#/components/schemas/EmptyActionConfig" }, + { "$ref": "#/components/schemas/Undefined" } + ] + } + } + }, + "ElevenLabsVoice": { + "title": "ElevenLabsVoice", + "required": ["id", "user_id", "voice_id", "api_key"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "user_id": { "title": "User Id", "type": "string", "format": "uuid" }, + "type": { + "allOf": [{ "$ref": "#/components/schemas/VoiceType" }], + "default": "voice_eleven_labs" + }, + "voice_id": { "title": "Voice Id", "type": "string" }, + "stability": { "title": "Stability", "type": "number" }, + "similarity_boost": { "title": "Similarity Boost", "type": "number" }, + "api_key": { "title": "Api Key", "type": "string" } + } + }, + "ElevenLabsVoiceParams": { + "title": "ElevenLabsVoiceParams", + "required": ["type", "voice_id", "api_key"], + "type": "object", + "properties": { + "type": { "$ref": "#/components/schemas/VoiceType" }, + "voice_id": { "title": "Voice Id", "type": "string" }, + "stability": { "title": "Stability", "type": "number" }, + "similarity_boost": { "title": "Similarity Boost", "type": "number" }, + "api_key": { "title": "Api Key", "type": "string" } + } + }, + "ElevenLabsVoiceUpdateParams": { + "title": "ElevenLabsVoiceUpdateParams", + "required": ["type"], + "type": "object", + "properties": { + "type": { "$ref": "#/components/schemas/VoiceType" }, + "voice_id": { + "title": "Voice Id", + "anyOf": [ + { "type": "string" }, + { "$ref": "#/components/schemas/Undefined" } + ] + }, + "stability": { + "title": "Stability", + "anyOf": [ + { "type": "number" }, + { "$ref": "#/components/schemas/Undefined" } + ] + }, + "similarity_boost": { + "title": "Similarity Boost", + "anyOf": [ + { "type": "number" }, + { "$ref": "#/components/schemas/Undefined" } + ] + }, + "api_key": { + "title": "Api Key", + "anyOf": [ + { "type": "string" }, + { "$ref": "#/components/schemas/Undefined" } + ] + } + } + }, + "EmptyActionConfig": { + "title": "EmptyActionConfig", + "type": "object", + "properties": {} + }, + "EndConversationAction": { + "title": "EndConversationAction", + "required": ["id", "user_id"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "user_id": { "title": "User Id", "type": "string", "format": "uuid" }, + "type": { + "allOf": [{ "$ref": "#/components/schemas/ActionType" }], + "default": "action_end_conversation" + }, + "config": { "$ref": "#/components/schemas/EmptyActionConfig" } + } + }, + "EndConversationActionParams": { + "title": "EndConversationActionParams", + "required": ["type"], + "type": "object", + "properties": { + "type": { "$ref": "#/components/schemas/ActionType" }, + "config": { "$ref": "#/components/schemas/EmptyActionConfig" } + } + }, + "EndConversationActionUpdateParams": { + "title": "EndConversationActionUpdateParams", + "required": ["type"], + "type": "object", + "properties": { + "type": { "$ref": "#/components/schemas/ActionType" }, + "config": { + "title": "Config", + "anyOf": [ + { "$ref": "#/components/schemas/EmptyActionConfig" }, + { "$ref": "#/components/schemas/Undefined" } + ] + } + } + }, + "EventType": { + "title": "EventType", + "enum": [ + "event_message", + "event_action", + "event_phone_call_connected", + "event_phone_call_ended", + "event_transcript", + "event_recording" + ], + "type": "string", + "description": "An enumeration." + }, + "HTTPMethod": { + "title": "HTTPMethod", + "enum": ["GET", "POST"], + "type": "string", + "description": "An enumeration." + }, + "HTTPValidationError": { + "title": "HTTPValidationError", + "type": "object", + "properties": { + "detail": { + "title": "Detail", + "type": "array", + "items": { "$ref": "#/components/schemas/ValidationError" } + } + } + }, + "NormalizedAgent": { + "title": "NormalizedAgent", + "required": ["id", "user_id", "prompt", "actions", "voice"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "user_id": { "title": "User Id", "type": "string", "format": "uuid" }, + "prompt": { "title": "Prompt", "type": "string" }, + "actions": { + "title": "Actions", + "type": "array", + "items": { "type": "string", "format": "uuid" } + }, + "voice": { "title": "Voice", "type": "string", "format": "uuid" }, + "initial_message": { "title": "Initial Message", "type": "string" }, + "webhook": { "title": "Webhook", "type": "string", "format": "uuid" } + } + }, + "NormalizedCall": { + "title": "NormalizedCall", + "required": ["id", "user_id", "to_number", "from_number", "agent"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "user_id": { "title": "User Id", "type": "string", "format": "uuid" }, + "status": { + "allOf": [{ "$ref": "#/components/schemas/CallStatus" }], + "default": "not_started" + }, + "error_message": { "title": "Error Message", "type": "string" }, + "recording_available": { + "title": "Recording Available", + "type": "boolean", + "default": false + }, + "transcript": { "title": "Transcript", "type": "string" }, + "to_number": { "title": "To Number", "type": "string" }, + "from_number": { "title": "From Number", "type": "string" }, + "agent": { "title": "Agent", "type": "string", "format": "uuid" } + } + }, + "NormalizedPhoneNumber": { + "title": "NormalizedPhoneNumber", + "required": ["id", "user_id", "inbound_agent", "number"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "user_id": { "title": "User Id", "type": "string", "format": "uuid" }, + "active": { "title": "Active", "type": "boolean", "default": true }, + "inbound_agent": { + "title": "Inbound Agent", + "type": "string", + "format": "uuid" + }, + "number": { "title": "Number", "type": "string" } + } + }, + "PhoneNumber": { + "title": "PhoneNumber", + "required": ["id", "user_id", "inbound_agent", "number"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "user_id": { "title": "User Id", "type": "string", "format": "uuid" }, + "active": { "title": "Active", "type": "boolean", "default": true }, + "inbound_agent": { "$ref": "#/components/schemas/Agent" }, + "number": { "title": "Number", "type": "string" } + } + }, + "PlanType": { + "title": "PlanType", + "enum": ["free", "developer", "enterprise"], + "type": "string", + "description": "An enumeration." + }, + "RimeVoice": { + "title": "RimeVoice", + "required": ["id", "user_id", "speaker"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "user_id": { "title": "User Id", "type": "string", "format": "uuid" }, + "type": { + "allOf": [{ "$ref": "#/components/schemas/VoiceType" }], + "default": "voice_rime" + }, + "speaker": { "title": "Speaker", "type": "string" } + } + }, + "RimeVoiceParams": { + "title": "RimeVoiceParams", + "required": ["type", "speaker"], + "type": "object", + "properties": { + "type": { "$ref": "#/components/schemas/VoiceType" }, + "speaker": { "title": "Speaker", "type": "string" } + } + }, + "RimeVoiceUpdateParams": { + "title": "RimeVoiceUpdateParams", + "required": ["type"], + "type": "object", + "properties": { + "type": { "$ref": "#/components/schemas/VoiceType" }, + "speaker": { + "title": "Speaker", + "anyOf": [ + { "type": "string" }, + { "$ref": "#/components/schemas/Undefined" } + ] + } + } + }, + "TransferCallAction": { + "title": "TransferCallAction", + "required": ["id", "user_id", "config"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "user_id": { "title": "User Id", "type": "string", "format": "uuid" }, + "type": { + "allOf": [{ "$ref": "#/components/schemas/ActionType" }], + "default": "action_transfer_call" + }, + "config": { "$ref": "#/components/schemas/TransferCallConfig" } + } + }, + "TransferCallActionParams": { + "title": "TransferCallActionParams", + "required": ["type", "config"], + "type": "object", + "properties": { + "type": { "$ref": "#/components/schemas/ActionType" }, + "config": { "$ref": "#/components/schemas/TransferCallConfig" } + } + }, + "TransferCallActionUpdateParams": { + "title": "TransferCallActionUpdateParams", + "required": ["type"], + "type": "object", + "properties": { + "type": { "$ref": "#/components/schemas/ActionType" }, + "config": { + "title": "Config", + "anyOf": [ + { "$ref": "#/components/schemas/TransferCallConfig" }, + { "$ref": "#/components/schemas/Undefined" } + ] + } + } + }, + "TransferCallConfig": { + "title": "TransferCallConfig", + "required": ["phone_number"], + "type": "object", + "properties": { + "phone_number": { "title": "Phone Number", "type": "string" } + } + }, + "Undefined": { "title": "Undefined", "type": "object", "properties": {} }, + "UpdateNumberRequest": { + "title": "UpdateNumberRequest", + "required": ["inbound_agent"], + "type": "object", + "properties": { + "inbound_agent": { + "title": "Inbound Agent", + "anyOf": [ + { "type": "string", "format": "uuid" }, + { "$ref": "#/components/schemas/AgentUpdateParams" } + ] + } + } + }, + "Usage": { + "title": "Usage", + "required": [ + "user_id", + "plan_type", + "monthly_usage_minutes", + "monthly_usage_limit_minutes" + ], + "type": "object", + "properties": { + "user_id": { "title": "User Id", "type": "string" }, + "plan_type": { "$ref": "#/components/schemas/PlanType" }, + "monthly_usage_minutes": { + "title": "Monthly Usage Minutes", + "type": "integer" + }, + "monthly_usage_limit_minutes": { + "title": "Monthly Usage Limit Minutes", + "type": "integer" + } + } + }, + "ValidationError": { + "title": "ValidationError", + "required": ["loc", "msg", "type"], + "type": "object", + "properties": { + "loc": { + "title": "Location", + "type": "array", + "items": { "anyOf": [{ "type": "string" }, { "type": "integer" }] } + }, + "msg": { "title": "Message", "type": "string" }, + "type": { "title": "Error Type", "type": "string" } + } + }, + "VoiceType": { + "title": "VoiceType", + "enum": [ + "voice_base", + "voice_azure", + "voice_rime", + "voice_eleven_labs" + ], + "type": "string", + "description": "An enumeration." + }, + "Webhook": { + "title": "Webhook", + "required": ["id", "user_id", "subscriptions", "url"], + "type": "object", + "properties": { + "id": { "title": "Id", "type": "string", "format": "uuid" }, + "user_id": { "title": "User Id", "type": "string", "format": "uuid" }, + "subscriptions": { + "type": "array", + "items": { "$ref": "#/components/schemas/EventType" } + }, + "url": { "title": "Url", "type": "string" }, + "method": { + "allOf": [{ "$ref": "#/components/schemas/HTTPMethod" }], + "default": "POST" + } + } + }, + "WebhookParams": { + "title": "WebhookParams", + "required": ["subscriptions", "url"], + "type": "object", + "properties": { + "subscriptions": { + "type": "array", + "items": { "$ref": "#/components/schemas/EventType" } + }, + "url": { "title": "Url", "type": "string" }, + "method": { + "allOf": [{ "$ref": "#/components/schemas/HTTPMethod" }], + "default": "POST" + } + } + }, + "WebhookUpdateParams": { + "title": "WebhookUpdateParams", + "type": "object", + "properties": { + "subscriptions": { + "title": "Subscriptions", + "anyOf": [ + { + "type": "array", + "items": { "$ref": "#/components/schemas/EventType" } + }, + { "$ref": "#/components/schemas/Undefined" } + ] + }, + "url": { + "title": "Url", + "anyOf": [ + { "type": "string" }, + { "$ref": "#/components/schemas/Undefined" } + ] + }, + "method": { + "title": "Method", + "anyOf": [ + { "$ref": "#/components/schemas/HTTPMethod" }, + { "$ref": "#/components/schemas/Undefined" } + ] + } + } + } + }, + "securitySchemes": { "HTTPBearer": { "type": "http", "scheme": "bearer" } } + }, + "tags": [ + { "name": "numbers", "description": "Operations with phone numbers." }, + { "name": "calls", "description": "Manage calls." } + ] +} diff --git a/docs/outbound-calls.mdx b/docs/outbound-calls.mdx new file mode 100644 index 000000000..58b62757d --- /dev/null +++ b/docs/outbound-calls.mdx @@ -0,0 +1,4 @@ +--- +title: "Outbound Calls" +description: "🚧 Under construction" +--- diff --git a/docs/retrieve-call-data.mdx b/docs/retrieve-call-data.mdx new file mode 100644 index 000000000..b3b808def --- /dev/null +++ b/docs/retrieve-call-data.mdx @@ -0,0 +1,109 @@ +--- +title: "Retrieve Call Data" +description: "Get information on in-progress and completed calls" +--- + + + With the Vocode API in-progress and completed calls are accessible as Call + objects. + + +To list your call history: + + + +```python Python +calls = vocode_client.calls.list_calls() +``` + +```javascript TypeScript +const calls = await vocode.calls.listCalls(); +``` + +```curl cURL +curl --request GET \ + --url https://api.vocode.dev/v1/calls/list \ + --header 'Content-Type: application/json' \ + --header 'Authorization: Bearer ' +``` + + + +The resulting list of Call objects is structured like this: + +```json +[ + { + id: 'call_id', + userId: 'user_id', + toNumber: '123456789', + fromNumber: '123456789', + agent: { + id: 'agent_id', + userId: 'user_id', + prompt: 'The assistant is having a pleasant conversation about life.', + actions: [], + voice: [Object], + initialMessage: undefined, + webhook: undefined + }, + goal: undefined, + transcript: undefined, + recordingUrl: undefined, + status: 'ended', + errorMessage: undefined, + recordingAvailable: false + } +] +``` + +## Get a specific call + +If you have a call ID, you can get the call object for that call. + + + +```python Python +vocode_client.calls.get_call(id="CALL_ID") +``` + +```javascript TypeScript +const calls = await vocode.calls.getCall({ id: "CALL_ID" }); +``` + +```curl cURL +curl --request GET \ + --url https://api.vocode.dev/v1/calls/recording/ \ + --header 'Content-Type: application/json' \ + --header 'Authorization: Bearer ' +``` + + + +## Download a call recording + +If you enabled call recording, you can download the call recording file. + + +```python Python +vocode_client.calls.recording(id="CALL_ID") +``` + +```javascript TypeScript +const calls = await vocode.calls.listCalls(); +const recording = await vocode.calls.recording({ id: calls[0].id }); +``` + +```curl cURL +curl --request GET \ + --url https://api.vocode.dev/v1/calls/recording/ \ + --header 'Content-Type: application/json' \ + --header 'Authorization: Bearer ' +``` + + diff --git a/docs/setting-up-webhook.mdx b/docs/setting-up-webhook.mdx new file mode 100644 index 000000000..ed57ba291 --- /dev/null +++ b/docs/setting-up-webhook.mdx @@ -0,0 +1,59 @@ +--- +title: "Setting up webhooks" +description: "Listen to events on your phone calls" +--- + +You can set up webhooks on agents so that you can +listen to events in realtime or for post-call automation. + +## Adding Webhooks + +To get data from the agent during a call, you can add a webhook and assign it to listen for specific events. +Let's send a POST request to "https://example.com" every time a call ends. + + + +```python Python +from vocode import AgentUpdateParams, EventType, HttpMethod, WebhookUpdateParams + +new_webhook = WebhookUpdateParams( + subscriptions=[EventType.EVENT_PHONE_CALL_ENDED], + url="https://example.com", + method=HttpMethod.POST, +) + +number = vocode_client.numbers.update_number( + phone_number="YOUR_NUMBER", + inbound_agent=AgentUpdateParams( + webhook=new_webhook, + ), +) +``` + +```javascript TypeScript +import { EventType, HttpMethod } from "@vocode/vocode-api/api"; + +const number = await vocode.numbers.updateNumber({ + phoneNumber: "YOUR_NUMBER", + inboundAgent: { + webhook: { + subscriptions: [EventType.EventPhoneCallConnected], + url: "https://example.com", + method: HttpMethod.Post, + }, + }, +}); +``` + + + +## EventTypes + +The full list of `EventType` is listed here: + +- `EVENT_MESSAGE`: A message in the conversation. +- `EVENT_ACTION`: An action taken during the conversation. +- `EVENT_PHONE_CALL_CONNECTED`: Indicating the phone call has connected. +- `EVENT_PHONE_CALL_ENDED`: Indicating the phone call has ended. +- `EVENT_TRANSCRIPT`: The transcription of the entire conversation. +- `EVENT_RECORDING`: The recording of the conversation has become available. diff --git a/docs/using-actions.mdx b/docs/using-actions.mdx new file mode 100644 index 000000000..606a0798c --- /dev/null +++ b/docs/using-actions.mdx @@ -0,0 +1,194 @@ +--- +title: "Using actions" +description: "Make agents on your phone calls take actions" +--- + +Agents on phone calls can take three actions: + +`EndConversation`: allows the agent to end the call, e.g. if the user says "Goodbye!" + + + +```python Python +vocode_client.actions.create_action( + request=CreateActionRequest( + type=ActionType.ACTION_END_CONVERSATION + ) +) +``` + +```typescript TypeScript +const number = await vocode.actions.createAction({ + type: "action_end_conversation", +}); +``` + +```bash cURL +curl --request POST \ + --url https://api.vocode.dev/v1/actions/create \ + --header 'Content-Type: application/json' \ + --header 'Authorization: Bearer ' + --data '{ + "type": "action_end_conversation" +}' +``` + + + +`DTMF`: allows the agent to hit dial tones during a call, e.g. navigating a phone tree + + + +```python Python +vocode_client.actions.create_action( + request=CreateActionRequest( + type=ActionType.ACTION_DTMF + ) +) +``` + +```typescript TypeScript +const number = await vocode.actions.createAction({ + type: "action_dtmf", +}); +``` + +```bash cURL +curl --request POST \ + --url https://api.vocode.dev/v1/actions/create \ + --header 'Content-Type: application/json' \ + --header 'Authorization: Bearer ' + --data '{ + "type": "action_dtmf" +}' +``` + + + +`TransferCall`: allows the agent to transfer the call to another phone number + + + +```python Python +vocode_client.actions.create_action( + request=CreateActionRequest( + type=ActionType.ACTION_TRANSFER_CALL, + config=TransferCallActionUpdateParamsConfig( + phone_number="11234567890" + ) + ) +) +``` + +```typescript TypeScript +const number = await vocode.actions.createAction({ + type: "action_transfer_call", + config: { + phoneNumber: "11234567890", + }, +}); +``` + +```bash cURL +curl --request POST \ + --url https://api.vocode.dev/v1/actions/create \ + --header 'Content-Type: application/json' \ + --header 'Authorization: Bearer ' + --data '{ + "type": "action_transfer_call", + "config": { + "phone_number": "11234567890" + } +}' +``` + + + +You can attach these as IDs to your phone number agent as follows: + + + +```python Python +vocode_client.numbers.update_number( + phone_number="11234567890", + inbound_agent=UpdateNumberRequestInboundAgent( + actions=[""] + ) +) +``` + +```typescript TypeScript +vocode.numbers.updateNumber({ + phoneNumber: "11234567890", + inboundAgent: { + actions: [""], + }, +}); +``` + +```bash cURL +curl --request POST \ + --url https://api.vocode.dev/v1/numbers/update?phone_number=11234567890 \ + --header 'Content-Type: application/json' \ + --header 'Authorization: Bearer ' + --data '{ + "inbound_agent": { + "actions": [""] + } +}' +``` + + + +You can also add these as actions as raw payloads as follows: + + + +```python Python +vocode_client.numbers.update_number( + phone_number="11234567890", + inbound_agent=UpdateNumberRequestInboundAgent( + actions=[TransferCallActionUpdateParams( + type=ActionType.ACTION_TRANSFER_CALL, + config=TransferCallActionUpdateParamsConfig( + phone_number="11234567890" + ) + )] + ) +) +``` + +```typescript TypeScript +vocode.numbers.updateNumber({ + phoneNumber: "11234567890", + inboundAgent: { + actions: [ + { + type: "action_transfer_call", + config: { + phoneNumber: "11234567890", + }, + }, + ], + }, +}); +``` + +```bash cURL +curl --request POST \ + --url https://api.vocode.dev/v1/numbers/update?phone_number=11234567890 \ + --header 'Content-Type: application/json' \ + --header 'Authorization: Bearer ' + --data '{ + "inbound_agent": { + "actions": [{ + "type": "action_transfer_call", + "config": { + "phone_number": "11234567890" + } + }] + } +}' +``` + + diff --git a/docs/vectordb.mdx b/docs/vectordb.mdx new file mode 100644 index 000000000..b8dc24b25 --- /dev/null +++ b/docs/vectordb.mdx @@ -0,0 +1,115 @@ +--- +title: "Vector databases" +description: "Give your agents knowledge via embeddings" +--- + +## Introduction + +For many practical use cases it may be necessary to give bots information; but, due to limited +context windows, there may not be enough room in the prompt. Thus, Vocode allows you to plug into +vector databases that contain embeddings. + +Each time the bot receives a message, it can query for the most similar embeddings; these embeddings will +be shown to the agent to guide its responses. + +Currently, we support [Pinecone](https://www.pinecone.io/). Under the hood, we use an approach similar +to Langchain to store the documents in Pinecone. Each vector in Pinecone must have two pieces of metadata +to be compatible with Vocode: + +- `text`: The text that will be shown to the agent. +- `source`: The name of the document where the text comes from. This could be the title of an article, + for example. + +## Connecting to Pinecone + +To add your vector database to your agent, you need to add a vector database config to your agent: + + + +```python update_agent.py +from vocode import PineconeVectorDatabaseUpdateParams + +agent = vocode_client.agents.update_agent( + id="AGENT_ID", + request=PineconeVectorDatabaseUpdateParams( + type="vector_database_pinecone", + index="PINECONE_INDEX", + api_key="PINECONE_API_KEY", + api_environment="PINECONE_API_ENVIRONMENT", + ), +) +``` + +```javascript updateAgent.js +const agent = await vocode.agents.updateAgent({ + id: "AGENT_ID", + body: { + vector_database: { + type: "vector_database_pinecone", + index: "PINECONE_INDEX", + api_key: "PINECONE_API_KEY", + api_environment: "PINECONE_API_ENVIRONMENTr", + }, + }, +}); + +main(); +``` + + + +Now your agent will query the vector database for each user message. + +## Document loading script + +You can manaully add documents to Pinecone any way you like as long as you include the required metadata. +If you have a folder of PDFs, docx files, text files, etc. that you want to add to pinecone, you can use +the below script which uses [Unstructured](https://github.com/Unstructured-IO/unstructured) to parse +many kinds of files types, extract the text, and add it to pinecone. + +The script was tested with these package versions: + +``` +python = "^3.10" +langchain = "^0.0.237" +spacy = "^3.6.0" +unstructured = {extras = ["local-inference"], version = "^0.8.1"} +layoutparser = {extras = ["layoutmodels", "tesseract"], version = "^0.3.4"} +pinecone-client = "^2.2.2" +openai = "^0.27.8" +torch = ">=2.0.0, !=2.0.1" +tiktoken = "^0.4.0" +``` + +```python +import os +import pinecone +from langchain.embeddings.openai import OpenAIEmbeddings +from langchain.text_splitter import SpacyTextSplitter +from langchain.vectorstores import Pinecone +from langchain.document_loaders import DirectoryLoader, UnstructuredFileLoader + +PINECONE_API_KEY = os.environ["PINECONE_API_KEY"] +PINECONE_ENVIRONMENT = os.environ["PINECONE_ENVIRONMENT"] +OPENAI_API_KEY = os.environ["OPENAI_API_KEY"] + + +loader = DirectoryLoader('./docs', glob="**/*.*", show_progress=True, loader_cls=UnstructuredFileLoader) +print("Loading documents...") +documents = loader.load() +text_splitter = SpacyTextSplitter(chunk_size=1000) +print("Splitting documents...") +docs = text_splitter.split_documents(documents) + +embeddings = OpenAIEmbeddings() + +pinecone.init( + api_key=PINECONE_API_KEY, + environment=PINECONE_ENVIRONMENT, +) + +index_name = "your_index_name" + +print("Creating index...") +docsearch = Pinecone.from_documents(docs, embeddings, index_name=index_name) +``` diff --git a/docs/webhooks.mdx b/docs/webhooks.mdx new file mode 100644 index 000000000..8a8437ca1 --- /dev/null +++ b/docs/webhooks.mdx @@ -0,0 +1,4 @@ +--- +title: "Webhooks" +description: "🚧 Under construction" +--- diff --git a/docs/welcome.mdx b/docs/welcome.mdx index e4d283b29..94c2ffb66 100644 --- a/docs/welcome.mdx +++ b/docs/welcome.mdx @@ -15,6 +15,34 @@ to answer/make phone calls, act as personal assistants, join Zoom meetings, and - Integrations to all of the best speech-to-text/text-to-speech providers - Cross-platform support (telephony, web, Zoom) +## Hosted Service + +The Vocode hosted service allows you to automate inbound/outbound calls via API. Users can program agents to +execute arbitrary tasks and leverage our integrations, or build their own. + +It is built with maximum developer flexibility in mind so you can embed an AI call center directly in your product or +operations flows. Get started with the [Hosted Service](/hosted-quickstart). + +## Open Source Library + +Most of what we build is open source and free to use! Leverage all of the features mentioned in the introduction by taking a look +at our open source repos. Get started with [Open Source](/open-source-quickstart). + +## Quickstarts + + + + Start using the hosted telephony service. + + + Run Vocode self hosted. + + + ## Demos @@ -75,44 +103,6 @@ to answer/make phone calls, act as personal assistants, join Zoom meetings, and -## Start Developing - - - - Quickly get up and running with Vocode by following our Python quick start - guide. - - - Learn the basics of what Vocode does, how it works, and how it can help you. - - - -### Replit Templates - - - - Spin up a phone number with ChatGPT on the other end. - - - Create a website that you can talk to. - - - Use Vocode as a tool to call someone in the real world. - - - ## How to contact us Learn more about how to take your documentation to the next level