OpenFn / apollo

GNU Lesser General Public License v2.1
0 stars 2 forks source link

Claude #94

Closed josephjclark closed 3 months ago

josephjclark commented 3 months ago

naive integration of Claude into the job_chat service

This should work seamlessly with Lightning, although the Lightning env will need updating to use an Anthropic API key (we may want to rename the var in the code base too)

At the moment the token usage is going to be pretty high - we're just throwing everything into the prompt and crossing our fingers.

There are other things I want to look into here but I may spin them out into other issues:

Some other future work to consider:

josephjclark commented 3 months ago

This is disappointing:

image

Claude should refuse to answer a question like this, which is unrelated to openfn.

I'm also getting quickly annoyed by this obsequious customer service attitude

EDIT: I've re-worked the prompt to lean more heavily on the system prompt, and it seems to work better

image

josephjclark commented 3 months ago

I've plugged prompt caching in. I dunno.

I am caching the job writing guide and adaptor doc stuff separately. I don't really know if that's the right thing to do.

I presume the cache is global, shared by all users (in the world). Because I guess all its doing is caching the embeddings from a raw string.

I have used a dollar of credit today just in testing, and I don't even think I've been testing very heavily. Yep, 40 calls. That's not a lot of traffic - but we send a LOT of input tokens because we include the adaptor API.

I think caching the job writing guide is a good idea. I think RAG for adaptor APIs is likely to be better because we can provide a significantly smaller, more relevant input.