FixieEnvironment is not JSON serializable
graySquirrel opened this issue · comments
Just trying out the deploy of new test agent for first time.
all works well, but when i do
$ fixie agent deploy
I get
File "/usr/local/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type FixieEnvironment is not JSON serializable
agent is vanilla:
import random
import fixieai
BASE_PROMPT = "I am a simple agent that generates a random number between two given values."
FEW_SHOTS = """
Q: Generate a random number between 0 and 19.
Ask Func[genrand]: 0, 19
Func[genrand] says: 17
A: The random number is 17.
Q: Generate a random value from 5 to 10, inclusive.
Ask Func[genrand]: 5, 10
Func[genrand] says: 8
A: The random number is 8.
"""
agent = fixieai.CodeShotAgent(BASE_PROMPT, FEW_SHOTS)
@agent.register_func()
def genrand(query: fixieai.Message) -> str:
# print("query", query.text)
# foo = query.text.replace(" ", "")
# print("foo", foo)
# bar1, bar2 = foo.split(",")
# print("bar1", bar1, "bar2", bar2)
# print("intbar1", int(float(bar1)), "intbar2", int(float(bar2)))
low, high = query.text.replace(" ", "").split(",")
print("generating that random number", int(float(low)), int(float(high)))
genrand = random.randint(int(float(low)), int(float(high)))
print("genrand", genrand)
return str(genrand)
was fixed in 1.0.3