Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a79a68c3
authored
Aug 13, 2024
by
CalciumIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update claude tools calling
parent
a0dfbfb9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
10 deletions
+16
-10
relay/channel/claude/dto.go
+3
-3
relay/channel/claude/relay-claude.go
+13
-7
No files found.
relay/channel/claude/dto.go
View file @
a79a68c3
...
@@ -31,9 +31,9 @@ type ClaudeMessage struct {
...
@@ -31,9 +31,9 @@ type ClaudeMessage struct {
}
}
type
Tool
struct
{
type
Tool
struct
{
Name
string
`json:"name"`
Name
string
`json:"name"`
Description
string
`json:"description,omitempty"`
Description
string
`json:"description,omitempty"`
InputSchema
InputSchema
`json:"input_schema"`
InputSchema
map
[
string
]
interface
{}
`json:"input_schema"`
}
}
type
InputSchema
struct
{
type
InputSchema
struct
{
...
...
relay/channel/claude/relay-claude.go
View file @
a79a68c3
...
@@ -63,15 +63,21 @@ func RequestOpenAI2ClaudeMessage(textRequest dto.GeneralOpenAIRequest) (*ClaudeR
...
@@ -63,15 +63,21 @@ func RequestOpenAI2ClaudeMessage(textRequest dto.GeneralOpenAIRequest) (*ClaudeR
for
_
,
tool
:=
range
textRequest
.
Tools
{
for
_
,
tool
:=
range
textRequest
.
Tools
{
if
params
,
ok
:=
tool
.
Function
.
Parameters
.
(
map
[
string
]
any
);
ok
{
if
params
,
ok
:=
tool
.
Function
.
Parameters
.
(
map
[
string
]
any
);
ok
{
claudeTool
s
=
append
(
claudeTools
,
Tool
{
claudeTool
:=
Tool
{
Name
:
tool
.
Function
.
Name
,
Name
:
tool
.
Function
.
Name
,
Description
:
tool
.
Function
.
Description
,
Description
:
tool
.
Function
.
Description
,
InputSchema
:
InputSchema
{
}
Type
:
params
[
"type"
]
.
(
string
),
claudeTool
.
InputSchema
=
make
(
map
[
string
]
interface
{})
Properties
:
params
[
"properties"
],
claudeTool
.
InputSchema
[
"type"
]
=
params
[
"type"
]
.
(
string
)
Required
:
params
[
"required"
],
claudeTool
.
InputSchema
[
"properties"
]
=
params
[
"properties"
]
},
claudeTool
.
InputSchema
[
"required"
]
=
params
[
"required"
]
})
for
s
,
a
:=
range
params
{
if
s
==
"type"
||
s
==
"properties"
||
s
==
"required"
{
continue
}
claudeTool
.
InputSchema
[
s
]
=
a
}
claudeTools
=
append
(
claudeTools
,
claudeTool
)
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment