Router.Audio.Transcriptions
Create a Transcription
Create transcriptionfrom orq_ai_sdk import Orq
import os
with Orq(
api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:
res = orq.router.audio.transcriptions.create(model="Malibu", enable_logging=True, diarize=False, tag_audio_events=True, timestamps_granularity="word", temperature=0.5, timestamp_granularities=[
"word",
"segment",
], retry={
"on_codes": [
429,
500,
502,
503,
504,
],
}, load_balancer={
"type": "weight_based",
"models": [
{
"model": "openai/gpt-4o",
"weight": 0.7,
},
],
}, timeout={
"call_timeout": 30000,
}, orq={
"fallbacks": [
{
"model": "openai/gpt-4o-mini",
},
],
"retry": {
"on_codes": [
429,
500,
502,
503,
504,
],
},
"identity": {
"id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"display_name": "Jane Doe",
"email": "jane.doe@example.com",
"metadata": [
{
"department": "Engineering",
"role": "Senior Developer",
},
],
"logo_url": "https://example.com/avatars/jane-doe.jpg",
"tags": [
"hr",
"engineering",
],
},
"load_balancer": {
"type": "weight_based",
"models": [
{
"model": "openai/gpt-4o",
"weight": 0.7,
},
{
"model": "anthropic/claude-3-5-sonnet",
"weight": 0.3,
},
],
},
"timeout": {
"call_timeout": 30000,
},
})
# Handle response
print(res)
import { Orq } from "@orq-ai/node";
const orq = new Orq({
apiKey: process.env["ORQ_API_KEY"] ?? "",
});
async function run() {
const result = await orq.router.audio.transcriptions.create({
model: "Malibu",
temperature: 0.5,
timestampGranularities: [
"word",
"segment",
],
retry: {
onCodes: [
429,
500,
502,
503,
504,
],
},
loadBalancer: {
type: "weight_based",
models: [
{
model: "openai/gpt-4o",
weight: 0.7,
},
],
},
timeout: {
callTimeout: 30000,
},
orq: {
fallbacks: [
{
model: "openai/gpt-4o-mini",
},
],
retry: {
onCodes: [
429,
500,
502,
503,
504,
],
},
identity: {
id: "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
displayName: "Jane Doe",
email: "jane.doe@example.com",
metadata: [
{
"department": "Engineering",
"role": "Senior Developer",
},
],
logoUrl: "https://example.com/avatars/jane-doe.jpg",
tags: [
"hr",
"engineering",
],
},
loadBalancer: {
type: "weight_based",
models: [
{
model: "openai/gpt-4o",
weight: 0.7,
},
{
model: "anthropic/claude-3-5-sonnet",
weight: 0.3,
},
],
},
timeout: {
callTimeout: 30000,
},
},
});
console.log(result);
}
run();
Show Parameters
Show Parameters
{
"model": str, # required
"prompt": Optional[str],
"enable_logging": Optional[bool],
"diarize": Optional[bool],
"response_format": Optional[Literal["json", "text", "srt", "verbose_json", "vtt"]],
"tag_audio_events": Optional[bool],
"num_speakers": Optional[float],
"timestamps_granularity": Optional[Literal["none", "word", "character"]],
"temperature": Optional[float],
"language": Optional[str],
"timestamp_granularities": List[Literal["word", "segment"]],
"name": Optional[str],
"fallbacks": { # optional
"model": str, # required
},
"retry": { # optional
"count": Optional[float],
"on_codes": List[float],
},
"load_balancer": Union[CreateTranscriptionLoadBalancer1],
"timeout": { # optional
"call_timeout": float, # required
},
"orq": { # optional
"name": Optional[str],
"fallbacks": { # optional
"model": str, # required
},
"retry": { # optional
"count": Optional[float],
"on_codes": List[float],
},
"identity": { # optional
"id": str, # required
"display_name": Optional[str],
"email": Optional[str],
"metadata": List[Dict[str, Any]],
"logo_url": Optional[str],
"tags": List[str],
},
"~~`contact`~~": { # optional
"id": str, # required
"display_name": Optional[str],
"email": Optional[str],
"metadata": List[Dict[str, Any]],
"logo_url": Optional[str],
"tags": List[str],
},
"load_balancer": Union[CreateTranscriptionLoadBalancerRouterAudioTranscriptions1],
"timeout": { # optional
"call_timeout": float, # required
},
},
"file": { # optional
"file_name": str, # required
"content": Union[bytes, IO[bytes], io.IOBase], # required
"content_type": Optional[str],
},
}
{
model: string; // required
prompt?: string;
enableLogging?: boolean;
diarize?: boolean;
responseFormat?: string;
tagAudioEvents?: boolean;
numSpeakers?: number;
timestampsGranularity?: string;
temperature?: number;
language?: string;
timestampGranularities?: string;
name?: string;
fallbacks?: {
model: string; // required
};
retry?: {
count?: number;
onCodes?: number[];
};
loadBalancer?: string;
timeout?: {
callTimeout: number; // required
};
orq?: {
name?: string;
fallbacks?: {
model: string; // required
};
retry?: {
count?: number;
onCodes?: number[];
};
identity?: {
id: string; // required
displayName?: string;
email?: string;
metadata?: Record<string, any>[];
logoUrl?: string;
tags?: string[];
};
~~`contact`~~?: {
id: string; // required
displayName?: string;
email?: string;
metadata?: Record<string, any>[];
logoUrl?: string;
tags?: string[];
};
loadBalancer?: string;
timeout?: {
callTimeout: number; // required
};
};
file?: File;
}
Show Response
Show Response
{
"text": str,
}
{
text: string;
}