-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Python SDK introduces double-quotes #2209
Comments
The issue seems to be with the used def to_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.
"""
if value is None:
return ""
if hasattr(value, "isoformat") and callable(value.isoformat):
# Used when the value is a datetime object
return value.isoformat()
value = todict(value)
if as_json:
return json.dumps(value, default=lambda o: o.__dict__, ensure_ascii=False)
# Return shorter version of object
yaml_str = yaml.dump(value, allow_unicode=True)
json_str = json.dumps(value, default=lambda o: o.__dict__, ensure_ascii=False)
if len(tokenizer.encode(yaml_str)) < len(tokenizer.encode(json_str)):
return yaml_str
return json_str If the value is of the type string, it shouldn't use JSON or YAML encoding. |
@jbaron - Thank you for your inquiry about your Teams app development issue! We will check and update you soon. |
Hello @jbaron ,Thank you for your patience! We have reported this as a bug for further investigation. We will keep you updated as soon as we receive further information. Thank you for bringing this to our attention! |
@BMS-geodev could you leave a comment here for assignment? |
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: