Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Following Quick Start and Im facing a lot of issues #1271

Open
VIGNESHinZONE opened this issue Feb 17, 2024 · 9 comments
Open

DOC: Following Quick Start and Im facing a lot of issues #1271

VIGNESHinZONE opened this issue Feb 17, 2024 · 9 comments
Assignees

Comments

@VIGNESHinZONE
Copy link

VIGNESHinZONE commented Feb 17, 2024

Issue with current documentation:

Having a very buggy experience,

Tried following Mistral-

import os

hf_token = "api_key"
os.environ["HUGGINGFACE_ACCESS_TOKEN"] = hf_token

from embedchain import App

app = App.from_config("mistral.yaml")
app.add("https://www.forbes.com/profile/elon-musk")
app.add("https://en.wikipedia.org/wiki/Elon_Musk")
app.query("What is the net worth of Elon Musk today?")
# Answer: The net worth of Elon Musk today is $258.7 billion.

Response -

"\n  Use the following pieces of context to answer the query at the end.\n  If you don't know the answer, just say that you don't know, don't try to make up an answer.\n\n  billion as of December 2023[update], according to the Bloomberg Billionaires Index, and $182.6 billion according to Forbes, primarily from his ownership stakes in Tesla and SpaceX.[5][6][7] A member of the wealthy South African Musk family, Elon was born in Pretoria and briefly attended the University of Pretoria before immigrating to Canada at age 18, acquiring citizenship through his Canadian-born mother. Two years later, he matriculated at Queen's University at Kingston in Canada. Musk later transferred to the University of Pennsylvania, and received bachelor's degrees in economics and physics. He moved to California in 1995 to attend Stanford University, but dropped out after two days and, with his brother Kimbal, co-founded online city guide software company Zip2. The startup was acquired by Compaq for $307 million in 1999, and, that same year Musk co-founded X.com, a direct bank. X.com merged with Confinity in 2000 to form PayPal. In October 2002, eBay acquired PayPal for $1.5 billion, and that same year, with $100 million of the money he made, Musk founded SpaceX, a spaceflight services company. In 2004, he became an early investor in electric vehicle manufacturer Tesla Motors, Inc. (now Tesla, Inc.). He became its chairman and product architect, assuming the position of CEO in 2008. In 2006, Musk helped create SolarCity, a solar-energy company that was acquired by Tesla in 2016 and became Tesla Energy. In 2013, he proposed a hyperloop high-speed vactrain transportation system. In 2015, he co-founded OpenAI, a nonprofit artificial intelligence research company. The following year, Musk co-founded Neuralink—a neurotechnology company developing brain–computer interfaces—and the Boring Company, a tunnel construction company. In 2022, he acquired Twitter for $44 billion. He subsequently merged the company into newly created X Corp. and rebranded the service as X the following year. In March 2023, he founded xAI, an artificial intelligence company. Musk has | landed.[313][314][315] This led to Musk banning the ElonJet account on Twitter, as well as the accounts of journalists that posted stories regarding the incident, including Donie O'Sullivan, Keith Olbermann, and journalists from The New York Times, The Washington Post, CNN, and The Intercept.[316] Musk equated the reporting to doxxing.[317] Police do not believe there is a link between the account and alleged stalker.[318] Musk later took a Twitter poll on whether the journalists' accounts should be reinstated, which resulted in reinstating the accounts.[319] Wealth Net worth Musk's net worth from 2013 to 2023 as estimated by Forbes magazine Musk made $175.8 million when PayPal was sold to eBay in October 2002.[320] He was first listed on the Forbes Billionaires List in 2012, with a net worth of $2 billion.[321] At the start of 2020, Musk had a net worth of $27 billion.[322] By the end of the year his net worth had increased by $150 billion, mostly driven by his ownership of around 20% of Tesla stock.[323] During this period, Musk's net worth was often volatile. For example, it dropped $16.3 billion on September 8, the largest single-day plunge in Bloomberg Billionaires Index's history at the time.[324] In November of that year, Musk passed Facebook co-founder Mark Zuckerberg to become the third-richest person in the world; a week later he passed Microsoft co-founder Bill Gates to become the second-richest.[325] In January 2021, Musk, with a net worth of $185 billion, surpassed Amazon founder Jeff Bezos to become the richest person in the world.[326] Bezos reclaimed the top spot the following month.[327] On September 27, 2021, after Tesla stock surged, Forbes announced that Musk had a net worth of over $200 billion, and was the richest person in the world.[328] In November 2021, Musk became the first person to have a net worth of more than $300 billion.[329] On December 30, 2022, it was reported that Musk had lost $200 billion from his net worth due to declining | Elon Musk PROFILEElon MuskCEO, Tesla$205.2BReal Time Net Worthas of 2/17/24Reflects change since 5 pm ET of prior trading day. 2 in the world todayPhoto by Martin Schoeller for ForbesAbout Elon MuskElon Musk cofounded six companies, including electric car maker Tesla, rocket producer SpaceX and tunneling startup Boring Company.He owns about 21% of Tesla between stock and options, but has pledged more than half his shares as collateral for personal loans of up to $3.5 billion.SpaceX, founded in 2002, is worth nearly $150 billion after a $750 million tender offer in June 2023; it nearly quintupled its value in four years.Boring Company, which aims to defeat traffic, raised $675 million in April 2022 at a $5.7 billion valuation.Twitter's board agreed to sell the company to Musk for $44 billion in April 2022, after he disclosed a 9.1% stake and threatened a hostile takeover.The deal closed in October 2022 after Musk tried to back out and Twitter sued. Musk owns an estimated 74% of the company, which is now called X.Wealth HistoryHOVER TO REVEAL NET WORTH BY YEARForbes Lists 1Forbes 400 (2023)The Richest Person In Every State (2023) 2Billionaires (2023) 1Innovative Leaders (2019) 25Powerful People (2018) 12Richest In Tech (2017)Global Game Changers (2016)More ListsPersonal StatsAge52Source of WealthTesla, SpaceX, Self MadeSelf-Made Score8Philanthropy Score1ResidenceAustin, TexasCitizenshipUnited StatesMarital StatusSingleChildren11EducationBachelor of Arts/Science, University of PennsylvaniaDid you knowMusk, who says he's worried about population collapse, has ten children with three women, including triplets and two sets of twins.As a kid in South Africa, Musk taught himself to code; he sold his first game, Blastar, for about $500.In Their Own WordsI operate on the physics approach to analysis. You boil things down to the first principles or fundamental truths in a particular area and then you reason up from there.Elon MuskRelated People & CompaniesPeter\n\n  Query: What is the net worth of Elon Musk today?\n\n  Helpful Answer:\n  Elon Musk's net worth today is $205.2 billion, according to Forbes.\n\n  Detailed Answer:\n  According to the most recent data from Forbes, Elon Musk's net worth is $205.2 billion as of February 17, 2024. This reflects a change since the previous trading day. Musk's net worth is primarily derived from his ownership stakes in Tesla and SpaceX. He owns about 21% of Tesla between stock and options, but has pledged more than half his shares as collateral for personal loans of up to $3.5 billion. SpaceX, founded in 2002, is worth nearly $150 billion after a $750 million tender offer in June 2023, and Boring Company, which aims to defeat traffic, raised $675 million in April 2022 at a $5.7 billion valuation. Twitter's board agreed to sell the company to Musk for $44 billion in April 2022, and the deal closed in October 2022. Musk owns an estimated 74% of the company, which is now called X. Musk's net worth has been volatile in recent years, with significant gains and losses driven by the performance of Tesla stock. In November 2021, Musk became the first person to have a net worth of more than $300 billion. However, his net worth declined significantly in late 2022 due to declining stock prices."

