Comments (10)
This looks like langroid
is not being recognized at all in your environment.
Please following the exact install instructions in the README of the langroid-examples
repo: https://github.com/langroid/langroid-examples
If it still doesn't work, let me know the exact steps you took to install langroid.
from langroid.
I followed the instructions and the script in the examples folder runs fine, but when I make another file let's say "lagroid.py" and copy the content of script "doc-chat-2.py" into that and run it then am getting the modulenotfound error. why is that?
from langroid.
In that case there may have been an issue with how the contents were copied. For example if you simply rename the script to new.py and run new.py it should of course work.
from langroid.
Thank you for your help. Apparently, now I am facing a connection error to OpenAI. I am running the following script:
(1) Get the lease document
import requests
file_url = "https://raw.githubusercontent.com/langroid/langroid-examples/main/examples/docqa/lease.txt"
response = requests.get(file_url)
with open('lease.txt', 'wb') as file:
file.write(response.content)
verify
#with open('lease.txt', 'r') as file:
print(file.read())
from langroid.agent.special import DocChatAgent, DocChatAgentConfig
from langroid.vector_store.lancedb import LanceDBConfig
from langroid.embedding_models.models import OpenAIEmbeddingsConfig
from langroid.embedding_models.models import SentenceTransformerEmbeddingsConfig
from langroid.parsing.parser import ParsingConfig
oai_embed_config = OpenAIEmbeddingsConfig(
model_type="openai",
model_name="text-embedding-ada-002",
dims=1536,
)
(2) Configure DocChatAgent
cfg = DocChatAgentConfig(
name="RAG",
parsing=ParsingConfig(
chunk_size=100,
overlap=20,
n_similar_docs=4,
),
show_stats=False,
cross_encoder_reranking_model="",
llm=llm_cfg,
vecdb=LanceDBConfig(
embedding=oai_embed_config,
collection_name="lease",
replace_collection=True,
),
doc_paths=["lease.txt"]
)
(3) Create DocChatAgent, interact with it
rag_agent = DocChatAgent(cfg)
response = rag_agent.llm_response("What is the start date of the lease?")
assert "2013" in response.content
And the error I got is this and keeps going on:
WARNING:langroid.language_models.utils:OpenAI API request failed with errorConnection error..
Retrying in 111.01054350577557 seconds...
2024-02-21 16:32:21 - WARNING - OpenAI API request failed with errorConnection error..
Retrying in 111.01054350577557 seconds...
WARNING:langroid.language_models.utils:OpenAI API request failed with errorConnection error..
Retrying in 266.38226142682373 seconds...
2024-02-21 16:34:15 - WARNING - OpenAI API request failed with errorConnection error..
Retrying in 266.38226142682373 seconds...
WARNING:langroid.language_models.utils:OpenAI API request failed with errorConnection error..
Retrying in 561.3158388183265 seconds...
2024-02-21 16:38:45 - WARNING - OpenAI API request failed with errorConnection error..
Retrying in 561.3158388183265 seconds...
I have enough balance in my openai account and generated new keys but it does not seem to work and stuck at making connection.
from langroid.
Before trying this example, can you run this and see if it works:
import langroid as lr
import langroid.language_models as lm
llm_config = lm.OpenAIGPTConfig()
agent_config = lr.ChatAgentConfig(
llm=llm_config,
system_message="You are a helpful assistant, help me with some questions"
)
agent = lr.ChatAgent(agent_config)
task = lr.Task(agent, interactive=True)
task.run()
from langroid.
This works!
from langroid.
This means your OpenAI API Key setup is all good.
Next try this simple doc-chat script :
python3 examples/docqa/rag-local-simple.py
Also see inside the script for other instructions.
I'm suggesting the above scripts since these are the simpler ones to try before the more complex doc-chat-2.py
from langroid.
Tried it, and the connection error persists.
from langroid.
Hello,
With the recent March 2024 updates, The code I have been running is throwing me this error:
TypeError Traceback (most recent call last)
in <cell line: 1>()
----> 1 from langroid.language_models.openai_gpt import (
2 OpenAIChatModel, OpenAIGPT, OpenAIGPTConfig
3 )
7 frames
/usr/lib/python3.10/typing.py in _type_check(arg, msg, is_argument, module, allow_special_forms)
174 return arg
175 if not callable(arg):
--> 176 raise TypeError(f"{msg} Got {arg!r:.100}.")
177 return arg
178
TypeError: Tuple[t0, t1, ...]: each t must be a type. Got <module 'PIL.Image' from '/usr/local/lib/python3.10/dist-packages/PIL/Image.py'>.
The following is the code I am using:
from langroid.language_models.openai_gpt import (
OpenAIChatModel, OpenAIGPT, OpenAIGPTConfig
)
It was working fine before, but after the recent updates, it is not.
from langroid.
Your error trace shows python3.10
. Langroid requires 3.11 as it says in the README.
from langroid.
Related Issues (20)
- structure-aware chunking of code and markdown HOT 3
- openai.AuthenticationError - OpenAI API key needed to access DocChatAgent using Ollama? HOT 2
- DocChatAgent ingest_docs: add window_ids after chunk creation HOT 2
- How do I use langroid to call a public API? HOT 3
- Can I use the Business LLM Model API in langroid? HOT 1
- Skipping USER when using a tool HOT 9
- 'langroid' is not a package HOT 6
- Error : each t must be a type. Got <module 'PIL.Image' HOT 2
- Need to fix -- Langroid import error in Colab notebook, with Python 3.10 HOT 2
- Update to latest DuckDuckGo search HOT 1
- Add pgvector vectorstore
- Improve DocChatAgent citations HOT 1
- RAG Agent Re-ingest During Subtask HOT 3
- DocChatAgent: Add fusion ranking when re-ranker is not used
- Request Multi-Modal Support for RAG Agents
- Use mock LLM responses in tests where we don't need real LLM
- Broken link in readme HOT 1
- Add streaming token usage for OpenAI models
- `litellm` conflict with Langroid's `pydantic` required version HOT 3
- Add QdrantDB FastEmbed
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.
from langroid.