ai-forever / gigachain Goto Github PK
View Code? Open in Web Editor NEWThis project forked from langchain-ai/langchain
⚡ Фреймворк для создания комплексных приложений с LLM ⚡
License: MIT License
This project forked from langchain-ai/langchain
⚡ Фреймворк для создания комплексных приложений с LLM ⚡
License: MIT License
There is an LLMChainFilter
in gigachain
legacy API which can be used as additional filter for the chunks after they were retrieved from the vectorstore.
In the original version (langchain
) this LLMChainFilter
uses the prompt in English, including possible output values (YES/NO), but in gigachain
russian prompt is used with different output values (ДА/НЕТ).
For chain output parsing BooleanOutputParser
is used and it has YES and NO as predefined values (defined as class variables).
So if we try to use this filter as-is in the gigachain
chain, then there will be the following error as an example:
ValueError: BooleanOutputParser expected output value to include either YES or NO. Received ДА.
The code to reproduce the issue:
from langchain.retrievers import ContextualCompressionRetriever
from langchain.retrievers.document_compressors import LLMChainFilter
from langchain_community.chat_models.gigachat import GigaChat
from langchain_community.document_loaders import TextLoader
from langchain_community.embeddings.gigachat import GigaChatEmbeddings
from langchain_community.vectorstores import FAISS
from langchain_text_splitters import CharacterTextSplitter
from gigachat_issues.config.settings import DefaultSettings
settings = DefaultSettings()
DATA_PATH = settings.project_path / "gigachat_issues/boolean_parser_prompt/data"
def pretty_print_docs(docs):
print(
f"\n{'-' * 100}\n".join(
[f"Document {i+1}:\n\n" + d.page_content for i, d in enumerate(docs)]
)
)
documents = TextLoader(DATA_PATH / "state_of_the_union.txt").load()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
texts = text_splitter.split_documents(documents)
embeddings = GigaChatEmbeddings(
base_url=settings.gigachat_api_base_url,
credentials=settings.gigachat_api_credentials,
scope=settings.gigachat_api_scope,
verify_ssl_certs=False,
one_by_one_mode=True,
)
retriever = FAISS.from_documents(texts, embeddings).as_retriever()
model = GigaChat(
base_url=settings.gigachat_api_base_url,
model="GigaChat-Pro",
credentials=settings.gigachat_api_credentials,
scope=settings.gigachat_api_scope,
temperature=1e-15,
profanity_check=False,
verbose=False,
timeout=600,
verify_ssl_certs=False,
streaming=True,
)
filter_chain = LLMChainFilter.from_llm(model)
compression_retriever = ContextualCompressionRetriever(
base_compressor=filter_chain, base_retriever=retriever
)
compressed_docs = compression_retriever.invoke(
"What did the president say about Ketanji Jackson Brown"
)
pretty_print_docs(compressed_docs)
Description: Ubuntu 22.04.3 LTS
Python 3.10.12
gigachain 0.1.4
gigachain-community 0.0.16
gigachain-core 0.1.17
gigachat 0.1.16
@Rai220 здравствуйте
Пытаюсь запускать код из примера https://github.com/ai-forever/gigachain/blob/master/docs/docs/modules/agents/how_to/gigachat_agent.ipynb
from langchain_community.chat_models import GigaChat
from langchain.tools import tool
import pyfiglet
from langchain.agents import AgentExecutor, create_gigachat_functions_agent
from langchain.schema import HumanMessage, SystemMessage, AIMessage
@tool
def draw_bunner(number: str) -> None:
"""Рисует баннер с текстом
Args:
number (str): Число, который нужно нарисовать на баннере
"""
pyfiglet.print_figlet(number, font="epic")
giga = GigaChat(credentials=***", verify_ssl_certs=False, model="GigaChat-Plus")
new_tools = [draw_bunner]
agent = create_gigachat_functions_agent(giga, new_tools)
agent_executor = AgentExecutor(
agent=agent,
tools=new_tools,
verbose=True,
)
agent_executor.invoke(
{"input": "Найди курс биткоина в долларах и нарисуй это число на банере."}
)["output"]
В ответ получаю HTTP 422
Пробовал указывать разные модели, результат один
Стектрейс:
> Entering new AgentExecutor chain...
Traceback (most recent call last):
File "/home/roman/GIT/hass/gigachain/1test-model.py", line 25, in <module>
agent_executor.invoke(
File "/usr/local/lib/python3.10/dist-packages/langchain/chains/base.py", line 162, in invoke
raise e
File "/usr/local/lib/python3.10/dist-packages/langchain/chains/base.py", line 156, in invoke
self._call(inputs, run_manager=run_manager)
File "/usr/local/lib/python3.10/dist-packages/langchain/agents/agent.py", line 1391, in _call
next_step_output = self._take_next_step(
File "/usr/local/lib/python3.10/dist-packages/langchain/agents/agent.py", line 1097, in _take_next_step
[
File "/usr/local/lib/python3.10/dist-packages/langchain/agents/agent.py", line 1097, in <listcomp>
[
File "/usr/local/lib/python3.10/dist-packages/langchain/agents/agent.py", line 1125, in _iter_next_step
output = self.agent.plan(
File "/usr/local/lib/python3.10/dist-packages/langchain/agents/agent.py", line 387, in plan
for chunk in self.runnable.stream(inputs, config={"callbacks": callbacks}):
File "/usr/local/lib/python3.10/dist-packages/langchain_core/runnables/base.py", line 2424, in stream
yield from self.transform(iter([input]), config, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/langchain_core/runnables/base.py", line 2411, in transform
yield from self._transform_stream_with_config(
File "/usr/local/lib/python3.10/dist-packages/langchain_core/runnables/base.py", line 1497, in _transform_stream_with_config
chunk: Output = context.run(next, iterator) # type: ignore
File "/usr/local/lib/python3.10/dist-packages/langchain_core/runnables/base.py", line 2375, in _transform
for output in final_pipeline:
File "/usr/local/lib/python3.10/dist-packages/langchain_core/runnables/base.py", line 1035, in transform
for chunk in input:
File "/usr/local/lib/python3.10/dist-packages/langchain_core/runnables/base.py", line 4145, in transform
yield from self.bound.transform(
File "/usr/local/lib/python3.10/dist-packages/langchain_core/runnables/base.py", line 1045, in transform
yield from self.stream(final, config, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/langchain_core/language_models/chat_models.py", line 250, in stream
raise e
File "/usr/local/lib/python3.10/dist-packages/langchain_core/language_models/chat_models.py", line 234, in stream
for chunk in self._stream(
File "/usr/local/lib/python3.10/dist-packages/langchain_community/chat_models/gigachat.py", line 235, in _stream
for chunk in self._client.stream(payload):
File "/usr/local/lib/python3.10/dist-packages/gigachat/client.py", line 246, in stream
for chunk in stream_chat.sync(self._client, chat=chat, access_token=self.token):
File "/usr/local/lib/python3.10/dist-packages/gigachat/api/stream_chat.py", line 90, in sync
_check_response(response)
File "/usr/local/lib/python3.10/dist-packages/gigachat/api/stream_chat.py", line 79, in _check_response
raise ResponseError(response.url, response.status_code, b"", response.headers)
gigachat.exceptions.ResponseError: (URL('https://gigachat.devices.sberbank.ru/api/v1/chat/completions'), 422, b'', Headers([('server', 'nginx'), ('date', 'Fri, 16 Feb 2024 17:33:26 GMT'), ('content-type', 'application/json; charset=utf-8'), ('content-length', '70'), ('connection', 'keep-alive'), ('access-control-allow-credentials', 'true'), ('access-control-allow-headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization'), ('access-control-allow-methods', 'GET, POST, DELETE, OPTIONS'), ('access-control-allow-origin', 'https://beta.saluteai.sberdevices.ru'), ('x-request-id', 'b05d648f-ac12-4e13-86b3-dfcc782ed7bd'), ('x-session-id', '625022d4-55a7-417e-86e8-47432f94efd6'), ('allow', 'GET, POST'), ('strict-transport-security', 'max-age=31536000; includeSubDomains'), ('allow', 'GET, POST'), ('strict-transport-security', 'max-age=31536000; includeSubDomains')]))
Пытаюсь импортировать любую вещь из langchain.agents
и получаю такую ошибку. В чем может быть причина?
Process SpawnProcess-5:
Traceback (most recent call last):
File "C:\Python311\Lib\multiprocessing\process.py", line 314, in _bootstrap
self.run()
File "C:\Python311\Lib\multiprocessing\process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\hooki\Documents\coffeeface\src\ai-chat\.venv\Lib\site-packages\uvicorn\_subprocess.py", line 78, in subprocess_started
target(sockets=sockets)
File "C:\Users\hooki\Documents\coffeeface\src\ai-chat\.venv\Lib\site-packages\uvicorn\server.py", line 65, in run
return asyncio.run(self.serve(sockets=sockets))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\asyncio\runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\asyncio\base_events.py", line 650, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\hooki\Documents\coffeeface\src\ai-chat\.venv\Lib\site-packages\uvicorn\server.py", line 69, in serve
await self._serve(sockets)
File "C:\Users\hooki\Documents\coffeeface\src\ai-chat\.venv\Lib\site-packages\uvicorn\server.py", line 76, in _serve
config.load()
File "C:\Users\hooki\Documents\coffeeface\src\ai-chat\.venv\Lib\site-packages\uvicorn\config.py", line 433, in load
self.loaded_app = import_from_string(self.app)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hooki\Documents\coffeeface\src\ai-chat\.venv\Lib\site-packages\uvicorn\importer.py", line 19, in import_from_string
module = importlib.import_module(module_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\hooki\Documents\coffeeface\src\ai-chat\api\main.py", line 15, in <module>
from chat import ask_question, getChatHistory
File "C:\Users\hooki\Documents\coffeeface\src\ai-chat\api\chat.py", line 11, in <module>
from langchain.agents import Agent
File "C:\Users\hooki\Documents\coffeeface\src\ai-chat\.venv\Lib\site-packages\langchain\agents\__init__.py", line 44, in <module>
from langchain.agents.agent import (
File "C:\Users\hooki\Documents\coffeeface\src\ai-chat\.venv\Lib\site-packages\langchain\agents\agent.py", line 50, in <module>
from langchain.chains.base import Chain
File "C:\Users\hooki\Documents\coffeeface\src\ai-chat\.venv\Lib\site-packages\langchain\chains\__init__.py", line 53, in <module>
from langchain.chains.llm_summarization_checker.base import LLMSummarizationCheckerChain
File "C:\Users\hooki\Documents\coffeeface\src\ai-chat\.venv\Lib\site-packages\langchain\chains\llm_summarization_checker\base.py", line 22, in <module>
REVISED_SUMMARY_PROMPT = PromptTemplate.from_file(PROMPTS_DIR / "revise_summary.txt")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hooki\Documents\coffeeface\src\ai-chat\.venv\Lib\site-packages\langchain_core\prompts\prompt.py", line 205, in from_file
template = f.read()
^^^^^^^^
File "C:\Python311\Lib\encodings\cp1251.py", line 24, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 459: character maps to <undefined>
Приветствую!
Во время вызова эмбеддингов через GigaChatEmbeddings
получил такую странную ошибку:
HTTPSConnectionPool(host='openaipublic.blob.core.windows.net', port=443): Max retries exceeded with url: /gpt-2/encodings/main/vocab.bpe (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f5d90353640>: Failed to resolve 'openaipublic.blob.core.windows.net' ([Errno -3] Temporary failure in name resolution)"))
Для чего используется этот хост?
openaipublic.blob.core.windows.ne:443 /gpt-2/encodings/main/vocab.bpe
При сериализации целочек в которых участвует GigaChat не происходит сохранение дополнительных параметров в файл.
No response
giga = GigaChat(verify_ssl_certs=False, temperature=0.5)
chain = load_summarize_chain(giga, chain_type="map_reduce")
chain.save("summary_chain.json")
В summary_chain не будет флага verify_ssl_certs и temperature
Параметры должны сохраняться.
https://github.com/ai-forever/gigachain#:~:text=pip%20install%20%2DU%20gigahain_openai
допущена опечатка в названии пакета "gigachain_openai" в Readme.md (пропущена буква c):
pip install -U gigahain_openai
Битая ссылка в README: https://github.com/ai-forever/gigachain/blob/master/README.md
Агент-менеджер по продажам с автоматическим поиском по каталогу и формированием заказа
No response
Packege-ы, в которых в PyProject.toml нет рвздела [tool.langserve], не устанавливаются.
% gigachain app add summarize-anthropic
/Users/dmitry/.pyenv/versions/3.11.9/envs/ai/lib/python3.11/site-packages/langchain_cli/utils/pa │
│ ckages.py:45 in get_langserve_export │
│ │
│ 42 │ │ attr = data["tool"]["langserve"]["export_attr"] │
│ 43 │ │ package_name = data["tool"]["poetry"]["name"] │
│ 44 │ except KeyError as e: │
│ ❱ 45 │ │ raise KeyError("Invalid LangServe PyProject.toml") from e │
│ 46 │ return LangServeExport(module=module, attr=attr, package_name=package_name) │
│ 47 │
│ │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │ data = {'tool': {'poetry': {'name': 'summarize-anthropic', 'version': '0.1.0', │ │
│ │ 'description': "This template uses Anthropic's Claude2
to summarize long │ │
│ │ documents.", 'authors': ['Lance Martin [email protected]'], 'readme': │ │
│ │ 'README.md', 'dependencies': {'python': '>=3.8.1,<4.0', 'gigachain': '^0.1', │ │
│ │ 'langchainhub': '>=0.1.13', 'gigachain-anthropic': '^0.1.4'}, 'group': {'dev': │ │
│ │ {'dependencies': {'gigachain-cli': '>=0.0.21'}}}}, 'templates-hub': {'use-case': │ │
│ │ 'summarization', 'author': 'LangChain', 'integrations': ['Anthropic'], 'tags': │ │
│ │ ['summarization']}}, 'build-system': {'requires': ['poetry-core'], │ │
│ │ 'build-backend': 'poetry.core.masonry.api'}} │ │
│ │ f = <_io.TextIOWrapper name='/Users/dmitry/Library/Application │ │
│ │ Support/langchain/git_repos/ai_forever_gigachain_git_b7cf9490/templates/summariz… │ │
│ │ mode='r' encoding='UTF-8'> │ │
│ │ filepath = PosixPath('/Users/dmitry/Library/Application │ │
│ │ Support/langchain/git_repos/ai_forever_gigachain_git_b7cf9490/templates/summariz… │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
KeyError: 'Invalid LangServe PyProject.toml'
No response
% poetry add gigagraph
Using version ^0.0.45 for gigagraph
Updating dependencies
Resolving dependencies... (0.0s)
Because no versions of gigagraph match >0.0.45,<0.0.46
and gigagraph (0.0.45) depends on gigachain-core (>=0.1.48,<0.2.0), gigagraph (>=0.0.45,<0.0.46) requires gigachain-core (>=0.1.48,<0.2.0).
So, because opengpts depends on both gigachain-core (^0.2.0.1) and gigagraph (^0.0.45), version solving failed.
No response
Windows 10, Python 3.10.9, текущая версия GigaChain
@Rai220 Konstantin Krestnikov
Добрый день !
Помогите пожалуйста, пытаюсь выполнить Ваш пример:
from langchain.chat_models.gigachat import GigaChat llm = GigaChat(credentials="BLABLABLA==") from langchain.schema import HumanMessage question = "Какой плащ был у Понтия Пилата?" llm([HumanMessage(content=question)]).content[0:200] from langchain.document_loaders import TextLoader from langchain.text_splitter import ( CharacterTextSplitter, RecursiveCharacterTextSplitter, ) loader = TextLoader("мастер_и_маргарита.txt") documents = loader.load() text_splitter = RecursiveCharacterTextSplitter( chunk_size=1000, chunk_overlap=200, ) documents = text_splitter.split_documents(documents) print(f"Total documents: {len(documents)}") from langchain.vectorstores import Chroma from langchain_community.embeddings import GigaChatEmbeddings embeddings = GigaChatEmbeddings(one_by_one_mode=True, _debug_delay=0.005) from chromadb.config import Settings from langchain.vectorstores import Chroma db = Chroma.from_documents( documents, embeddings, client_settings=Settings(anonymized_telemetry=False), ) docs = db.similarity_search(question, k=4) len(docs) print(f"... {str(docs[0])[620:800]} ...") from langchain.chains import RetrievalQA qa_chain = RetrievalQA.from_chain_type(llm, retriever=db.as_retriever()) qa_chain({"query": question})
И получаю ошибку:
Profanity field is deprecated. Use 'profanity_check' instead. Total documents: 1 Traceback (most recent call last): File "F:\Work\Giga\Gigatest_01.py", line 33, in <module> db = Chroma.from_documents( File "C:\Python3_10_9\lib\site-packages\langchain_community\vectorstores\chroma.py", line 771, in from_documents return cls.from_texts( File "C:\Python3_10_9\lib\site-packages\langchain_community\vectorstores\chroma.py", line 729, in from_texts chroma_collection.add_texts( File "C:\Python3_10_9\lib\site-packages\langchain_community\vectorstores\chroma.py", line 275, in add_texts embeddings = self._embedding_function.embed_documents(texts) File "C:\Python3_10_9\lib\site-packages\langchain_community\embeddings\gigachat.py", line 124, in embed_documents for embedding in self._client.embeddings(texts=[text], model=model).data: File "C:\Python3_10_9\lib\site-packages\gigachat\client.py", line 214, in embeddings return self._decorator( File "C:\Python3_10_9\lib\site-packages\gigachat\client.py", line 202, in _decorator return call() File "C:\Python3_10_9\lib\site-packages\gigachat\client.py", line 215, in <lambda> lambda: post_embeddings.sync(self._client, access_token=self.token, input_=texts, model=model) File "C:\Python3_10_9\lib\site-packages\gigachat\api\post_embeddings.py", line 71, in sync return _build_response(response) File "C:\Python3_10_9\lib\site-packages\gigachat\api\post_embeddings.py", line 57, in _build_response raise AuthenticationError(response.url, response.status_code, response.content, response.headers) gigachat.exceptions.AuthenticationError: (URL('https://gigachat.devices.sberbank.ru/api/v1/embeddings'), 401, b'{"status":401,"message":"Unauthorized"}\n', Headers([('server', 'nginx'), ('date', 'Sat, 13 Jan 2024 20:10:08 GMT'), ('content-type', 'application/json; charset=utf-8'), ('content-length', '40'), ('connection', 'keep-alive'), ('x-request-id', '52c28f4b-9f96-4e09-a610-181e59e16fa0'), ('x-session-id', '0c1e6a1f-6363-408f-9d5d-b78e799d0a81'), ('allow', 'GET, POST'), ('strict-transport-security', 'max-age=31536000; includeSubDomains'), ('allow', 'GET, POST'), ('strict-transport-security', 'max-age=31536000; includeSubDomains')]))
Вот не понимаю, что не так - всё как у Вас, токен рабочий,
Если с ним же запускать код:
from langchain.schema import HumanMessage, SystemMessage from langchain.chat_models.gigachat import GigaChat chat = GigaChat(credentials=GigaChat(credentials="BLABLABLA==") messages = [ SystemMessage( content="Ты эмпатичный бот-психолог, который помогает пользователю решить его проблемы." ) ] while(True): user_input = input("User: ") messages.append(HumanMessage(content=user_input)) res = chat(messages) messages.append(res) print("Bot: ", res.content)
То всё работает - прошу хоть какой-то помощи.
from langchain.chat_models.gigachat import GigaChat
llm = GigaChat(credentials="ZWMwYmQwNDctZTdiYi00OTY4LTk5ODktNDZmMmQ2ZDAxYTk5OjgzNTgzMTk0LTEyN2QtNDE1ZS05ZTRiLTdlZmI0NTg0NTZiMA==")
from langchain.schema import HumanMessage
question = "Какой плащ был у Понтия Пилата?"
llm([HumanMessage(content=question)]).content[0:200]
from langchain.document_loaders import TextLoader
from langchain.text_splitter import (
CharacterTextSplitter,
RecursiveCharacterTextSplitter,
)
loader = TextLoader("мастер_и_маргарита.txt")
documents = loader.load()
text_splitter = RecursiveCharacterTextSplitter(
chunk_size=1000,
chunk_overlap=200,
)
documents = text_splitter.split_documents(documents)
print(f"Total documents: {len(documents)}")
from langchain.vectorstores import Chroma
from langchain_community.embeddings import GigaChatEmbeddings
embeddings = GigaChatEmbeddings(one_by_one_mode=True, _debug_delay=0.005)
from chromadb.config import Settings
from langchain.vectorstores import Chroma
db = Chroma.from_documents(
documents,
embeddings,
client_settings=Settings(anonymized_telemetry=False),
)
docs = db.similarity_search(question, k=4)
len(docs)
print(f"... {str(docs[0])[620:800]} ...")
from langchain.chains import RetrievalQA
qa_chain = RetrievalQA.from_chain_type(llm, retriever=db.as_retriever())
qa_chain({"query": question})
Ожидал ответ на вопрос. Но почему то ошибка авторизации
Реализовать подсчет токенов как для OpenAI https://python.langchain.com/docs/modules/model_io/models/llms/token_usage_tracking
Нужно понимать сколько при использовании GigaChat было использовано токенов и в будущем ресурсов.
Предлагаю адаптировать код
Параметр model не пишется в логе "Giga request: " метода langchain_community.chat_models.gigachat.GigaChat._build_payload. Т.о., выглядит, что параметр не устанавливается, что вводит в заблуждение. При этом, model это критичный параметр, т.к. разница между моделями gigachat может быть существенной.
Прошу добавить вывод параметра model в вывод запроса, который отправляется в gigachat.
https://github.com/ai-forever/gigachain
chat = GigaChat(credentials=..., verify_ssl_certs=False)
Более подробно написать про Авторизацию в API. Промучился полдня, так и не понял как авторизаваться. Что нужно использовать: Client ID, или Client Secret, или Авторизационные данные Bearer. Что за переменные (credentials, user, password, access_token).
Укажите что credentials - это токен авторизации который можно получить на сайте https://developers.sber.ru/studio/workspaces/
Спасибо.
В примере https://github.com/ai-forever/gigachain/blob/master/docs/docs/use_cases/question_answering/gigachat_qa.ipynb в разделе "Создание базы данных эмбеддингов" GigaChatEmbeddings недоступен.
No response
Should add
from langchain_community.embeddings.gigachat import GigaChatEmbeddings
Привет, уважаемая команда!
Мы бы хотели предложить создать локальный лидерборд для сравнения моделей в России, аналогичный лидерборду Hugging Face. Этот лидерборд поможет проводить сравнительную оценку между отечественными моделями и моделями с открытым исходным кодом, доступными за границей.
Наши цели:
Мы верим, что создание подобного лидерборда способствует прозрачности, развитию искусственного интеллекта и обработки естественного языка в России, а также обогатит общественное обсуждение. На данный момент, несмотря на существующий лидерборд от Hugging Face, отечественные модели отсутствуют на нем. Мы исследуем различные варианты создания такой платформы и будем благодарны за ваши идеи, комментарии и советы в этом вопросе.
Большое спасибо за внимание, и мы с нетерпением ждем обсуждения этой идеи и совместной работы!
Создание локального лидерборда и вовлечение экспертов
This repository is many commits ahead of the main LangChain. It is difficult to see what changes or advantages or disadvantages exist in this branch over the core LangChain branch.
What is the best way to translate all documentation so that the changes and enhancements are transparent?
Need English translation to make sense of what's being provided. See this page itself !! The questions are in Cyrillic.
Здравствуйте, получаю такую ошибку при создании эмбеддингов, в чем может быть прооблема?
https://gigachat.devices.sberbank.ru/api/v1/embeddings'), 500, b'{"status":500,"message":"Internal Server Error"
Текст, который отправляю:
С нами вы сможете полностью организовать работу компании: <a href="https://onboarding.go.example.ru/structure/" id="sLWWgEcP09RTm45bLX_Sl" data-node-name="Добавьте"> Добавьте </a> пользователей в систему. Создайте <a href="Процессы" id="cYUQiKktpmLtPKLUMxuEO" data-node-name="Процессы"> Процессы </a> и запустите по ним <a href="https://onboarding.go.example.ru/tasks" id="xoW6JGjYsIPt0X-6DVXA1" data-node-name="Задачи"> Задачи </a>. Используйте <a href="https://onboarding.go.example.ru/handbooks" id="n0zU4F4Bh8_NMb-giJV8B" data-node-name="Справочники"> Справочники </a>, как собственные базы данных. Сгруппируйте задачи в <a href="https://onboarding.go.example.ru/projects" id="QE1KI2GyVfcV4a-2EtN4x" data-node-name="Проекты"> Проекты </a>. Соберите полезную информацию в <a href="https://onboarding.go.example.ru/spaces" id="1eFK-JR6RTeSubWYuVCfe" data-node-name="Базе знаний"> Базе знаний </a> . Используйте <a href="https://onboarding.go.example.ru/conference?tab=9&tabId=&sidebarTab=AI" id="8O0Fac-SYwbaruX5vD2Db" data-node-name="AI-помощника"> AI-помощника </a> для быстрого доступа к информации. Общайтесь с помощью модуля <a href="https://onboarding.go.example.ru/conference" id="7226l7TDG5-X-1Gf1yCkT" data-node-name="Коммуникации"> Коммуникации </a> . Создавайте анкеты и опросы в <a href="Формах" id="Ht7TLauND9AHzIsLccecP" data-node-name="Формах"> Формах </a> . Храните данные о сотрудниках в модуле <a href="https://onboarding.go.example.ru/structure" id="0eTYDHHXnaC6CYN_MKBpK" data-node-name="Люди"> Люди </a> . Считайте <a href="https://onboarding.go.example.ru/labor-costs" id="HZ25nuH4PT3a2BELlXP-Q" data-node-name="Трудозатраты"> Трудозатраты </a> и анализируйте <a href="https://onboarding.go.example.ru/reports" id="blCw3_X7xy6nVizusfLLT" data-node-name="Отчеты"> Отчеты </a>. Для быстрого старта и легкой настройки, используйте интерактивную инструкцию.
1.https://github.com/ai-forever/gigachain/blob/4f795065c029310a59a5828ae6a496b424aadc82/docs/extras/integrations/chat/gigachat.ipynb ("Подробнее об этом вы можете прочитать в этом документе"))
2.https://github.com/ai-forever/gigachain/tree/4f795065c029310a59a5828ae6a496b424aadc82/docs/extras/integrations/chat Авторизационные данные в надежном месте. Сохранение ключей
)
3. https://github.com/ai-forever/gigachain/tree/4f795065c029310a59a5828ae6a496b424aadc82/docs/extras/integrations/chat ("Сгенерировать новый Client Secret"))
4. https://github.com/ai-forever/gigachain/blob/4f795065c029310a59a5828ae6a496b424aadc82/docs/extras/use_cases/summarization.ipynb (подробнее см. здесь))"
По всему репозиторию куча недействительных ссылок
I am encountering an ImportError when trying to import the 'GigaChat' class from the 'langchain.chat_models' module in my project. The specific error message is as follows:
ImportError: cannot import name 'GigaChat' from partially initialized module 'langchain.chat_models'
It seems that there might be a circular import issue or some other problem with the module's initialization.
I'm using Python 3.8.
I have checked for circular dependencies in my code and made sure that there are no circular imports within the 'langchain.chat_models' module or its dependencies.
I have tried importing the 'GigaChat' class locally within a specific function or method, but the import error still persists.
I have also verified that the module is installed correctly and accessible in the Python environment.
Any assistance in resolving this issue would be greatly appreciated. Please let me know if there is any additional information or code snippets I can provide to help diagnose and resolve the problem.
Thank you for your attention to this matter.
No response
Attempt to import the 'GigaChat' class from the 'langchain.chat_models' module.
Observe the ImportError with the given error message.
I expect to be able to import the 'GigaChat' class without any import errors.
python==3.10
gigachain==0.0.322
mrkl = initialize_agent(tools, self._llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True, handle_parsing_errors=True)
mrkl.run(message)
При инициализации mrkl генерирует промпт, где просится писать Final answer с маленькой буквы, парсер парсит Final Answer с большой буквы. Возникает ошибка. Локально исправил -- все работает. Исправьте пж
https://github.com/ai-forever/gigachain/blob/master/libs/langchain/langchain/agents/mrkl/prompt.py
Ожидается, чтобы агент работал
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.