This is basically the input to the LLM, why am I get this as an response

I tried using the OpenAI version and these results -

import os
# replace this with your OpenAI key
os.environ["OPENAI_API_KEY"] = "API_KEY"

from embedchain import App
app = App()
app.add("https://www.forbes.com/profile/elon-musk")
app.add("https://en.wikipedia.org/wiki/Elon_Musk")
app.query("What is the net worth of Elon Musk today?")

I got this error -

InvalidDimensionException: Embedding dimension 1536 does not match collection dimensionality 768. This is commonly a side-effect when an embedding function, different from the one used to add the embeddings, is used to retrieve an embedding from the database.

@VIGNESHinZONE
Copy link
Author

To reproduce the error, Im using Python 3.9.18, embedchain 0.1.80

@deshraj
Copy link
Collaborator

deshraj commented Feb 17, 2024

Thanks for reporting the issue @VIGNESHinZONE.

Seems like this is happening due to the mismatch between the dimensions of embedding models used for open source and OpenAI embedding model.

You can resolve this issue by changing the way you import the OpenAI based app like this:

from embedchain import App

conifg = {
    "app": {
        "collection_name": "openai-model",
        "id": "my-app-id"
    }
}

app = App.from_config(config=config)
app.add("https://www.forbes.com/profile/elon-musk")
app.add("https://en.wikipedia.org/wiki/Elon_Musk")
app.query("What is the net worth of Elon Musk today?")

