mneedham / LearnDataWithMark

Code and scripts behind the @LearnDataWithMark YouTube channel
https://learndatawithmark.com
135 stars 38 forks source link

cannot get this to run. followed the instructions got an error , see inside. #37

Open tendaysaweek opened 10 months ago

tendaysaweek commented 10 months ago

{"payload":{"allShortcutsEnabled":true,"fileTree":{"chainlit-playground":{"items":[{"name":"README.md","path":"chainlit-playground/README.md","contentType":"file"},{"name":"chat.py","path":"chainlit-playground/chat.py","contentType":"file"},{"name":"chat_echo.py","path":"chainlit-playground/chat_echo.py","contentType":"file"},{"name":"chat_single.py","path":"chainlit-playground/chat_single.py","contentType":"file"}],"totalCount":4},"":{"items":[{"name":"chainlit-playground","path":"chainlit-playground","contentType":"directory"},{"name":"faiss-ann","path":"faiss-ann","contentType":"directory"},{"name":"fast-embed","path":"fast-embed","contentType":"directory"},{"name":"few-shot-prompting","path":"few-shot-prompting","contentType":"directory"},{"name":"gpt-instruct","path":"gpt-instruct","contentType":"directory"},{"name":"guidance-playground","path":"guidance-playground","contentType":"directory"},{"name":"intro-vector-search","path":"intro-vector-search","contentType":"directory"},{"name":"json-gpt","path":"json-gpt","contentType":"directory"},{"name":"langroid-sandbox","path":"langroid-sandbox","contentType":"directory"},{"name":"llava","path":"llava","contentType":"directory"},{"name":"llm-own-laptop","path":"llm-own-laptop","contentType":"directory"},{"name":"metadata","path":"metadata","contentType":"directory"},{"name":"ollama-mixtral","path":"ollama-mixtral","contentType":"directory"},{"name":"openclip-playground","path":"openclip-playground","contentType":"directory"},{"name":"parent-child-retriever","path":"parent-child-retriever","contentType":"directory"},{"name":"retrieval-augmented-generation","path":"retrieval-augmented-generation","contentType":"directory"},{"name":"summarise-emails","path":"summarise-emails","contentType":"directory"},{"name":"trueskill-playground","path":"trueskill-playground","contentType":"directory"},{"name":"vector-database","path":"vector-database","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"README.adoc","path":"README.adoc","contentType":"file"}],"totalCount":21}},"fileTreeProcessingTime":3.726507,"foldersToFetch":[],"reducedMotionEnabled":"system","repo":{"id":667697922,"defaultBranch":"main","name":"LearnDataWithMark","ownerLogin":"mneedham","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2023-07-18T08:36:40.000+03:00","ownerAvatar":"https://avatars.githubusercontent.com/u/13220?v=4","public":true,"private":false,"isOrgOwned":false},"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"main","listCacheKey":"v0:1689658615.0","canEdit":true,"refType":"branch","currentOid":"bc7694e30508708d83362c1aa8d5894b7ce8c62e"},"path":"chainlit-playground/chat.py","currentUser":{"id":69711075,"login":"tendaysaweek","userEmail":"adir@araneagroup.com"},"blob":{"rawLines":["import chainlit as cl","import litellm","","@cl.on_chat_start","def start_chat():"," system_message = {"," \"role\": \"system\", "," \"content\": \"You are a helpful assistant who tries their best to answer questions.\""," }"," cl.user_session.set(\"message_history\", [system_message])","","@cl.on_message","async def on_message(message: cl.Message):"," messages = cl.user_session.get(\"message_history\")"," if len(message.elements) > 0:"," for element in message.elements:"," messages.append({\"role\": \"user\", \"content\": element.content.decode(\"utf-8\")})"," confirm_message = cl.Message(content=f\"Uploaded file: {element.name}\")"," await confirm_message.send()",""," msg = cl.Message(content=\"\")"," await msg.send()"," "," messages.append({\"role\": \"user\", \"content\": message.content})",""," response = await litellm.acompletion("," model=\"ollama/mixtral\","," messages = messages,"," api_base=\"http://localhost:11434\","," stream=True"," )",""," async for chunk in response:"," if chunk:"," content = chunk.choices[0].delta.content"," if content:"," await msg.stream_token(content)",""," messages.append({\"role\": \"assistant\", \"content\": msg.content})"," await msg.update()"],"stylingDirectives":[[{"start":0,"end":6,"cssClass":"pl-k"},{"start":7,"end":15,"cssClass":"pl-s1"},{"start":16,"end":18,"cssClass":"pl-k"},{"start":19,"end":21,"cssClass":"pl-s1"}],[{"start":0,"end":6,"cssClass":"pl-k"},{"start":7,"end":14,"cssClass":"pl-s1"}],[],[{"start":0,"end":17,"cssClass":"pl-en"},{"start":1,"end":3,"cssClass":"pl-s1"},{"start":4,"end":17,"cssClass":"pl-s1"}],[{"start":0,"end":3,"cssClass":"pl-k"},{"start":4,"end":14,"cssClass":"pl-en"}],[{"start":2,"end":16,"cssClass":"pl-s1"},{"start":17,"end":18,"cssClass":"pl-c1"}],[{"start":4,"end":10,"cssClass":"pl-s"},{"start":12,"end":20,"cssClass":"pl-s"}],[{"start":4,"end":13,"cssClass":"pl-s"},{"start":15,"end":86,"cssClass":"pl-s"}],[],[{"start":2,"end":4,"cssClass":"pl-s1"},{"start":5,"end":17,"cssClass":"pl-s1"},{"start":18,"end":21,"cssClass":"pl-en"},{"start":22,"end":39,"cssClass":"pl-s"},{"start":42,"end":56,"cssClass":"pl-s1"}],[],[{"start":0,"end":14,"cssClass":"pl-en"},{"start":1,"end":3,"cssClass":"pl-s1"},{"start":4,"end":14,"cssClass":"pl-s1"}],[{"start":0,"end":5,"cssClass":"pl-k"},{"start":6,"end":9,"cssClass":"pl-k"},{"start":10,"end":20,"cssClass":"pl-en"},{"start":21,"end":28,"cssClass":"pl-s1"},{"start":30,"end":32,"cssClass":"pl-s1"},{"start":33,"end":40,"cssClass":"pl-v"}],[{"start":2,"end":10,"cssClass":"pl-s1"},{"start":11,"end":12,"cssClass":"pl-c1"},{"start":13,"end":15,"cssClass":"pl-s1"},{"start":16,"end":28,"cssClass":"pl-s1"},{"start":29,"end":32,"cssClass":"pl-en"},{"start":33,"end":50,"cssClass":"pl-s"}],[{"start":2,"end":4,"cssClass":"pl-k"},{"start":5,"end":8,"cssClass":"pl-en"},{"start":9,"end":16,"cssClass":"pl-s1"},{"start":17,"end":25,"cssClass":"pl-s1"},{"start":27,"end":28,"cssClass":"pl-c1"},{"start":29,"end":30,"cssClass":"pl-c1"}],[{"start":4,"end":7,"cssClass":"pl-k"},{"start":8,"end":15,"cssClass":"pl-s1"},{"start":16,"end":18,"cssClass":"pl-c1"},{"start":19,"end":26,"cssClass":"pl-s1"},{"start":27,"end":35,"cssClass":"pl-s1"}],[{"start":6,"end":14,"cssClass":"pl-s1"},{"start":15,"end":21,"cssClass":"pl-en"},{"start":23,"end":29,"cssClass":"pl-s"},{"start":31,"end":37,"cssClass":"pl-s"},{"start":39,"end":48,"cssClass":"pl-s"},{"start":50,"end":57,"cssClass":"pl-s1"},{"start":58,"end":65,"cssClass":"pl-s1"},{"start":66,"end":72,"cssClass":"pl-en"},{"start":73,"end":80,"cssClass":"pl-s"}],[{"start":6,"end":21,"cssClass":"pl-s1"},{"start":22,"end":23,"cssClass":"pl-c1"},{"start":24,"end":26,"cssClass":"pl-s1"},{"start":27,"end":34,"cssClass":"pl-v"},{"start":35,"end":42,"cssClass":"pl-s1"},{"start":42,"end":43,"cssClass":"pl-c1"},{"start":43,"end":75,"cssClass":"pl-s"},{"start":60,"end":74,"cssClass":"pl-s1"},{"start":60,"end":61,"cssClass":"pl-kos"},{"start":61,"end":68,"cssClass":"pl-s1"},{"start":69,"end":73,"cssClass":"pl-s1"},{"start":73,"end":74,"cssClass":"pl-kos"}],[{"start":6,"end":11,"cssClass":"pl-k"},{"start":12,"end":27,"cssClass":"pl-s1"},{"start":28,"end":32,"cssClass":"pl-en"}],[],[{"start":2,"end":5,"cssClass":"pl-s1"},{"start":6,"end":7,"cssClass":"pl-c1"},{"start":8,"end":10,"cssClass":"pl-s1"},{"start":11,"end":18,"cssClass":"pl-v"},{"start":19,"end":26,"cssClass":"pl-s1"},{"start":26,"end":27,"cssClass":"pl-c1"},{"start":27,"end":29,"cssClass":"pl-s"}],[{"start":2,"end":7,"cssClass":"pl-k"},{"start":8,"end":11,"cssClass":"pl-s1"},{"start":12,"end":16,"cssClass":"pl-en"}],[],[{"start":2,"end":10,"cssClass":"pl-s1"},{"start":11,"end":17,"cssClass":"pl-en"},{"start":19,"end":25,"cssClass":"pl-s"},{"start":27,"end":33,"cssClass":"pl-s"},{"start":35,"end":44,"cssClass":"pl-s"},{"start":46,"end":53,"cssClass":"pl-s1"},{"start":54,"end":61,"cssClass":"pl-s1"}],[],[{"start":2,"end":10,"cssClass":"pl-s1"},{"start":11,"end":12,"cssClass":"pl-c1"},{"start":13,"end":18,"cssClass":"pl-k"},{"start":19,"end":26,"cssClass":"pl-s1"},{"start":27,"end":38,"cssClass":"pl-en"}],[{"start":4,"end":9,"cssClass":"pl-s1"},{"start":9,"end":10,"cssClass":"pl-c1"},{"start":10,"end":26,"cssClass":"pl-s"}],[{"start":4,"end":12,"cssClass":"pl-s1"},{"start":13,"end":14,"cssClass":"pl-c1"},{"start":15,"end":23,"cssClass":"pl-s1"}],[{"start":4,"end":12,"cssClass":"pl-s1"},{"start":12,"end":13,"cssClass":"pl-c1"},{"start":13,"end":37,"cssClass":"pl-s"}],[{"start":4,"end":10,"cssClass":"pl-s1"},{"start":10,"end":11,"cssClass":"pl-c1"},{"start":11,"end":15,"cssClass":"pl-c1"}],[],[],[{"start":2,"end":7,"cssClass":"pl-k"},{"start":8,"end":11,"cssClass":"pl-k"},{"start":12,"end":17,"cssClass":"pl-s1"},{"start":18,"end":20,"cssClass":"pl-c1"},{"start":21,"end":29,"cssClass":"pl-s1"}],[{"start":4,"end":6,"cssClass":"pl-k"},{"start":7,"end":12,"cssClass":"pl-s1"}],[{"start":6,"end":13,"cssClass":"pl-s1"},{"start":14,"end":15,"cssClass":"pl-c1"},{"start":16,"end":21,"cssClass":"pl-s1"},{"start":22,"end":29,"cssClass":"pl-s1"},{"start":30,"end":31,"cssClass":"pl-c1"},{"start":33,"end":38,"cssClass":"pl-s1"},{"start":39,"end":46,"cssClass":"pl-s1"}],[{"start":6,"end":8,"cssClass":"pl-k"},{"start":9,"end":16,"cssClass":"pl-s1"}],[{"start":8,"end":13,"cssClass":"pl-k"},{"start":14,"end":17,"cssClass":"pl-s1"},{"start":18,"end":30,"cssClass":"pl-en"},{"start":31,"end":38,"cssClass":"pl-s1"}],[],[{"start":2,"end":10,"cssClass":"pl-s1"},{"start":11,"end":17,"cssClass":"pl-en"},{"start":19,"end":25,"cssClass":"pl-s"},{"start":27,"end":38,"cssClass":"pl-s"},{"start":40,"end":49,"cssClass":"pl-s"},{"start":51,"end":54,"cssClass":"pl-s1"},{"start":55,"end":62,"cssClass":"pl-s1"}],[{"start":2,"end":7,"cssClass":"pl-k"},{"start":8,"end":11,"cssClass":"pl-s1"},{"start":12,"end":18,"cssClass":"pl-en"}]],"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/mneedham/LearnDataWithMark/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":false,"repoAlertsPath":"/mneedham/LearnDataWithMark/security/dependabot","repoSecurityAndAnalysisPath":"/mneedham/LearnDataWithMark/settings/security_analysis","repoOwnerIsOrg":false,"currentUserCanAdminRepo":false},"displayName":"chat.py","displayUrl":"https://github.com/mneedham/LearnDataWithMark/blob/main/chainlit-playground/chat.py?raw=true","headerInfo":{"blobSize":"1.13 KB","deleteInfo":{"deleteTooltip":"Fork this repository and delete the file"},"editInfo":{"editTooltip":"Fork this repository and edit the file"},"ghDesktopPath":"x-github-client://openRepo/https://github.com/mneedham/LearnDataWithMark?branch=main&filepath=chainlit-playground%2Fchat.py","gitLfsPath":null,"onBranch":true,"shortPath":"ab21776","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fmneedham%2FLearnDataWithMark%2Fblob%2Fmain%2Fchainlit-playground%2Fchat.py","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"40","truncatedSloc":"33"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplateHelpUrl":"https://docs.github.com/articles/about-issue-and-pull-request-templates","issueTemplate":null,"discussionTemplate":null,"language":"Python","languageID":303,"large":false,"loggedIn":true,"newDiscussionPath":"/mneedham/LearnDataWithMark/discussions/new","newIssuePath":"/mneedham/LearnDataWithMark/issues/new","planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/mneedham/LearnDataWithMark/blob/main/chainlit-playground/chat.py","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","dismissStackNoticePath":"/settings/dismiss-notice/publish_stack_from_file","releasePath":"/mneedham/LearnDataWithMark/releases/new?marketplace=true","showPublishActionBanner":false,"showPublishStackBanner":false},"rawBlobUrl":"https://github.com/mneedham/LearnDataWithMark/raw/main/chainlit-playground/chat.py","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"repoOwner":"mneedham","repoName":"LearnDataWithMark","showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","showDependabotConfigurationBanner":false,"actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":false,"symbols":[{"name":"start_chat","kind":"function","ident_start":60,"ident_end":70,"extent_start":56,"extent_end":267,"fully_qualified_name":"start_chat","ident_utf16":{"start":{"line_number":4,"utf16_col":4},"end":{"line_number":4,"utf16_col":14}},"extent_utf16":{"start":{"line_number":4,"utf16_col":0},"end":{"line_number":9,"utf16_col":58}}},{"name":"on_message","kind":"function","ident_start":294,"ident_end":304,"extent_start":284,"extent_end":1152,"fully_qualified_name":"on_message","ident_utf16":{"start":{"line_number":12,"utf16_col":10},"end":{"line_number":12,"utf16_col":20}},"extent_utf16":{"start":{"line_number":12,"utf16_col":0},"end":{"line_number":39,"utf16_col":20}}}]}},"copilotInfo":{"documentationUrl":"https://docs.github.com/copilot/overview-of-github-copilot/about-github-copilot-for-business","notices":{"codeViewPopover":{"dismissed":false,"dismissPath":"/settings/dismiss-notice/code_view_copilot_popover"}},"userAccess":{"accessAllowed":false,"hasSubscriptionEnded":false,"orgHasCFBAccess":false,"userHasCFIAccess":false,"userHasOrgs":true,"userIsOrgAdmin":false,"userIsOrgMember":false,"business":null,"featureRequestInfo":null}},"copilotAccessAllowed":false,"csrf_tokens":{"/mneedham/LearnDataWithMark/branches":{"post":"KYlncU3Kypi6BGwvE7G8xRa6pbhVlj_MwcNbVryovaBzRCAVgKC0NPumCrD133dOFZ1xBL_KWPlXqhQj2gZXvA"},"/repos/preferences":{"post":"VzNKfcIafk7dOAOnadGgEH2cGP96uiaLQLAduuyM_5uGzyXFGjJhr8oiDpvlZqa5eL6O4Jxb8hNzbCVt7LXQnw"}}},"title":"LearnDataWithMark/chainlit-playground/chat.py at main · mneedham/LearnDataWithMark"} NameError: name 'true' is not defined

mneedham commented 10 months ago

Where did you run it? Do you know on which line it isn't working? I can't see anything called 'true' in the script so I'm not entirely sure where that comes from. - https://github.com/mneedham/LearnDataWithMark/blob/main/chainlit-playground/chat.py