langchain-tutorials's Introduction
langchain-tutorials's People
Forkers
chenguangwei ddddccccwww blackwhites afirez joeyzenghuan jiahuic barryemc yeshuawb3 xrunda aibihub knightcn1983 qianyouliang sxm1129 jeffreymu milanmayo liuzhloverr bigje8 superbayes to-be-architect coder-yangxin yuanmeng1120 tinali597 michaelzhao0517 zhangqinghua-fork 0xviviyorg z2labplus michellewkx snowxing zaishijizhidian seawenzhu zylhub fuxin123z asll666 lu-lucifer baldybaby shougou anixli yczhujian richiesh cvcuiwei hildam onekr-billy zhouzhangcheng123 zlei9607 l5276261 tj1116 joy0934 sndhmg zhouwenyang qichangzheng bluewhale1207 qinhy tyrozhang xxxnshining mmmmmmiracle nankokuchu sarahbrownplace ishaan-jaff zwf5458 ymg2007 f3270 syq23719034 hamza-farouk tyler4jin tommyzhn weixuan2008 fengshucui huhan8371 shuxiangzhang w38huang sachins-eng gutiejun mictho jefjin wgong orami01 vlnk2023 chaosun-ai dada01github jeremystudy unstoppable94 www6v chuwengming wind234 som-don ccp3170 zqwuming fangfanhhh ziniuw jevoncode chenyh19 xwydq kelewangzi milkmilkking googlestone fengshch zhaoqiubai 1110803040 tutumomo linnenelangchain-tutorials's Issues
把model.agenerate换成llmchain之后,chain.acall不能运行了;请问下是什么问题
loader = TextLoader("static/faq/ecommerce_faq.txt")
documents = loader.load()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
texts = text_splitter.split_documents(documents)
docsearch = Chroma.from_documents(texts, embeddings)
faq_chain = RetrievalQA.from_chain_type(
llm,
chain_type="stuff",
retriever=docsearch.as_retriever()
)
@tool("FAQ")
def faq(intput: str) -> str:
""""useful for when you need to answer questions about shopping policies, like return policy, shipping policy, etc."""
return faq_chain.acall(intput)
async def call_openai(question):
callback = AsyncIteratorCallbackHandler()
# coroutine = wait_done(model.agenerate(messages=[[HumanMessage(content=question)]]), callback.done)
coroutine = wait_done(faq(question), callback.done)
task = asyncio.create_task(coroutine)
print('coroutine', callback.aiter())
# <async_generator object AsyncIteratorCallbackHandler.aiter at 0x11e4ffa40>
async for token in callback.aiter():
yield f"{token}"
await task
Add ChatLiteLLM Tutorial
Hi I'm the maintainer of liteLLM https://github.com/BerriAI/litellm/
liteLLM adds support for 50+ models
ChatLiteLLM()
is integrated into langchain and allows you to call all models using the ChatOpenAI I/O interface
https://python.langchain.com/docs/integrations/chat/litellm
Here's an example of how to use ChatLiteLLM()
ChatLiteLLM(model="gpt-3.5-turbo")
ChatLiteLLM(model="claude-2", temperature=0.3)
ChatLiteLLM(model="command-nightly")
ChatLiteLLM(model="replicate/llama-2-70b-chat:2c1608e18606fad2812020dc541930f2d0495ce32eee50074220b87300bc16e1")
Deep Lake + OpenAI实现与GitHub代码聊天报错
model = ChatOpenAI(model="gpt-3.5-turbo")这步报错如下:
WARNING:langchain.chat_models.openai:WARNING! model is not default parameter.
model was transferred to model_kwargs.
Please confirm that model is what you intended.
ValidationError Traceback (most recent call last)
in <cell line: 4>()
2 from langchain.chains import ConversationalRetrievalChain
3
----> 4 model = ChatOpenAI(model="gpt-3.5-turbo")
5 qa = ConversationalRetrievalChain.from_llm(model,retriever=retriever)
/usr/local/lib/python3.10/dist-packages/pydantic/main.cpython-310-x86_64-linux-gnu.so in pydantic.main.BaseModel.init()
ValidationError: 1 validation error for ChatOpenAI
root
Parameters {'model'} should be specified explicitly. Instead they were passed in as part of model_kwargs
parameter. (type=value_error)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.