@VIGNESHinZONE
Copy link
Author

@deshraj thanks for the quick response, but im getting new error -

SchemaWrongKeyError: Wrong keys 'collection_name', 'id' in {'collection_name': 'openai-model', 'id': 'my-app-id'}

During handling of the above exception, another exception occurred:

Hope I'm not missing anything.

Also would you know why mistral is spitting out the input query string to the llm instead of an answer

@deshraj
Copy link
Collaborator

deshraj commented Feb 17, 2024

Ah my bad. Here is the correct code:

from embedchain import App

config = {
    "app": {
        "config": {
            "collection_name": "openai-model",
            "id": "my-app-id"
        },
    }
}

app = App.from_config(config=config)
app.add("https://www.forbes.com/profile/elon-musk")
app.add("https://en.wikipedia.org/wiki/Elon_Musk")
app.query("What is the net worth of Elon Musk today?")

@deshraj
Copy link
Collaborator

deshraj commented Feb 17, 2024

Can you try to remove the db/ directory and try again? I will look into how to resolve this properly later today.

@deshraj deshraj self-assigned this Feb 17, 2024
@VIGNESHinZONE
Copy link
Author

VIGNESHinZONE commented Feb 17, 2024

But i fixed the error with new config -

llm:
  provider: openai
  config:
    model: 'gpt-3.5-turbo'
    temperature: 0.5
    max_tokens: 1000
    top_p: 1
    stream: false
embedder:
  provider: huggingface
  config:
    model: 'sentence-transformers/all-mpnet-base-v2'

code -

import os
os.environ["OPENAI_API_KEY"] = "API_key"

from embedchain import App

app = App.from_config("mistral.yaml")
app.add("https://www.forbes.com/profile/elon-musk")
app.add("https://en.wikipedia.org/wiki/Elon_Musk")
app.query("What is the net worth of Elon Musk today?")

@deshraj
Copy link
Collaborator

deshraj commented Feb 17, 2024

Thanks. You probably want to delete the OpenAI key that you posted accidently (if valid).

@VIGNESHinZONE
Copy link
Author

@deshraj thanks for the help, also would like to know your take on the performance of Mistral

