Find answers from the community

s
F
Y
a
P
Updated 2 years ago

Has anyone tried putting there

Has anyone tried putting there application on the cloud? I've got a python application for creating SimpleVectorIndex from user documents and I was thinking I could just spin up a new instance everytime a user uploads content? Not sure on what the best option would be for a poor Uni student πŸ˜…πŸ˜‚
1
H
M
j
26 comments
Why would you spin up a new instance every time they upload a document. Wouldn't that be more expensive πŸ˜‚? or I missing the context. if you could give more context I could try to help.
I was thinking maybe a AWS lambda function?

https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html

I currently have a Vuejs + FastApi & Postgres application

I was wondering if would be better to host the Vuejs on CloudFlare (Very cheap) and move my postgres db to Supabase (Cheap) πŸ™‚

So I was wondering if hosting the python somewhere else might be a viable option

Happy to hear any suggestions though 😊
I see now. Like you said. I think you could have lambda function creates the simple vector index from uploaded user content and then you could save the index to temporary json file file and then store it in a S3 bucket.
Yeah exactly 😊

So I would only need to do the following if I'm correct:

  1. Store uploaded file from Vuejs
  2. Create Index
  3. Store output
  4. Sent output to my Supabase db
but you would need another lambda function to create the simplevectorindex from json file.
Alrighty I'll give it a go πŸ™‚ thanks @HAL 9000

Happy to hear any other suggestions people might have
because the json file could only be recreated by using LlamaIndex package again:
Plain Text
GPTSimpleVectorIndex.load_from_disk("index_file.json")
I actually forgot you could also save it as string
Plain Text
index = GPTSimpleVectorIndex(documents=[Document(...), ...])
index_str_as_json_str = index.save_to_string()

GPTSimpleVectorIndex.load_from_string(index_str_as_json_str)
Perfect that's what I was thinking
and I just realized what I wrote now lmao πŸ˜‚ edited it.
This is the calculation using AWS lambda alone, assuming I don't get >10K requests It's free πŸ™‚ if I get more that's a good problem to solve hahah
Attachment
Screenshot_20230227_004937_Chrome.jpg
I could also store my embeddings Supabase I think, I'll need to do further research πŸ™‚

https://supabase.com/blog/openai-embeddings-postgres-vector
@jerryjliu0 is it possible to output the OpenAi output Embeddings? πŸ™‚
@Matthew πŸ¦˜πŸ«• are you looking for embeddings across all document chunks, or only the document chunks that are returned with the response?
response.source_nodes contains source document chunks, each SourceNode should have embeddings
I think just per document response for now, and I'll just store that and everything else from the response in the Db πŸ™‚

Thanks for you help and for building such a great tool! πŸ‘ŒπŸ‘Œ
I didnt know supabase supports storing embeddings. Good to know
I think they only added it within the last month, from what I read on Hackernews it isn't the most efficient compared to pinecone or Quadrant but it'll do the job for me so I can get a beta version of my app out πŸ™‚
Does it only stores it or does it also do embedding similarity like pinecone?
I think it has similarity as well πŸ™‚
Sounds like you already have some good options, but just putting a plug in for Fly.io. It's what I'm using for Agent-HQ and it's been really nice. Here's tutorial:

https://ahmadrosid.com/blog/deploy-fastapi-flyio

They also have Machines (https://fly.io/docs/machines/guides-examples/functions-with-machines/) which you can use to run functions as a service (e.g. run one off machines with user code)
Oh awesome suggestion, I haven't used Fly.io before but that seems like a great option, thank you!
Okay for an update, When I tried to upload the layer for lambda python packages I wasn't able to fit everything below the max size, so I'm going to try your recommendation @bbornsztein πŸ™‚
Sorry for the slow update, I was able to use LLamaIndex on the cloud using ECS, I mainly followed this tutorial:
https://www.eliasbrange.dev/posts/deploy-fastapi-on-aws-part-2-fargate-alb/

And I had no major issues! At the current time it's going to cost $5 usd per month in AWS fees but I'll keep you updated as I increase my processing πŸ™‚
Add a reply
Sign up and join the conversation on Discord