From 6b6ff5a70d53c80178afc12fb8f98d964127acab Mon Sep 17 00:00:00 2001 From: Adnaan Sachidanandan Date: Mon, 27 Nov 2023 10:28:26 -0800 Subject: [PATCH] updated hosted-api docs (#445) --- docs/do-not-call-detection.mdx | 4 ++-- docs/injecting-context.mdx | 8 ++++--- docs/machine-detection.mdx | 6 +++--- docs/retrieve-call-data.mdx | 4 ++-- docs/setting-up-webhook.mdx | 2 +- docs/using-actions.mdx | 38 +++++++++++++++++++--------------- docs/vectordb.mdx | 14 +++++++------ 7 files changed, 42 insertions(+), 34 deletions(-) diff --git a/docs/do-not-call-detection.mdx b/docs/do-not-call-detection.mdx index c93338180..504571247 100644 --- a/docs/do-not-call-detection.mdx +++ b/docs/do-not-call-detection.mdx @@ -17,13 +17,13 @@ The `run_do_not_call_detection` parameter on outbound call creation defines whet or not to run rudimentary Do Not Call analysis. ```python -from vocode import CreateCallAgentParams +from vocode import CreateCallAgentParams, PromptParams vocode_client.calls.create_call( from_number="", to_number="15555555555", agent=CreateCallAgentParams( - prompt=Prompt( + prompt=PromptParams( content="Ask Eliot if the sun is on today" ), ), diff --git a/docs/injecting-context.mdx b/docs/injecting-context.mdx index 4390c1116..75341f349 100644 --- a/docs/injecting-context.mdx +++ b/docs/injecting-context.mdx @@ -24,13 +24,15 @@ In order to have your bot use injected variables, the prompt must include templa our prompt to accept a user's first name and link it to our context endpoint. ```python -from vocode import AgentUpdateParams +from vocode import AgentUpdateParams, PromptUpdateParams 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" + inbound_agent=AgentUpdateParams( + prompt=PromptUpdateParams(content=name_prompt), + context_endpoint="YOUR_CONTEXT_URL", + ), ) ``` diff --git a/docs/machine-detection.mdx b/docs/machine-detection.mdx index 223ed7a9e..d3c81aaa5 100644 --- a/docs/machine-detection.mdx +++ b/docs/machine-detection.mdx @@ -11,17 +11,17 @@ phone call is an answerphone as well as subscribe to events relating to machine The `on_no_human_answer` parameter defines what should happen if a machine answers the phone. ```python -from vocode import CreateCallAgentParams +from vocode import CreateCallAgentParams, PromptParams vocode_client.calls.create_call( from_number="", to_number="15555555555", agent=CreateCallAgentParams( - prompt=Prompt( + prompt=PromptParams( content="Ask Ajay if his refrigerator is running" ), ), - on_no_human_answer="hangup" + on_no_human_answer="hangup", ) ``` diff --git a/docs/retrieve-call-data.mdx b/docs/retrieve-call-data.mdx index b3b808def..521f8c4e7 100644 --- a/docs/retrieve-call-data.mdx +++ b/docs/retrieve-call-data.mdx @@ -91,12 +91,12 @@ If you enabled call recording, you can download the call recording file. ```python Python -vocode_client.calls.recording(id="CALL_ID") +vocode_client.calls.get_recording(id="CALL_ID") ``` ```javascript TypeScript const calls = await vocode.calls.listCalls(); -const recording = await vocode.calls.recording({ id: calls[0].id }); +const recording = await vocode.calls.get_recording({ id: calls[0].id }); ``` ```curl cURL diff --git a/docs/setting-up-webhook.mdx b/docs/setting-up-webhook.mdx index bdff2ba2c..4f56f40f9 100644 --- a/docs/setting-up-webhook.mdx +++ b/docs/setting-up-webhook.mdx @@ -57,4 +57,4 @@ The full list of `EventType` is listed here: - `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. -- `EVENT_MACHINE_DETECTION`: Indicating whether a human or a machine has picked up the phone. +- `EVENT_HUMAN_DETECTION`: Indicating whether a human or a machine has picked up the phone. diff --git a/docs/using-actions.mdx b/docs/using-actions.mdx index b4a74b34d..050620bdd 100644 --- a/docs/using-actions.mdx +++ b/docs/using-actions.mdx @@ -11,9 +11,9 @@ Agents on phone calls can take three actions: ```python Python vocode_client.actions.create_action( - request=CreateActionRequest( - type="action_end_conversation", - ) + request={ + "type": "action_end_conversation", + } ) ``` @@ -41,9 +41,9 @@ curl --request POST \ ```python Python vocode_client.actions.create_action( - request=CreateActionRequest( - type="action_dtmf", - ) + request={ + "type":"action_dtmf", + } ) ``` @@ -71,12 +71,12 @@ curl --request POST \ ```python Python vocode_client.actions.create_action( - request=CreateActionRequest( - type="action_transfer_call", - config=TransferCallActionUpdateParamsConfig( - phone_number="11234567890" - ) - ) + request={ + "type":"action_transfer_call", + "config":{ + "phone_number":"11234567890" + } + } ) ``` @@ -109,9 +109,11 @@ You can attach these as IDs to your phone number agent as follows: ```python Python +from vocode import AgentUpdateParams + vocode_client.numbers.update_number( phone_number="11234567890", - inbound_agent=UpdateNumberRequestInboundAgent( + inbound_agent=AgentUpdateParams( actions=[""] ) ) @@ -145,14 +147,16 @@ You can also add these as actions as raw payloads as follows: ```python Python +from vocode import AgentUpdateParams, TransferCallActionUpdateParams + vocode_client.numbers.update_number( phone_number="11234567890", - inbound_agent=UpdateNumberRequestInboundAgent( + inbound_agent=AgentUpdateParams( actions=[TransferCallActionUpdateParams( type="action_transfer_call", - config=TransferCallActionUpdateParamsConfig( - phone_number="11234567890" - ) + config={ + "phone_number":"11234567890" + } )] ) ) diff --git a/docs/vectordb.mdx b/docs/vectordb.mdx index b8dc24b25..efcc3eb7b 100644 --- a/docs/vectordb.mdx +++ b/docs/vectordb.mdx @@ -27,15 +27,17 @@ To add your vector database to your agent, you need to add a vector database con ```python update_agent.py -from vocode import PineconeVectorDatabaseUpdateParams +from vocode import AgentUpdateParams, 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", + request=AgentUpdateParams( + vector_database=PineconeVectorDatabaseUpdateParams( + type="vector_database_pinecone", + index="PINECONE_INDEX", + api_key="PINECONE_API_KEY", + api_environment="PINECONE_API_ENVIRONMENT", + ) ), ) ```