You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the Python teams-ai library, the input messages receive additional double-quotes. This doesn't happen with the initial input, but happens with the sub-sequential inputs.
The action is still correct and has just the plain string, but somewhere in the process of converting the action into messages it goes wrong.
So for example when I enter in Teams, I see '"great"' back in the message history (so it has additional double-quotes).
This makes the LLM also use additional quotes in the response or format snippets badly.
When debugging the JavaScript version, this behavior was NOT observed.
Reproduction Steps
1. Enter first prompt (1 + 1) and waitfor result
2. Enter second prompt (great)
3. During debugging observe that the message history has additional double-quotes around great.
The text was updated successfully, but these errors were encountered:
The issue seems to be with the used to_string function that doesn't checks for plain strings and as a result uses json or yaml encoding.
defto_string(tokenizer: Tokenizer, value: Any, as_json: bool=False) ->str:
""" Converts a value to a string representation. Dates are converted to ISO strings and Objects are converted to JSON or YAML, whichever is shorter. Args: tokenizer (Tokenizer): The tokenizer object used for encoding. value (Any): The value to be converted. as_json (bool, optional): Flag indicating whether to return the value as JSON string. Defaults to False. Returns: str: The string representation of the value. """ifvalueisNone:
return""ifhasattr(value, "isoformat") andcallable(value.isoformat):
# Used when the value is a datetime objectreturnvalue.isoformat()
value=todict(value)
ifas_json:
returnjson.dumps(value, default=lambdao: o.__dict__, ensure_ascii=False)
# Return shorter version of objectyaml_str=yaml.dump(value, allow_unicode=True)
json_str=json.dumps(value, default=lambdao: o.__dict__, ensure_ascii=False)
iflen(tokenizer.encode(yaml_str)) <len(tokenizer.encode(json_str)):
returnyaml_strreturnjson_str
If the value is of the type string, it shouldn't use JSON or YAML encoding.
Language
Python
Version
latest
Description
When using the Python teams-ai library, the input messages receive additional double-quotes. This doesn't happen with the initial input, but happens with the sub-sequential inputs.
The action is still correct and has just the plain string, but somewhere in the process of converting the action into messages it goes wrong.
So for example when I enter in Teams, I see '"great"' back in the message history (so it has additional double-quotes).
This makes the LLM also use additional quotes in the response or format snippets badly.
When debugging the JavaScript version, this behavior was NOT observed.
Reproduction Steps
The text was updated successfully, but these errors were encountered: