Spaces:
MasterDee
/
Paused

nsarrazin chenhunghan Henry Chen Mishig Eliott C. commited on
Commit
9db8ced
·
unverified ·
1 Parent(s): 04a868e

Modular backends & support for openAI & AWS endpoints (#541)

Browse files

* Fix the response

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Should use /completions

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Use async generator

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Use openai npm

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Fix generateFromDefaultEndpoint

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Fix last char become undefined

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Better support for system prompt

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Updates

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Revert

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Update README

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Default system prompt

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* remove sk-

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Fixing types

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Fix lockfile

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Move .optional

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Add try...catch and controller.error(error)

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* baseURL

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Format

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Fix types

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Fix again

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Better error message

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Update README

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>

* Refactor backend to add support for modular backends

* readme fix

* readme update

* add support for lambda on aws endpoint

* upsate doc for lambda support

* fix typecheck

* make imports really optional

* readme fixes

* make endpoint creator async

* Update README.md

Co-authored-by: Henry Chen <1474479+chenhunghan@users.noreply.github.com>

* Update README.md

Co-authored-by: Henry Chen <1474479+chenhunghan@users.noreply.github.com>

* Update src/lib/server/endpoints/openai/endpointOai.ts

Co-authored-by: Henry Chen <1474479+chenhunghan@users.noreply.github.com>

* trailing comma

* Update README.md

Co-authored-by: Mishig <mishig.davaadorj@coloradocollege.edu>

* change readme example name

* Update src/lib/server/models.ts

Co-authored-by: Eliott C. <coyotte508@gmail.com>

* fixed preprompt to use conversation.preprompt

* Make openAI endpoint compatible with Azure OpenAI

* surface errors in generation

* Added support for llamacpp endpoint

* fix llamacpp endpoint so it properly stops

* Add llamacpp example to readme

* Add support for legacy configs

---------

Signed-off-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
Co-authored-by: Hung-Han (Henry) Chen <chenhungh@gmail.com>
Co-authored-by: Henry Chen <1474479+chenhunghan@users.noreply.github.com>
Co-authored-by: Mishig <mishig.davaadorj@coloradocollege.edu>
Co-authored-by: Eliott C. <coyotte508@gmail.com>

20 files changed +894 -358
Files changed (20)
.env+1
README.md+111-4
package-lock.json+227-2
package.json+4-1
src/lib/server/endpoints/aws/endpointAws.tsAdded+64
src/lib/server/endpoints/endpoints.tsAdded+42
src/lib/server/endpoints/llamacpp/endpointLlamacpp.tsAdded+100
src/lib/server/endpoints/openai/endpointOai.tsAdded+82
src/lib/server/endpoints/openai/openAIChatToTextGenerationStream.tsAdded+32
src/lib/server/endpoints/openai/openAICompletionToTextGenerationStream.tsAdded+32
src/lib/server/endpoints/tgi/endpointTgi.tsAdded+37
src/lib/server/generateFromDefaultEndpoint.ts+24-106
src/lib/server/modelEndpoint.tsDeleted-50
src/lib/server/models.ts+57-41
src/lib/server/summarize.ts+2-7
src/lib/server/websearch/generateQuery.ts+2-5
src/lib/utils/trimPrefix.tsDeleted-6
src/lib/utils/trimSuffix.tsDeleted-6
src/routes/conversation/[id]/+page.svelte+2
src/routes/conversation/[id]/+server.ts+75-130