zou-group / textgrad

TextGrad: Automatic ''Differentiation'' via Text -- using large language models to backpropagate textual gradients.
http://textgrad.com/
MIT License
1.52k stars 117 forks source link

Retry error #46

Closed interimblue closed 1 month ago

interimblue commented 2 months ago

Hi,

I'm trying to run the quickstart script from https://textgrad.readthedocs.io/en/latest/index.html

import textgrad as tg
# Step 1: Get an initial response from an LLM
model = tg.BlackboxLLM("command")
punchline = model(tg.Variable("write a punchline for my github package about optimizing compound AI systems", role_description="prompt", requires_grad=False))
punchline.set_role_description("a concise punchline that must hook everyone")

and am getting a retry error (see below).

I've tried this with both Cohere's command and OPENAI's gpt-4o. Receiving error in both cases.

RetryError: RetryError[<Future at 0x106540830 state=finished raised NotFoundError>]

Stack trace shows error occurs in: ChatCohere.generate(self, prompt, system_prompt, temperature, max_tokens, top_p) under response = self.client.chat(

Any idea what this might be? I'm able to ping cohere's API with my key directly from the same notebook.

mertyg commented 2 months ago

@interimblue apologies for this. @huangzhii , @vinid --- can we take a look at this to see what's wrong and update the example on the website?

vinid commented 2 months ago

Hello!

Can you send me the full stack trace?

Usually we get RetryError: RetryError[<Future at 0x106540830 state=finished raised NotFoundError>] when something is not working at top level, but there should be an exception before that!