A factory function to construct an object of typeSpeechConnection.
The returned connection object should not be used directly; instead it should be passed as an argument to the constructor ofSpeechClient.
The optionaloptionsargument may be used to configure aspects of the returnedSpeechConnection. Expected options are any of the types in the following option lists:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThe latest version of the Speech API is 2.37.0-rc, with links to previous versions ranging from 2.36.0 down to 2.11.0.\u003c/p\u003e\n"],["\u003cp\u003eKey classes include \u003ccode\u003eSpeechClient\u003c/code\u003e for speech transcription and resource management, and \u003ccode\u003eSpeechConnection\u003c/code\u003e for the client object, along with related classes for retry policies like \u003ccode\u003eSpeechRetryPolicy\u003c/code\u003e, \u003ccode\u003eSpeechLimitedErrorCountRetryPolicy\u003c/code\u003e and \u003ccode\u003eSpeechLimitedTimeRetryPolicy\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eStructs like \u003ccode\u003eSpeechBackoffPolicyOption\u003c/code\u003e, \u003ccode\u003eSpeechConnectionIdempotencyPolicyOption\u003c/code\u003e, \u003ccode\u003eSpeechPollingPolicyOption\u003c/code\u003e, and \u003ccode\u003eSpeechRetryPolicyOption\u003c/code\u003e are used with \u003ccode\u003egoogle::cloud::Options\u003c/code\u003e to configure various aspects of the speech connection.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eMakeSpeechConnection\u003c/code\u003e is a factory function that creates \u003ccode\u003eSpeechConnection\u003c/code\u003e objects, accepting a location and options as parameters to configure the connection, and has a deprecated overload that accepts options only.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eMakeDefaultSpeechConnectionIdempotencyPolicy\u003c/code\u003e returns a unique pointer to a \u003ccode\u003eSpeechConnectionIdempotencyPolicy\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Namespace google::cloud::speech_v2 (2.42.0-rc)\n\nVersion latestkeyboard_arrow_down\n\n- [2.42.0-rc (latest)](/cpp/docs/reference/speech/latest/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.41.0](/cpp/docs/reference/speech/2.41.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.40.0](/cpp/docs/reference/speech/2.40.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.39.0](/cpp/docs/reference/speech/2.39.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.38.0](/cpp/docs/reference/speech/2.38.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.37.0](/cpp/docs/reference/speech/2.37.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.36.0](/cpp/docs/reference/speech/2.36.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.35.0](/cpp/docs/reference/speech/2.35.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.34.0](/cpp/docs/reference/speech/2.34.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.33.0](/cpp/docs/reference/speech/2.33.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.32.0](/cpp/docs/reference/speech/2.32.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.31.0](/cpp/docs/reference/speech/2.31.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.30.0](/cpp/docs/reference/speech/2.30.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.29.0](/cpp/docs/reference/speech/2.29.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.28.0](/cpp/docs/reference/speech/2.28.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.27.0](/cpp/docs/reference/speech/2.27.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.26.0](/cpp/docs/reference/speech/2.26.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.25.1](/cpp/docs/reference/speech/2.25.1/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.24.0](/cpp/docs/reference/speech/2.24.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.23.0](/cpp/docs/reference/speech/2.23.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.22.1](/cpp/docs/reference/speech/2.22.1/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.21.0](/cpp/docs/reference/speech/2.21.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.20.0](/cpp/docs/reference/speech/2.20.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.19.0](/cpp/docs/reference/speech/2.19.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.18.0](/cpp/docs/reference/speech/2.18.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.17.0](/cpp/docs/reference/speech/2.17.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.16.0](/cpp/docs/reference/speech/2.16.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.15.1](/cpp/docs/reference/speech/2.15.1/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.14.0](/cpp/docs/reference/speech/2.14.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.13.0](/cpp/docs/reference/speech/2.13.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.12.0](/cpp/docs/reference/speech/2.12.0/namespacegoogle_1_1cloud_1_1speech__v2)\n- [2.11.0](/cpp/docs/reference/speech/2.11.0/namespacegoogle_1_1cloud_1_1speech__v2) \n\nClasses\n-------\n\n### [SpeechClient](/cpp/docs/reference/speech/latest/classgoogle_1_1cloud_1_1speech__v2_1_1SpeechClient)\n\nEnables speech transcription and resource management.\n\n### [SpeechConnection](/cpp/docs/reference/speech/latest/classgoogle_1_1cloud_1_1speech__v2_1_1SpeechConnection)\n\nThe [`SpeechConnection`](/cpp/docs/reference/speech/latest/classgoogle_1_1cloud_1_1speech__v2_1_1SpeechConnection) object for [`SpeechClient`](/cpp/docs/reference/speech/latest/classgoogle_1_1cloud_1_1speech__v2_1_1SpeechClient).\n\n### [SpeechConnectionIdempotencyPolicy](/cpp/docs/reference/speech/latest/classgoogle_1_1cloud_1_1speech__v2_1_1SpeechConnectionIdempotencyPolicy)\n\n### [SpeechLimitedErrorCountRetryPolicy](/cpp/docs/reference/speech/latest/classgoogle_1_1cloud_1_1speech__v2_1_1SpeechLimitedErrorCountRetryPolicy)\n\nA retry policy for [`SpeechConnection`](/cpp/docs/reference/speech/latest/classgoogle_1_1cloud_1_1speech__v2_1_1SpeechConnection) based on counting errors.\n\n### [SpeechLimitedTimeRetryPolicy](/cpp/docs/reference/speech/latest/classgoogle_1_1cloud_1_1speech__v2_1_1SpeechLimitedTimeRetryPolicy)\n\nA retry policy for [`SpeechConnection`](/cpp/docs/reference/speech/latest/classgoogle_1_1cloud_1_1speech__v2_1_1SpeechConnection) based on elapsed time.\n\n### [SpeechRetryPolicy](/cpp/docs/reference/speech/latest/classgoogle_1_1cloud_1_1speech__v2_1_1SpeechRetryPolicy)\n\nThe retry policy for [`SpeechConnection`](/cpp/docs/reference/speech/latest/classgoogle_1_1cloud_1_1speech__v2_1_1SpeechConnection).\n\nStructs\n-------\n\n### [SpeechBackoffPolicyOption](/cpp/docs/reference/speech/latest/structgoogle_1_1cloud_1_1speech__v2_1_1SpeechBackoffPolicyOption)\n\nUse with [`google::cloud::Options`](https://cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options.html) to configure the backoff policy.\n\n### [SpeechConnectionIdempotencyPolicyOption](/cpp/docs/reference/speech/latest/structgoogle_1_1cloud_1_1speech__v2_1_1SpeechConnectionIdempotencyPolicyOption)\n\nUse with [`google::cloud::Options`](https://cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options.html) to configure which operations are retried.\n\n### [SpeechPollingPolicyOption](/cpp/docs/reference/speech/latest/structgoogle_1_1cloud_1_1speech__v2_1_1SpeechPollingPolicyOption)\n\nUse with [`google::cloud::Options`](https://cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options.html) to configure the long-running operations polling policy.\n\n### [SpeechRetryPolicyOption](/cpp/docs/reference/speech/latest/structgoogle_1_1cloud_1_1speech__v2_1_1SpeechRetryPolicyOption)\n\nUse with [`google::cloud::Options`](https://cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1Options.html) to configure the retry policy.\n\nFunctions\n---------\n\n### MakeSpeechConnection(std::string const \\&, Options)\n\nA factory function to construct an object of type [`SpeechConnection`](/cpp/docs/reference/speech/latest/classgoogle_1_1cloud_1_1speech__v2_1_1SpeechConnection). \nThe returned connection object should not be used directly; instead it should be passed as an argument to the constructor of [SpeechClient](/cpp/docs/reference/speech/latest/classgoogle_1_1cloud_1_1speech__v2_1_1SpeechClient).\n\nThe optional `options` argument may be used to configure aspects of the returned [`SpeechConnection`](/cpp/docs/reference/speech/latest/classgoogle_1_1cloud_1_1speech__v2_1_1SpeechConnection). Expected options are any of the types in the following option lists:\n\n- [`google::cloud::CommonOptionList`](https://cloud.google.com/cpp/docs/reference/common/latest/namespacegoogle_1_1cloud.html)\n- [`google::cloud::GrpcOptionList`](https://cloud.google.com/cpp/docs/reference/common/latest/namespacegoogle_1_1cloud.html)\n- [`google::cloud::UnifiedCredentialsOptionList`](about:invalid#zCSafez)\n- [`google::cloud::speech_v2::SpeechPolicyOptionList`](about:invalid#zCSafez)\n\n| **Note:** Unexpected options will be ignored. To log unexpected options instead, set `GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes` in the environment.\n\n### MakeSpeechConnection(Options)\n\nA backwards-compatible version of the previous factory function. \nUnless the service also offers a global endpoint, the default value of the [`EndpointOption`](https://cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1EndpointOption.html) may be useless, in which case it must be overridden.\n| **Deprecated:** Please use the `location` overload instead.\n\n### MakeDefaultSpeechConnectionIdempotencyPolicy()"]]