-
Notifications
You must be signed in to change notification settings - Fork 60
feat(llm): property embedding #240
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
Open
MrJs133
wants to merge
65
commits into
apache:main
Choose a base branch
from
MrJs133:property_embedding
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 22 commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
74cf3c5
doc: update for inner repo (GraphPlatform-4190)
e9941ad
Merge branch 'master' of ssh://icode.baidu.com:8235/baidu/starhugegra…
imbajin d2e4e2e
Merge branch 'main' into master-icode
imbajin c5ec3ea
Merge branch 'main' into master-icode
HJ-Young 12221c9
docs(client): update README.md
imbajin 8343d3c
Merge remote-tracking branch 'github/main'
0036b2c
Merge branch 'main'
HJ-Young 173b9b2
Merge branch 'main' into master-icode
imbajin c9ef9ed
fix(llm): enable concurrency config in rag answer
imbajin c933c58
Merge branch 'main' into master-icode
imbajin 263758b
Merge branch 'main' into master-icode
imbajin 8a0e6cd
Merge branch 'main' into master-icode
imbajin a60887d
GraphPlatform-4765 [Tech Task] vermeer-client框架开发
43cdcae
update llm settings
b4f1a51
set num_gremlin_generate_example 0
142a44e
disable text2gql by default
9f245a0
remove log info
87cb1cf
temperature 0.01
961f582
merge community
4cbb47a
modify prompt to only output gql
36116e6
test_api_connection
5db4e0c
merge main to master
bf19a84
empty chunk
026c65c
build, get and remove property embeddings
f2ee374
limit the number of props to be updated
0e98879
disable pylint and modify limit logic
a3b864f
save after removing props
ac7e137
change key:value to value
8ace5a8
pv-embedding + set<(pk, pv)>
a9f92c4
vector/embedding api
18744d2
Merge branch 'main' into property_embedding
imbajin 89b2d47
match keywords and props
f14087a
fix ollama batch embeddings
ef37855
fix ollama single embedding
c24d210
pylint
f1fdbdb
Merge branch 'main' into property_embedding
MrJs133 2953dbc
fix ollama
cf279f5
split run()
182ecba
using get_texts_embeddings instead of get_text_embeddings
b7e7425
match properties and change the structure of fuzzy_matched_props
52c40cb
property subgraph_query
10e76cd
pylint
923502a
pylint
739479a
limit 2 times one day
9acaa96
pylint
86e6098
inner
b27d925
Merge branch 'main' into master-icode
imbajin 765e93f
Merge branch 'master-icode' into property_embedding
imbajin b5f31ff
format
50ec338
fix lint & comment
imbajin 7d9d67c
text2gremlin api
c918e73
change params
7b7260a
change params
3754211
text to json
7a2cf2b
detail
7b3e5e2
add graph_space in text2gremlin api
cb31b35
add graph_space in text2gremlin api
9778c37
change default in text2gremlin api
cf6d2e4
split build_semantic_index.run()
eb5e9f1
Merge branch 'property_embedding' of https://icode.baidu.com/baidu/st…
e75f68f
conflict
4aa1a4d
change daily limit
7b7c6d2
create pyhugegraph client by token
31bf971
change param
a0e460c
name -> graph
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
|
|
||
| from datetime import date | ||
| from fastapi import status, APIRouter, HTTPException | ||
| from hugegraph_llm.utils.log import log | ||
|
|
||
| API_CALL_TRACKER = {} | ||
|
|
||
| # pylint: disable=too-many-statements | ||
| def vector_http_api( | ||
| router: APIRouter, | ||
| update_embedding_func, | ||
| ): | ||
| @router.post("/vector/embedding", status_code=status.HTTP_200_OK) | ||
| def update_embedding_api(daily_limit: int = 2): | ||
| today = date.today() | ||
| for call_date in list(API_CALL_TRACKER.keys()): | ||
| if call_date != today: | ||
| del API_CALL_TRACKER[call_date] | ||
| call_count = API_CALL_TRACKER.get(today, 0) | ||
| if call_count >= daily_limit: | ||
| log.error("Rate limit exceeded for update_vid_embedding. Maximum %d calls per day.", daily_limit) | ||
| raise HTTPException( | ||
| status_code=status.HTTP_429_TOO_MANY_REQUESTS, | ||
| detail=f"API call limit of {daily_limit} per day exceeded. Please try again tomorrow." | ||
| ) | ||
| API_CALL_TRACKER[today] = call_count + 1 | ||
| result = update_embedding_func() | ||
| return result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.