-
Hi. One of my input keys is an audio in base64 format, and it can get pretty large sometimes. Here is how LangSmith is setup and my current schema: os.environ["LANGCHAIN_PROJECT"] = LANGCHAIN_PROJECT
os.environ["LANGCHAIN_API_KEY"] = LANGCHAIN_API_KEY
os.environ["LANGCHAIN_TRACING_V2"] = "true" if LANGCHAIN_API_KEY else "false"
os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com"
class TranscriptionForm(BaseModel):
text: List[str] = []
audio_base64: List[str] = [] # I want to exclude this from appearing in the traces!
filename: List[str] = []
template: str
model: str = "gpt-4o-mini"
user_id: str = ""
user_rules: List[str] = []
output_format: str = "string" # or "json" |
Beta Was this translation helpful? Give feedback.
Answered by
pprobst
Nov 11, 2024
Replies: 1 comment
-
The easiest solution was to change the type of the input I wanted to hide to Pydantic's
Then, when you need to retrieve the value, you just: for audio in audio_base64:
if audio.__class__ == SecretStr:
audio = audio.get_secret_value() There are also other solutions, but since I'm using LangSmith with LangServe, just changing the type of one of the inputs to |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
pprobst
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The easiest solution was to change the type of the input I wanted to hide to Pydantic's
SecretStr
:audio_base64: List[SecretStr] = []
Then, when you need to retrieve the value, you just:
There are also other solutions, but since I'm using LangSmith with LangServe, just changing the type of one of the inputs to
SecretStr
works better for me.