fix: cast user as string

This commit is contained in:
Justin Hayes 2024-07-26 11:07:14 -04:00 committed by GitHub
parent 316446e7a8
commit 0afe4aa849
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,7 +2,7 @@
title: RouteLLM Pipeline
author: justinh-rahb
date: 2024-07-25
version: 0.2.1
version: 0.2.2
license: MIT
description: A pipeline for routing LLM requests using RouteLLM framework, compatible with OpenAI API.
requirements: routellm, pydantic, requests
@ -102,6 +102,10 @@ class Pipeline:
# Prepare parameters, excluding 'model' and 'messages' if they're in body
params = {k: v for k, v in body.items() if k not in ['model', 'messages'] and v is not None}
# Ensure 'user' is a string if present
if 'user' in params and not isinstance(params['user'], str):
params['user'] = str(params['user'])
response = self.controller.completion(
model=model_name,
messages=messages,