& Tracing Works on Portkey‚ÄãLoggingSending your request through Portkey ensures that all of the requests are logged by defaultEach request log contains timestamp, model name, total cost, request time, request json, response json, and additional Portkey featuresTracingTrace id is passed along with each request and is visibe on the logs on Portkey dashboardYou can also set a distinct trace id for each request if you wantYou can append user feedback to a trace id as well. More info on this hereAdvanced LLMOps Features - Caching, Tagging, Retries‚ÄãIn addition to logging and tracing, Portkey provides more features that add production capabilities to your existing workflows:CachingRespond to previously served customers queries from cache instead of sending them again to OpenAI. Match exact strings OR semantically similar strings. Cache can save costs and reduce latencies by 20x.RetriesAutomatically reprocess any unsuccessful API requests upto 5 times. Uses an exponential backoff strategy, which spaces out retry attempts to prevent network overload.FeatureConfig KeyValue (Type)üîÅ Automatic Retriesretry_countinteger [1,2,3,4,5]üß† Enabling Cachecachesimple OR semanticTaggingTrack and audit ach user interaction in high detail with predefined tags.TagConfig KeyValue (Type)User TaguserstringOrganisation TagorganisationstringEnvironment TagenvironmentstringPrompt Tag (version/id/string)promptstringCode Example With All Features‚Äãheaders = Portkey.Config(    # Mandatory    api_key="<PORTKEY_API_KEY>",    # Cache Options    cache="semantic",    cache_force_refresh="True",    cache_age=1729,    # Advanced    retry_count=5,    trace_id="langchain_agent",    # Metadata    environment="production",    user="john",    organisation="acme",    prompt="Frost",)llm = OpenAI(temperature=0.9, headers=headers)print(llm("Two roads diverged in the yellow woods"))PreviousPortkeyNextPredibaseGet Portkey API KeySet Trace IDGenerate Portkey HeadersHow Logging & Tracing Works on
When building apps or agents using Langchain, you end up making multiple API calls to fulfill a single user request. However, these requests are not chained when you want to analyse them. With Portkey, all the embeddings, completion, and other requests from a single user request will get logged and traced to a common ID, enabling you to gain full visibility of user interactions.
When building apps or agents using Langchain, you end up making multiple API calls to fulfill a single user request. However, these requests are not chained when you want to analyse them. With Portkey, all the embeddings, completion, and other requests from a single user request will get logged and traced to a common ID, enabling you to gain full visibility of user interactions. ->: & Tracing Works on Portkey‚ÄãLoggingSending your request through Portkey ensures that all of the requests are logged by defaultEach request log contains timestamp, model name, total cost, request time, request json, response json, and additional Portkey featuresTracingTrace id is passed along with each request and is visibe on the logs on Portkey dashboardYou can also set a distinct trace id for each request if you wantYou can append user feedback to a trace id as well. More info on this hereAdvanced LLMOps Features - Caching, Tagging, Retries‚ÄãIn addition to logging and tracing, Portkey provides more features that add production capabilities to your existing workflows:CachingRespond to previously served customers queries from cache instead of sending them again to OpenAI. Match exact strings OR semantically similar strings. Cache can save costs and reduce latencies by 20x.RetriesAutomatically reprocess any unsuccessful API requests upto 5 times. Uses an exponential backoff strategy, which spaces out retry attempts to prevent network overload.FeatureConfig KeyValue (Type)üîÅ Automatic Retriesretry_countinteger [1,2,3,4,5]üß† Enabling Cachecachesimple OR semanticTaggingTrack and audit ach user interaction in high detail with predefined tags.TagConfig KeyValue (Type)User TaguserstringOrganisation TagorganisationstringEnvironment TagenvironmentstringPrompt Tag (version/id/string)promptstringCode Example With All Features‚Äãheaders = Portkey.Config(    # Mandatory    api_key="<PORTKEY_API_KEY>",    # Cache Options    cache="semantic",    cache_force_refresh="True",    cache_age=1729,    # Advanced    retry_count=5,    trace_id="langchain_agent",    # Metadata    environment="production",    user="john",    organisation="acme",    prompt="Frost",)llm = OpenAI(temperature=0.9, headers=headers)print(llm("Two roads diverged in the yellow woods"))PreviousPortkeyNextPredibaseGet Portkey API KeySet Trace IDGenerate Portkey HeadersHow Logging & Tracing Works on