"\n  Use the following pieces of context to answer the query at the end.\n  If you don't know the answer, just say that you don't know, don't try to make up an answer.\n\n  billion as of December 2023[update], according to the Bloomberg Billionaires Index, and $182.6 billion according to Forbes, primarily from his ownership stakes in Tesla and SpaceX.[5][6][7] A member of the wealthy South African Musk family, Elon was born in Pretoria and briefly attended the University of Pretoria before immigrating to Canada at age 18, acquiring citizenship through his Canadian-born mother. Two years later, he matriculated at Queen's University at Kingston in Canada. Musk later transferred to the University of Pennsylvania, and received bachelor's degrees in economics and physics. He moved to California in 1995 to attend Stanford University, but dropped out after two days and, with his brother Kimbal, co-founded online city guide software company Zip2. The startup was acquired by Compaq for $307 million in 1999, and, that same year Musk co-founded X.com, a direct bank. X.com merged with Confinity in 2000 to form PayPal. In October 2002, eBay acquired PayPal for $1.5 billion, and that same year, with $100 million of the money he made, Musk founded SpaceX, a spaceflight services company. In 2004, he became an early investor in electric vehicle manufacturer Tesla Motors, Inc. (now Tesla, Inc.). He became its chairman and product architect, assuming the position of CEO in 2008. In 2006, Musk helped create SolarCity, a solar-energy company that was acquired by Tesla in 2016 and became Tesla Energy. In 2013, he proposed a hyperloop high-speed vactrain transportation system. In 2015, he co-founded OpenAI, a nonprofit artificial intelligence research company. The following year, Musk co-founded Neuralink—a neurotechnology company developing brain–computer interfaces—and the Boring Company, a tunnel construction company. In 2022, he acquired Twitter for $44 billion. He subsequently merged the company into newly created X Corp. and rebranded the service as X the following year. In March 2023, he founded xAI, an artificial intelligence company. Musk has | landed.[313][314][315] This led to Musk banning the ElonJet account on Twitter, as well as the accounts of journalists that posted stories regarding the incident, including Donie O'Sullivan, Keith Olbermann, and journalists from The New York Times, The Washington Post, CNN, and The Intercept.[316] Musk equated the reporting to doxxing.[317] Police do not believe there is a link between the account and alleged stalker.[318] Musk later took a Twitter poll on whether the journalists' accounts should be reinstated, which resulted in reinstating the accounts.[319] Wealth Net worth Musk's net worth from 2013 to 2023 as estimated by Forbes magazine Musk made $175.8 million when PayPal was sold to eBay in October 2002.[320] He was first listed on the Forbes Billionaires List in 2012, with a net worth of $2 billion.[321] At the start of 2020, Musk had a net worth of $27 billion.[322] By the end of the year his net worth had increased by $150 billion, mostly driven by his ownership of around 20% of Tesla stock.[323] During this period, Musk's net worth was often volatile. For example, it dropped $16.3 billion on September 8, the largest single-day plunge in Bloomberg Billionaires Index's history at the time.[324] In November of that year, Musk passed Facebook co-founder Mark Zuckerberg to become the third-richest person in the world; a week later he passed Microsoft co-founder Bill Gates to become the second-richest.[325] In January 2021, Musk, with a net worth of $185 billion, surpassed Amazon founder Jeff Bezos to become the richest person in the world.[326] Bezos reclaimed the top spot the following month.[327] On September 27, 2021, after Tesla stock surged, Forbes announced that Musk had a net worth of over $200 billion, and was the richest person in the world.[328] In November 2021, Musk became the first person to have a net worth of more than $300 billion.[329] On December 30, 2022, it was reported that Musk had lost $200 billion from his net worth due to declining | Elon Musk PROFILEElon MuskCEO, Tesla$205.2BReal Time Net Worthas of 2/17/24Reflects change since 5 pm ET of prior trading day. 2 in the world todayPhoto by Martin Schoeller for ForbesAbout Elon MuskElon Musk cofounded six companies, including electric car maker Tesla, rocket producer SpaceX and tunneling startup Boring Company.He owns about 21% of Tesla between stock and options, but has pledged more than half his shares as collateral for personal loans of up to $3.5 billion.SpaceX, founded in 2002, is worth nearly $150 billion after a $750 million tender offer in June 2023; it nearly quintupled its value in four years.Boring Company, which aims to defeat traffic, raised $675 million in April 2022 at a $5.7 billion valuation.Twitter's board agreed to sell the company to Musk for $44 billion in April 2022, after he disclosed a 9.1% stake and threatened a hostile takeover.The deal closed in October 2022 after Musk tried to back out and Twitter sued. Musk owns an estimated 74% of the company, which is now called X.Wealth HistoryHOVER TO REVEAL NET WORTH BY YEARForbes Lists 1Forbes 400 (2023)The Richest Person In Every State (2023) 2Billionaires (2023) 1Innovative Leaders (2019) 25Powerful People (2018) 12Richest In Tech (2017)Global Game Changers (2016)More ListsPersonal StatsAge52Source of WealthTesla, SpaceX, Self MadeSelf-Made Score8Philanthropy Score1ResidenceAustin, TexasCitizenshipUnited StatesMarital StatusSingleChildren11EducationBachelor of Arts/Science, University of PennsylvaniaDid you knowMusk, who says he's worried about population collapse, has ten children with three women, including triplets and two sets of twins.As a kid in South Africa, Musk taught himself to code; he sold his first game, Blastar, for about $500.In Their Own WordsI operate on the physics approach to analysis. You boil things down to the first principles or fundamental truths in a particular area and then you reason up from there.Elon MuskRelated People & CompaniesPeter\n\n  Query: What is the net worth of Elon Musk today?\n\n  Helpful Answer:\n  Elon Musk's net worth today is $205.2 billion, according to Forbes.\n\n  Detailed Answer:\n  According to the most recent data from Forbes, Elon Musk's net worth is $205.2 billion as of February 17, 2024. This reflects a change since the previous trading day. Musk's net worth is primarily derived from his ownership stakes in Tesla and SpaceX. He owns about 21% of Tesla between stock and options, but has pledged more than half his shares as collateral for personal loans of up to $3.5 billion. SpaceX, founded in 2002, is worth nearly $150 billion after a $750 million tender offer in June 2023, and Boring Company, which aims to defeat traffic, raised $675 million in April 2022 at a $5.7 billion valuation. Twitter's board agreed to sell the company to Musk for $44 billion in April 2022, and the deal closed in October 2022. Musk owns an estimated 74% of the company, which is now called X. Musk's net worth has been volatile in recent years, with significant gains and losses driven by the performance of Tesla stock. In November 2021, Musk became the first person to have a net worth of more than $300 billion. However, his net worth declined significantly in late 2022 due to declining stock prices."

@deshraj
Copy link
Collaborator

deshraj commented Feb 17, 2024

Can you please reach out on our slack for these kinds of queries? Thanks

Link: https://embedchain.ai/slack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants