browserpilot icon indicating copy to clipboard operation
browserpilot copied to clipboard

Enable OpenAI other compatible APIs

Open rapatel0 opened this issue 1 year ago • 7 comments

Two changes:

  • One added environmental variable to client setup to enable openAI compatible endpoints OPENAI_API_BASE_URL as environmental variable.
  • added strip command to OPENAIKey - Some weirdness happening with jupyter notebooks that requires this.

Tested with ollama and llama3

rapatel0 avatar Apr 22 '24 19:04 rapatel0

Don't merge this yet. Still debugging

rapatel0 avatar Apr 22 '24 22:04 rapatel0

Seems to be working now. Seems like llama3 has some hard coded text that where the "```python" continue from the prompt doesn't work. Added a regex to extract based on code markdown code blocks "```"

Seems to be working on my end but would appreciate a second pair of eyes.

Set OPENAI_API_BASE_URL to http://localhost:11434/v1/ to point to ollama and use llama3 as the instruction and response model. Alternatively you can try groq or something else.

Note the client object is not per model type, so there is no way to mix models between open ones and openai models.

rapatel0 avatar Apr 23 '24 15:04 rapatel0

Thanks @rapatel0. Could you take a look at some of my comments in the code?

handrew avatar Apr 23 '24 23:04 handrew

I can't anything in the review changes on github. Where are the comments?

rapatel0 avatar Apr 28 '24 10:04 rapatel0

I can't anything in the review changes on github. Where are the comments?

@rapatel0 Just tagged you.

handrew avatar Apr 28 '24 18:04 handrew

I might be being a moron here but still don't see anything

image

rapatel0 avatar Apr 29 '24 14:04 rapatel0

I might be being a moron here but still don't see anything

Hmm, that's odd! I'm not sure why it's not showing up. I'll just write it here:

  1. On line 304: could you

(1) add a space between elif and the string (2) use double quotes?

Sorry for the nit.

  1. On line 316: I'm a little reticent to start adding too much regex to the repo, which is why I have been dragging my feet on https://github.com/handrew/browserpilot/pull/8 though I could be convinced. Could you help motivate why we need this for other models?

handrew avatar Apr 29 '24 15:04 handrew