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

gemini api is not set proxy , resulting in a 60s timeout. #271

Closed
wrench1997 opened this issue May 20, 2024 · 1 comment
Closed

gemini api is not set proxy , resulting in a 60s timeout. #271

wrench1997 opened this issue May 20, 2024 · 1 comment

Comments

@wrench1997
Copy link

wrench1997 commented May 20, 2024

I can't find any specific functionality in the LangChain framework or the langchain_google_genai module that allows you to set or modify the user agent in requests to the Google SDK.
I found that using the following code can force the proxy in Linux, but not in Windows.

import os
os.environ["http_proxy"] = 'http://192.168.166.8:7890'
os.environ["https_proxy"] = 'http://192.168.166.8:7890'
@VinciGit00
Copy link
Owner

Try a configuration like this:

"""
Basic example of scraping pipeline using SmartScraper
"""

from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info

************************************************

Define the configuration for the graph

************************************************

graph_config = {
"llm": {
"api_key": "key",
"model": "gpt-3.5-turbo",
},
"loader_kwargs": {
"proxy" : {
"server": "http://65.87.29.253:3120",
"username": "marcodemo",
"password": "stat",
},
},
"verbose": True,
"headless": False,
}

************************************************

Create the SmartScraperGraph instance and run it

************************************************

smart_scraper_graph = SmartScraperGraph(
prompt="List me all the projects with their description",
# also accepts a string with the already downloaded HTML code
source="https://perinim.github.io/projects/",
config=graph_config
)

result = smart_scraper_graph.run()
print(result)

************************************************

Get graph execution info

************************************************

graph_exec_info = smart_scraper_graph.get_execution_info()
print(prettify_exec_info(graph_exec_info))

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